Introduction to JMeter
The Apache JMeter is 100% pure open-source software, which was first developed by Stefano Mazzocchi of the Apache Software Foundation, designed to load and performance testing of the system. You can use JMeter to analyze and measure the performance of web applications or different services. Performance Testing means checking the speed of web applications in different situations by increasing the number of users(heavy load) at a time, multiple and concurrent user traffic. JMeter is designed for testing Web Application or FTP application. It is also used for functional, JDBC connections and web services, etc. It required minimum JDK 5. We can also do regression testing by using JMeter.
Why JMeter?
It is completely free.We can download it from the internet,install and run it. It is simple to use. By using Jmeter we can simply analyze how much load a website can hold. JMeter can be used to test the performance of both static resources such as JavaScript and HTML, as well as dynamic resources, such as JSP, Servlets, and AJAX. JMeter provides a variety of graphical analyses of performance reports.
Features Of JMeter
- It is open source software for testing and also free of cost.
- It is a completely multithreading framework that allows concurrent sampling by many threads.
- It has a simple GUI. So, that user can use it easily. Hence, the user can run on any platform
- It is Platform independent.
- It has full Swing and lightweight component support.
- Users can also generate a test plan by using a text editor.
- Users can customize Jmeter as per the requirement. Hence, Save the effort of executing test cases manually.
- It is also known as all in one tool, We can do functional and no-functional both testing by using the Jmeter tool.
- It supports various protocols like HTTP, FTP, SOAP, JDBC, JMS, and LDAP. We can also use the tool for testing the performance of your database.
Performance Testing by using Jmeter
We are taking Example of webkul.com to measure the performance of the website.We perform testing by using 50 users.
step1:-Add Thread Group
Select Test plan and add thread group->Add->Threads(users)->Thread group
click on thread group
Now, We can see Below mentioned fields
We have to enter Name
The number of threads(users): Threads means user.Total numbers of virtual users performing the test script execution.
Ramp-up Period(in seconds):Ramp-up period defined how much time it takes to execute all thread(users).i.e.Thread is 50 and Ramp-up time is 10 seconds then, it means It takes 10 seconds to execute 50 threads(5 thread per second).
Loop Count: Loop Count is the number of executions for the script.
Step 2:-Add JMeter Config Element
Add HTTP Request Default by navigating Add ->Config Element ->HTTP Request Defaults
In the HTTP Request Defaults control panel, enter the Website name which you want to test (https://www.webkul.com)
- HTTP Request
Right-click on Test Webkul and navigate: Add ->Sampler ->HTTP Request.
In HTTP Request Control Panel, the Path field indicates which URL request you want to send to Webkul Server.
I have entered Blog under the path. It meant that It search https://www.webkul.com/blog
Note:- If path keep blank then it request url https://www.webkul.com
Step3:-Add Graph Result
Right click Test Plan, Add ->Listener ->Graph Results
JMeter display Result in the form of Graph.
Step4:-Run Test and get the test result
Now,We can run by pressing the Run button (Ctrl + R) on the Toolbar to start the software testing process. We can see the test result display on Graph.
The picture below presents a graph of a test plan, where we simulated 50 users who accessed on the website.
At the bottom of the picture, there are the following statistics, represented in colors:
- Black: Total number samples sent.
- Blue: The average samples sent.
- Red: The standard deviation.
- Green: Throughput rate
The throughput rate represents the total number of requests per minute a server can handle.
Now, We analyze the performance of webkul.com server
Throughput and Deviation are the two most important parameters to measure the performance of any software.
Throughput defines the ability to handle a heavy load, if a server has High throughput it means the performance of the server is also Good as the throughput is high.
The throughput of webkul server is 293.234.it means It can handle the 293.234 requests per minute.
Deviation defines how much the system is fluctuating in real-time.it indicates in red color. The smaller the deviation means Better the performance of any server.
Similarly, we analyze the performance of the Google server
The throughput of the Google server is high 1491.193/minutes.It means Google handle approx 1491 request per minute.The performance of the Google server is Good.
Google server has a high Throughput as compare to the Webkul server.
But the Deviation of Wekul server is better than the Google server. Webkul Deviation value is 193 while the Google server Deviation value is 577. The smaller the deviation, the better the performance of the sever.
6 comments
Ramp-up Period(in seconds):Ramp-up period defined how much time it takes to execute all thread(users).i.e.Thread is 50 and Ramp-up time is 10 seconds then, it means It takes 10 seconds to execute 50 threads(5 thread per second).
Deviation defines how much the system is fluctuating in real-time.it indicates in red color. The smaller the deviation means Better the performance of any server.Higher deviation means worst the performance or overloaded.
what should be done for that?It depends on lots of factors but simply you have to optimised your source code as much as you can and avoid use of multiple files.