googleads
Performance Testing & Load Testing Using JMeter | Apache JMeter
Software Testing Technical

Performance Testing & Load Testing Using JMeter

 
Recently, one of our client had a opinion of conducting a conference for different level of audience from Medicine arena. At the same time , he also has a big plan to give a demo & depth analysis about their products & equipment’s through his website. To take it forward, Our first & foremost consideration is to check the capacity of the site to hold the N number of users’s. So, we started experimenting it by performing various operations from load & stress test using JMeter and the result is something extraordinary & fortunately all the metrics we used most precisely met our expectations to the core. With a same note, Planning to discuss about this real time scenario with you guys to portrait how we implemented it in our project. I’m pretty much sure that this article could make you informative & resourceful at the end.
 
Let’s walk through to discuss how to perform the basic load and stress testing using Jmeter in your web application. Plus, we also have a look on how to use the graphical user interface to build a test plan and to run tests against a web server.
 

What Is Jmeter & Why We should Use It?

JMeter is an open source desktop application that is designed to load the test and to measure the performance. Also, we can use it to stimulate various loads scenarios and output performance data in several ways, including CSV and XML files, and graphs.
 

Performance Testing Using JMeter :

 
 

 
Its written based on Ubuntu, but it work in other Linux libraries too. For the performance testing, don’t use production server, i.e., prepare one more server (we will call it as uat server) just equivalent production server.
 

Related: A Guide for Web Automation Testing With Ruby Cucumber And Watir

 

Prerequisites To Install JMeter

 
Java – Apache Jmeter 4.0 requires Java 8 or 9
 

Install Java

Apache JMeter is developed in Java, so we need to make sure Java is installed with the help of below command:
 

$ java -version
 

Apache JMeter

Download JMeter and unzip the zip/tar file into the directory where you want JMeter to be installed
 

Run JMeter

Use this command to run Jmeter

$ cd <jmeter unzip location>
$ ./jmeter.sh
 

Steps For Performance & Load Testing Using JMeter

 
The figure below shows how JMeter simulates the heavy load :
 

JMeter Test Plan

 
Here is the roadmap for this practical example
 

 

Step 1: Add Thread Group In JMeter

a. Launch JMeter using above command
b. Select Test Plan on the JMeter tree
c. Add Thread Group – Right click on the “Test Plan.”
d. Add a new thread group: Add -> Threads (Users) -> Thread Group
 

 
In thread group control panel, enter thread properties as below:
 

 

  • Setting the number of threads: 100 (Number of users connected to target website: 100)
  • Setting the loop count: 10 (Number of time to execute testing)
  • Setting the Ramp-Up Period: 100 (Defines how long it will take JMeter to get all threads running)

 
The Thread Count and The Loop Counts are different.
 

 
Ramp-Up Period addresses the JMeter whether how long it can delay before starting next user. For instance, Let’s assume we have 100 users, and on other hands, we have 100 second Ramp-Up period, then the delay between starting users would be 1 second (100 users /100 seconds)
 

 

Step 2:  Add JMeter HTTP request

Next, we need to add HTTP request JMeter elements in this test.
 
HTTP request Default

  • This element can be added by right-clicking on the Thread Group
  • Selecting: Add ->
  • Selecting Config Element ->
  • Selecting HTTP Request Defaults.

 

 
In the HTTP Request Defaults control panel, then you can enter the Website name which we are going to do performance testing. For example: http://www.google.com/
 
 

 
HTTP Request

  • Right-click on Thread Group
  • Selecting: Add ->
  • Selecting: Sampler ->
  • Selecting: HTTP Request.

 

 
 
In HTTP Request Control Panel, the Path field indicates which URL request you want to send to Google server.
 

 
For example, if you enter “search” in path field. JMeter will create the URL request http://www.google.com/search to that server.
 
If you keep the Path field blank, JMeter will create the URL request http://www.google.com to that server.
 

Step 3:  Adding Graph results listener in JMeter

 
JMeter can show the test result in Graph format.
 
Right click Test Plan, Add -> Listener -> Graph Results
 

 
 

Step 4: Run JMeter Test

 
Press Run button (Ctrl + R) on Toolbar to start the testing process. You will see the test result display on Graph at the real time. Don’t test using GUI mode!
 
We recommend to save this test as ‘jmx’ load and run from aws instance so that we will get more accurate results.
 
The image below presents a graph of a test plan for sample example, where we simulated 10 users who accessed the website with loop count as 10.
 

 
 
 
 

There are the following statistics, represented in colors:

 

  • Black: The total number of current samples sent.
  • Blue: The current average of all samples sent.
  • Red: The current standard deviation.
  • Green: Throughput rate that represents the number of requests per minute the server handled

 
We have to build different test samples with a different plan, i.e., building test plan with different criteria and save those test plan as jmx.
 

 
Then load those jmx into aws instance and prepare the test results like below. Let analyze the performance of the server in below figure.
 
 

 
 
 
To analyze the performance of the web server under test, we should focus on 2 parameters as follows,
 

  • Throughput
  • Deviation

 

Throughput & Deviation

The Throughput is the most significant parameter which represents the ability of the server to handle the heavy load. The higher the Throughput will bring the better server performance.
 
In this test, the throughput of that server is good. This value is quite decent, so we can conclude that server has good performance.

The deviation is shown in red – it indicates the deviation from the average. The smaller, the better.
 
NOTE: The above values depend on several factors like current server load at Google, your internet speed, your CPU power, etc. Hence, it’s very unlikely that you will get the same results as above. So don’t panic!
 

Advantage Of Using JMeter

 

  • The JMeter testing tool offers following benefit in Performance Testing.
  • JMeter can be used to test the performance of both static resources such as JavaScript and HTML, as well as dynamic resources.
  • It can help us to find the maximum number of concurrent users that your website can handle.
  • It  provides a variety of graphical performance reports for depth analysis.

 
Besides exploring, our pool of experts never refuse to share their knowledge with us. You could get more blogs about Technologies & Web development from the experts. Get tuned with us. You could also share your valuable ideas & thoughts with us in the comment section.
For more info reach us at info@agiratech.com
 
 

Leave a Reply

Your email address will not be published. Required fields are marked *