Apache JMeter: Java application to measure website performance
JMeter allows you to run load tests on websites to measure their performance. Because it’s based on Java, you can use it on any operating system with the Java Runtime Engine installed.
Table of Contents
Installation
Go to https://jmeter.apache.org/download_jmeter.cgi and download the compressed binary. After that, uncompress the archive and run bin/jmeter
.
Apache JMeter is also available as a Flatpak package. In the next section, I am going to create an HTTP Request test that sends requests to my website.
Running an HTTP Request test
After started the application, you need to create a Test Plan. Add a name and an optional comment.
Then, do a right-click on the Plan name in the left panel and select Add -> Threads (Users) -> Thread Group
. A Thread Group is where you specify thread options (number of threads (users), ramp-up period, loop count, etc.).
After that, you can add the tests directly, or add a “defaults” to specify request options that are common to the tests, like the target hostname. Right-click on the Thread Group name in the left panel and select Add -> Config Element -> HTTP Request Defaults
. Add the protocol (http or https), the server name or IP and the port (80, 443, etc.).
Right-click again on the Thread Group and go to Add -> Sampler -> HTTP Request
, select an HTTP method and add an URL path (relative to the server name you added earlier, e.g.: /
).
Before running the test, you need to add some method to view the results. Right-click on the HTTP Request
entry, and select one of the results views inside Add -> Listener
. For example, you can add View Results Tree
.
Finally, run the test by clicking on the green “play” icon in the toolbar. You can stop the test at any time by pressing the Stop icon next to the Start one. Click on the yellow “warning” icon on the right to view the logs. Select the View Results Tree
to display the test results.
Add timers
If you want to delay the execution of the tests (run every X seconds), add a “Constant Timer” (Right-click on the Thread group, Add -> Timer -> Constant Timer
) and specify the delay in milliseconds.
Documentation
This is just a basic usage example. To get more info about Apache JMeter, go to their official website: https://jmeter.apache.org/.
If you have any suggestion, feel free to contact me via social media or email.
Latest tutorials and articles:
Featured content: