JMeter, Locust, k6 and Gatling
Four load tools cover most of the work: JMeter, Locust, k6 and Gatling. They send HTTP and a few other protocols from many virtual users and write a report; they differ in what a test is written in, in what the tool needs to run and in who on the team can read the test. None of the other three is installed in this container, so this page compares them and runs none of them; every JMeter number in the course comes from a plan that was really run.
The four in one table
The table says what each tool is, not which one is faster: a throughput number from one machine says more about the machine than about the tool.
| Tool | A test is written in | Runs on | Protocols | What it leaves behind |
|---|---|---|---|---|
| JMeter | an XML plan, built in a GUI or typed | a JVM, one command headless | HTTP, JDBC, JMS, FTP, mail, LDAP, SOAP, raw TCP | a .jtl file and an HTML dashboard |
| Locust | Python: a class with @task methods | Python, one process per worker | HTTP, and whatever a Python client speaks | a web UI and a CSV of the run |
| k6 | JavaScript modules | a single Go binary | HTTP, WebSocket, gRPC | a summary and JSON, CSV or the k6 cloud |
| Gatling | a Scala or Java DSL | a JVM | HTTP, WebSocket, JMS, gRPC | an HTML report |
When JMeter is the right one
- The test must run without a browser and without a display. A .jmx file and one command are all a pipeline needs, which is why this course can run every plan it shows.
- The protocols are not HTTP. JDBC, JMS, FTP, LDAP and raw TCP are samplers in the same plan as an HTTP request, and the same assertions and reports apply.
- Testers who do not write code own the plans. The GUI is a tree of elements and property panels; a plan can be built, saved and handed over, and this course reads and writes the same file.
- The report is a deliverable. -e -o writes a folder of HTML with the percentiles and the error rate per label, and it needs nothing but the .jtl.
When another tool is the better fit
- Locust when the test is Python anyway: a task is a method, the data is a Python object, and the same code runs in a pipeline as in a notebook. If the team lives in Python, Locust reads better than a plan.
- k6 when one binary and a JavaScript file have to run anywhere: a container image, a CI runner, a developer's laptop, with no JVM and no plan GUI.
- Gatling when the test is code the team already writes in Scala or Java, and the HTML report and the DSL are the point.
The honest summary: JMeter is the one with a GUI, the widest protocol list and the oldest plugin ecosystem, and it pays for that with a JVM per run and a plan that is easier to generate than to read. The others are smaller, code-first and younger. A team that already has JMeter plans should keep them; a team that writes Python all day should try Locust before it writes XML.
What this image has
Only JMeter is installed, and the commands below say so rather than pretend otherwise. The command -v of a program that is not there prints nothing, so each line falls back to a sentence.
command -v jmeter || echo "jmeter is not installed"
/opt/jmeter/bin/jmeter
command -v locust || echo "locust is not installed"
locust is not installed
command -v k6 || echo "k6 is not installed"
k6 is not installed
command -v gatling || echo "gatling is not installed"
gatling is not installed
Related
- Performance testing: what a load test is for, and where each tool fits.
- Locust: the Python load tool, with its own pages.
- Install JMeter: the JDK and the version the course runs with.
Article author: Arthur Isaev