Quick Guide to Load Testing Web Services using Apache JMeter
Apache JMeter is one of the most popular open source load testing tools for web services and web applications. Web services are an essential feature of modern web applications. As discussed in one of my previous blogs, they are basically a software-to-software interface which enables different software components to communicate with each other and also act as an interface for third party tools. As they are exposed to third party tools, it is very critical to perform load testing on them along with standard functional testing.
We have a variety of open source and commercial tools available in market which can be used to perform load testing. Some of the popular tools include…
o HTTP Load
o Apache JMeter
o Web Load
o HP Load Runner
There are many other tools as well but in this blog I will focus only on Apache JMeter, since it is one of the best and most popular load testing tool’s available.
To test a Web Service through JMeter, you will have to first set it up in your testing environment. If your testing machine alone is capable to generate the defined load then setting up JMeter is quite simple but if you need to generate a load of thousands of users which your testing machine is not capable to generate then you will have to look into concepts of distributed load testing. Apache JMeter official site has detailed guides for setting up both simple and distributed testing environment.
Once the environment is setup we need to perform these 3 activities to get ready for load testing…
1- Add Thread Group (virtual users)
2- Add Sampler (web service)
3- Add Listener (reports)
A thread group can be added under Test Plan. In a thread group, we can configure following…
o Number of threads value tells JMeter the number of threads that need to be created for test execution
o Ramp Up period value tells JMeter how long to ramp up to the full number of threads. For example, if number of threads is 10 and ramp up period is 100 seconds then JMeter will take 100 seconds to create those 10 threads. Each thread will initiate 10 (100/10) seconds after the previous thread began
o Loop count tells the number of times to execute test
o Under scheduler we can set start time, end time and duration of test
Samplers tell JMeter to send requests to a server and wait for a response. For Web Services we can use following samplers (Note that they might vary depending on JMeter version) …
o SOAP/XML-RPC Request
o WebService (SOAP) Request
o HTTP Request
Each sampler has several properties that should be set properly. Basic validations can also be performed on response by adding assertions to sampler. These assertions help us validate that the response received was valid or not.
Last but not least we have to add Listeners, which are the components that show the results from samplers. These results could be in form of tables, trees, log files or graphs. JMeter has some built in listeners but for better and graphical results it is best to use additional listeners that come with JMeter Plugins.
We’d like to wrap this up by saying that JMeter is a very powerful tool which has endless options and features that can help you get better load test results.
We encourage you to dive into the world of JMeter to explore the magic it offers, let us know your thoughts in the comments below.
We hope you enjoyed reading our insights , please feel free to explore how our services can help you make an impact by delivering a perfect final product that is free of flaws and errors.