• Skip to main content
  • Skip to primary sidebar

CodeBlogMoney

Make Money using Coding and Blogging

Understanding JMeter Results

January 28, 2015 by Jimmy

JMeter is the best and free Performance testing tool. This article is all about understanding JMeter results.

When I started working on JMeter for performance testing of Code Beautify, I got confused when got the result. All JMeter results terms are gibberish to me. So I have started searching Google to find and understand what this report wants to say. What I have learned would like to share with you.

This is a snapshot of sample JMeter results.

jmeter performance test results
Jmeter Performance Test Results

Understanding JMeter Results

Let’s decode this results:

This an aggregated Report of JMeter having these columns Label, # Samples, Average, Median, 90% Line, Max, Min, Error %, Throughput, KB/Sec.

  • Label: Label column display HTTP request created for the test. i.e for me the request is http://127.0.0.1/jsonviewer and give label as jsonviewer.
  • # Samples: Samples shows the number of HTTP request runs for the given thread. In this case, jsonviewer makes 682 requests.
  • Median: is a number which divides the samples into two equal halves. Half of the samples are smaller than the median, and half are larger.
  • 90% Line: is the value below which 90% of the samples fall. The remaining samples too at least as long as the value. This is a standard statistical measure.
  • Max / Min: These are the minimum and maximum value of the time required for receiving the web page.
  • Error %: This column indicated the percentage of error. For HTML Viewer made 641 requests and failed each and every request, so it gave 100% error rate. If Server is not able to serve the request, this column will help to determine the capability of the server to serve the requests.
  • Throughput: is calculated as requests/unit of time. The time is calculated from the start of the first sample to the end of the last sample. This includes any intervals between samples, as it is supposed to represent the load on the server. Formula : Throughput = (number of requests) / (total time).
  • KB/ Sec: The throughput measured in Kilobytes per second.

I hope this may help to understand JMeter’s results.

Filed Under: Performance, Testing Tagged With: Jmeter, performance result, Testing

Accessing instance method of JavaScript using this keyword inside each()

June 9, 2014 by Jimmy

As a Java or C# developer, this keyword can we be used in instance method or in the constructor to access variables or instance methods.

JavaScript is a prototype-based scripting language and supports Object-Oriented features and this keyword too.

JQuery is most popular JavaScript Cross-Platform library and 99.99% developers use it for web development. JQuery has $.each() to iterate jQuery object.

Like

var sum = 0;

var values = [ 10, 20, 30, 40, 50 ];

$.each( values, function(){
sum += this;
});

console.log( sum ); //sum would be 150

In above example, when elements iterate with each, it creates a dynamic object inside the method named this. Now using this object we can have the access to each element. in this example using this we can get the value.

How this can be used in Javascript class. Here is the example.

function Employee (position,name) {
    this.position = position;
    this.name = name;
    this.getInfo = function() {
         return this.name + ' ' + this.position +" earns "+this.getSalary();
    };

    this.getSalary = function(){
      return "$10,000";
    }
}

var employee = new Employee("Spy","James Bond");

console.log( employee.getInfo() );  // James Bond Spy earns $10,000

Now what if we use $.each() in Javascript class and want to use <strong>this </strong>keyword as Javascript class’s instance as well as to get element in the $.each iterator?

function Employee (position,name) {
    this.position = position;
    this.name = name;

    this.getInfo = function() {
        return this.name + ' ' + this.position +" earns "+this.getSalary();
    };

    this.getSalary = function(){
      return "$10,000";
    }

    this.printInfoIfSalary=function(salary){

      var salaryList = {"Manager": 20000, "Spy": 10000, "mentor": 5000};

      $.each( salaryList, function(key){
          if(salary==this){

           //Now what If I want to call getInfo from here
            this.getInfo(); //Wont Work
            getInfo(); //wont work

          }
      });
    }
}

var employee = new Employee("Spy","James Bond");

console.log( employee.getInfo() );  // James Bond Spy earns $10,000

employee.printInfoIfSalary(10000);

When employee.printInfoIfSalary(10000) executed, there is no way using this or with this to call getInfo() method within each method of jQuery and it will throw uncaught TypeError: undefined is not a function.

using this Uncaught TypeError: undefined is not a function

How can we fix this? I have spent more than 1 hour to solve this problem. but finally, I figured it out. Here is working code.

Working code to fix above issue.

function Employee (position,name) {
    this.position = position;
    this.name = name;
    //define thisObj as globle variable and give this reference
    //now thisObj can used as this if class instance
    var thisObj = this;
    this.getInfo = function() {
        return this.name + ' ' + this.position +" earns "+this.getSalary();
    };

    this.getSalary = function(){
      return "$10,000";
    }

    this.printInfoIfSalary=function(salary){

      var salaryList = {"Manager": 20000, "Spy": 10000, "mentor": 5000};

      $.each( salaryList, function(key){
          if(salary==this){

          //Now what If I want to call getInfo from here

          console.log(  thisObj.getInfo() ); //will Work

            //getInfo(); or this.getInfo() //wont work
          }
      });
    }
}
var employee = new Employee("Spy","James Bond");

console.log(employee.printInfoIfSalary(10000));

In this example, we define thisObj = this, reference of this variable to thisObj, and now thisObj can be the reference as an instance of this class.

I hope this example with help you to understand when jQuery and OOPs concepts need to use together.

Code for this example:  https://codebeautify.org/htmlviewer/e1ce80

 

 

Filed Under: JavaScript, jQuery, Problem Solving Tagged With: instance, Javascript, jquery, oop, reference, tag, this keyword

Welcome to CodeBeautify.org blog

January 10, 2014 by Jimmy

Code Beautify helps you to beautify your code.

Make Your Code Beautiful using CodeBeautify.org

I have developed this site to keep developer as specially UI developer and designer in mind.

CodeBeautify.org will help you to test and save your code that can be share on social platform or at http://stackoverflow.com/ to get help from expert developers.

User can create an account and store code as links. If you want to make public links, Save without login.

Let us know if you want to see a new utility or want to enhance exiting utility.

We are focusing on JSON, XML, JavaScript, HTML, CSS, and Conversion between types of data like XML to JSON , JSON to CSV and many more .

Waiting for your feedback…

Filed Under: Problem Solving Tagged With: welcome

  • « Go to Previous Page
  • Go to page 1
  • Interim pages omitted …
  • Go to page 4
  • Go to page 5
  • Go to page 6

Primary Sidebar

Categories

  • Blogging
  • HTML
  • Java
  • JavaScript
  • jQuery
  • JSON
  • MySql
  • Performance
  • PHP
  • Problem Solving
  • Python
  • Testing
  • XML

Copyright © 2021 · Metro Pro on Genesis Framework · WordPress · Log in