Performance testing is done to ensure whether the application is capable enough to bear the load. It can analyse the system’s performance under high load. Jmeter performance testing offers various benefits like it can be used to test the performance of both static and dynamic resources.
There are two kinds of web application testing done using Jmeter.
1. Load Application Testing: The process is mainly used to predict the expected usage by simulating various conditions.
2. Stress Application Testing: Be it any web application the architecture of it can only support a certain number of users at a time. With the help of stress testing load above this capacity will be given on the server after which it behaves weirdly. By doing so, maximum load the web server can handle can be found out.
This can be understood in a much better way by below diagram:
How to create a Performance test in Jmeter
Let’s test the Google website for 1000 users with the help of Jmeter.
First, start the JMeter application and click on test plan option on the dashboard. Click on add option and then Thread(Users). Afterwards, click on Thread Group.
The Flow would be:
Add -> Threads (Users) -> Thread Group
Number of Threads: Number of users which you want to target to the target website. For example, here we will use 100
Loop Count: 10 (Number of times to execute testing)
Ramp-Up Period: 100 (It is the delay which Jmeter has to wait before starting the next user). 100 seconds is the time which we have used.
Now, you must be confused between thread count and loop count. It is very easy to understand.
Thread count means how many concurrent users Jmeter will create to connect to the web server.
Loop count would be the number of times, Jmeter would simulate one user connecting to the target server.
Suppose in the above example: Jmeter would create 100 concurrent users connecting to the server while one user would be connecting to the server 10 number of times.
There are various JMeter elements which can be used to the test case. Let’s see what they are:
1. HTTP request default
Now, you have created a thread group and you can attach HTTP request element to it by following the below path:
Add -> Config Element -> HTTP Request Defaults.
In the HTTP request control panel, enter the website name which you have to define. In our example, it would be “www.google.com”.
2. HTTP request
You can add this element to the thread group by following below path:
Add -> Sampler -> HTTP Request.
Now, in the control panel of the HTTP request, you have to enter the URL request you want to send to Google. If you give the command as “calendar” in path field, Jmeter will send request http://www.google.com/calendar to google server. If you will keep it blank then send request http://www.google.com/ to google server.
Jmeter can show the results in graph format. You have to right click on the test plan and then follow the below path:
Add -> Listener -> Graph Results
In this way, you will be able to see the results in graph format.
You can see the test button on the toolbar to start the testing process. You would be able to see the test result in real time. When you will simulate 100 users which will access Google server then you will get the real-time output.
But all output lines would not be in the same colour. Some would be in black, blue, red and green colours. Black colour means the total number of current samples sent. Blue colour represents the current average of all samples sent. Red colour represents the current standard deviation. Green colour represents throughout rate that represents the number of request per minute the server handled.
How to analyse the graph results in Jmeter
There are two main parameters which you should focus while looking at the result graphs. Throughput and deviation are those which are very important while looking at any JMeter output graph.
Throughput is the ability of the application to handle a heavy load. Throughput should be very high ideally. Deviation indicated deviation from average. It should be very low.
In the above graph, throughput is 867/minutes. It means this server can handle 867 requests per minute. This data is of yahoo website. While if you will test Google.com then you see throughput is 1000/ minute. Google has higher throughput than yahoo.
These parameters can vary on other factors also. Which include internet speed at JMeter site, current server load at google server, your CPU power and many others. It’s not necessary that you will get the same results every time as they can vary because of other factors.
So start the web application testing using Jmeter and see how much load one website can handle. In this way, you can see why your site stops responding and one of the reasons can be low load-bearing capacity.
If you had some difficulty while doing the above test then try to not connect to the internet via a proxy. If you are connecting through a proxy then don’t connect via that. Try opening a new JMeter instance and then try to run the test.
By following these you would be able to run the test cases with Jmeter. So, keep doing performance testing with JMeter and make your site less prone to vulnerable attacks. All the best!!