Step by step load test with JMeter-part 1

Environment Setup

You must have to install JDK 1.8 or upper. Then set up JAVA_HOME. You can see the tutorial here if you do not know how to set up JAVA_HOME.

Download JMeter zip or tgz (depends on you os) from here

Let you have downloaded JMeter zip. Extract it and keep this in a safe place.

Now open the folder, go to bin and then double click to open ApacheJMeter.jar file

JMeter has been opened.

Create Thread Group

Right click on Test Plan. Go to Add > Threads (Users) > Thread Group

Add HTTP Request

Now right click on Thread Group and go to Add > Sampler > HTTP Request

You can also edit “HTTP Request” name if you need.

Calling GET API

Set configuration like this:

protocol[http]: https
Method: GET
Server Name or IP:
Port Number: 443
Path: /BookStore/v1/Books

Here’s mentioned that, if the protocol is https, then port number will be 443 and If the protocol is http, then port number will be 80.

View Results Tree and Summary Report

Right click on Thread Group and go to Add > Listener > View Results Tree

Again right-click on Thread Group and go to Add > Listener > Summary Report

Now save the project. Go to File > Save or ctrl+s

Save the file name as load-test-demo.jmx

Your file will be saved by default in bin folder. If you want, you can save it to another directory.

Now your project will look like this image:

Now click on play button. The green play button of above image.

Now click on “View Results Tree” and you will see the API is called successfully with green tick mark.

Now navigate to Response data tab and you will see the response after calling the API

Click on clear icon to clear all the results.

Load test strategy:

Now click on Thread group and set the number of threads 100

Click the play button again

Then after finishing API calling, click on “View Results Tree”

You will see 100 requests has been executed

View Summary Report

Now click on “Summary Report”

You will see that test result is showing:

Samples: Number of requests
Average: Average of response time
Min: Minimum response time
Max: Maximum response time
Std Dev: Standard deviation for response time
Error: Error count in percentage
Throughput: Throughput is measured as the number of requests sent to the web server per second
Received KB/sec: Download response for total request per second
Sent KB/s: Upload total request per second
Avg. Bytes: Average of streaming for total requests

From the above result, we see that no error found for 100 TPS(Transaction Per Second)

Now we will increase our load. We will send 1000 requests in 10 second.

So, set Thread 1000 and ramp up period time 10 in Thread Group. Clear the previous result.

Start the test

Check the summary report

Still we see no error

Here is a question that why we have increased our ramp-up time. The answer is, It’s not fair to give 1000 loads in 1 second if we think for real life. Very few companies have a TPS 1000. But 100 TPS can be a common scenario. So we have increased our thread from 100 to 1000 but also increased our ramp-up time period from 1 sec to 10 sec so that the TPS will remain 1000/10=100

Now we will increase out TPS from 100 to 200

So, increase the Thread from 1000 to 2000 but remain the ramp-up period same. Clear the previous result. Let’s see what happened.

Still, we observed that no error occurred but one thing, check the previous Summary Reports. Min time and Max time have increased.

Now, increase the Thread from 2000 to 5000 by remaining the same ramp-up time.

Clear the previous result. Start the test. Let’s see what happened.

Now we see that, already error gets 81% still not completed the test. So now we will stop our test.

Clear the previous result. Set the thread from 5000 to 3000 remaining the same ramp up time.

Now clear the previous result and start the test.

From the above result, we see that already 19% has been failed and Max time is very high!

So we again reduce our Thread from 3000 to 2500 remaining the same ramp-up time.

Stop the test, clear the previous result and start the test again

Now we see that error rate is 28%

Why increased error rate? Because, multiple times we are trying for load testing and this is reducing server performance.

Now we will set Thread from 2500 to 2000 and observe the result.

Clear the previous result and start the test.

Now we see that error has been reduced to 5%. but, previously when we checked for 2000 load, we had no error. But now we have 5% error.

Why? Reason is For the first time server can serve 2000 load easily, but after several test executions, it can serve load with 5% of errors.

Now we will reduce load from 2000 to 1500 and clear and start the test.

We see that, no error found!

Finally, we will set the thread from 1500 to 1600 and clear and start the test

Now, we observed that, 1% error has been occurred.

So we can ended our load testing with a decision that, this server can perform load in 1500/100=150 TPS

about author


If you like my post or If you have any queries, do not hesitate to leave a comment.

Leave a Reply

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