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.
Prerequisites To Install JMeter
Java – Apache Jmeter 4.0 requires Java 8 or 9
Apache JMeter is developed in Java, so we need to make sure Java is installed with the help of below command:
[code]$ java -version
Download JMeter and unzip the zip/tar file into the directory where you want JMeter to be installed
Use this command to run Jmeter
[code]$ cd <jmeter unzip location>
Steps For Performance & Load Testing Using JMeter
JMeter Test Plan
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/
- 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
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
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.
- 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 firstname.lastname@example.org
Latest posts by Bharanidharan Arumugam (see all)
- Distributed Transactions Patterns in Microservice Architecture - September 25, 2019
- Monolithic Architecture Vs Microservices Architecture – A Glance - July 25, 2019
- How To Upload Images/Files To AWS S3 Using Node.js - July 1, 2019