This tutorial performance test the RESTFul web service we created ealier as part of the “RESTful Web Service Tutorial with Apache CXF, Maven, and Eclipse” with JMeter. JMeter is an opensource performance testing tool.
Step 1: Download latest release version of Apache JMeter from “http://jmeter.apache.org/download_jmeter.cgi“, and unzip it into c:\tools folder or folder of your choice. Double click on jmeter.bat under the bin folder. For e.g. C:\TOOLS\apache-jmeter-2.11\bin\jmeter.bat
Step 2: Make sure that the RESTful web service is deployed to Tomcat and running as per the instructions on the tutorial “”RESTful Web Service Tutorial with Apache CXF, Maven, and Eclipse”.” The simpleWeb war file needs to be deployed and the Tomcat server needs to be started. The RESTful URL to be performance tested is shown below.
Step 3: Open JMeter by double clicking on C:\TOOLS\apache-jmeter-2.11\bin\jmeter.bat. Right mouse click to bring up the contextual menu. Set up the number of concurrent threads to run.
Step 4: Set up the thread group to concurrently fire load on the RESTful webservice. Let’s use 10 threads here.
Step 5: Set up the default HTTP request settings for all the “HTTP Request” sampler(s). This can be overridden at the “HTTP Request” sampler level.
Step 6: Create the “HTTP Request” sampler.
Step 7: This will pick up the host and port details from the “HTTP Default” config. Just only provide the URI path “simpleWeb/rest/simple/Arul“.
Step 8: The results of the run needs to be captured. This is done via the listeners to provide different reports.
Step 9: We will use a listener to view the results in a table.
Step 10: You can save the job as a “.jmx” file, and then run the “ThreadGroup” with Run —> start from the main menu, or clicking on the play icon highlighted below.
You can try running with more load by increasing the number of threads in the thread group, also add more listeners to try different types of reports. You can also try opening the JMX file from a notepad.
I will cover more industrial strength snippets for advanced JMeter jobs.