I was exploring different load testing tools in order to make sure that the Ethics Canvas platform would resist peaks of up to 100 users signing in every 10 seconds, when I came across Apache JMeter.
JMeter is a robust Java-based open-source tool that allows users to test performance both on webservices, web dynamic languages, Java Objects, databases and queries, FTP servers, etc.
Running JMeter (Linux):
- Download Apache JMeter
- Extract the content from the compressed file
- From the Terminal, navigate into the apache-jmeter/bin
- Type ./jmeter and it will open the Java app (make sure you have Java installed)
Running load tests on Ethics Canvas:
- Right-click on Test Plan -> Add -> Threads -> Thread Group
- On Number of Threads we enter the desired number of users: 100
- On Ramp-Up Period we enter the desired test duration: 10
- Right-click on Thread Group -> Add -> Sampler -> HTTP Request
- On Server Name we type ethicscanvas.org
- On Path we type our sign-in file: /php/log-in.php
- On Send Parameter we add the email and the password
- Right-click on Thread Group -> Add -> Listener -> View Results in Table
- Click PLAY and the test will start, populating the table with the results
Understanding the results:
The most important factors are the average sample time (response time), deviation (from the average response time) and the status of all the responses (no errors). In our case, with an average of 2.2289 seconds from a mobile data connection, we can say we have passed the test.
It is worth looking for unusual values in latency and connect times. Always start with light-weight tests, and gradually increase the number of threads and reduce ramp-up period to know your limits. You might want to try as well from different Internet connections (mobile, wifi, remote,...) and never from localhost (unless it's only used internally).