What is JMeter?
Apache JMeter is a free, open-source Java load testing tool. See how test plans work, the CLI flags to run them, and common mistakes.
What is Apache JMeter?
Apache JMeter is a free, open-source load testing tool written in Java. You build a test plan, usually in its desktop GUI, save it as a .jmx file and run it to simulate many users hitting a web app, an API, a database or another server, while it records response times, throughput and errors.
It was first built for web applications and now covers more. Its user manual lists web (HTTP/HTTPS), FTP, JDBC, LDAP, Java, JUnit and JMS tests (JDBC needs your database's driver, JMS needs a client jar from your provider).
How a JMeter test is built
- Test Plan: the container for everything, saved as the
.jmxfile. - Thread Group: each thread is one virtual user. You set the number of threads, the ramp-up time and how long or how often they loop. See the JMeter ramp-up period guide.
- Samplers: the requests themselves: HTTP Request, JDBC Request, JMS Publisher and so on.
- Config elements and timers: shared defaults, CSV Data Set Config for test data, and think-time timers that pause between requests.
- Assertions: checks on each response, such as a status code or text in the body.
- Listeners: collect and show results. Useful while debugging, but keep the heavy ones off during a real load run.
Example: a checkout test
Say you want to know whether login and checkout hold up under 200 users. In a Thread Group you set 200 threads with a 120-second ramp-up, add an HTTP Request for login and one for checkout, feed usernames from a CSV file, and add an assertion that each response is a 200. You debug it in the GUI with one or two users, then run it from the command line:
jmeter -n -t checkout.jmx -l results.jtl -e -o report-n runs without the GUI, -t names the test plan, -l the results file, and -e -o generate the HTML report into a folder that must not exist yet or be empty. JMeter's documentation says GUI mode is for creating and debugging the script and that load tests should run in non-GUI mode. The current release is 5.6.3 and it needs Java 8 or later (jmeter.apache.org).
Common mistakes
- Running the load from the GUI. The GUI is not meant for it. Use the command line, as in the guide to JMeter's non-GUI mode.
- Overloading the load generator. If the machine running JMeter runs out of CPU or heap, you measure your laptop, not your server. Watch it during the run, or spread the load over several machines.
- Hard-coded data and tokens. Replaying one user with one session ID tests your cache. Parameterise users and extract dynamic values such as CSRF tokens.
- No think time. Users that never pause send far more requests than real ones.
- Reading only the average. Look at percentiles; the latency entry explains why.
- Skipping the one-user dry run. A broken script produces a fast, all-errors "result".
JMeter vs k6
JMeter is GUI-first and stores tests as XML, with wide protocol coverage. k6 is code-first with JavaScript tests that fit naturally in a pull request. The k6 vs JMeter comparison goes through the trade-offs in detail.
How JMeter fits into testing
The same script serves several goals by changing only the Thread Group: a steady load test, a sudden jump for spike testing, or repeated calls to an endpoint for API testing.
Running JMeter scripts with LoadFocus
One machine only generates so much load. LoadFocus JMeter load testing runs your .jmx from 25 cloud regions: you upload the file, set virtual users, duration and ramp-up in the browser, and CSV data files and plugins come along. The Free plan allows up to 10 concurrent users and 60-second tests; larger tests need a paid plan (see pricing).
Before a big run, the free JMeter script validator checks a .jmx for syntax and configuration problems. If you have no script yet, the free converters build one from a cURL command, a HAR file, an OpenAPI spec or a Postman collection.
FAQ: Apache JMeter
Is JMeter free?
Yes. Apache JMeter is open-source software released under the Apache license. You pay only for the machines you run it on, or for a cloud service that runs it for you.
Does JMeter need Java?
Yes. JMeter is a Java application, and release 5.6.3 requires Java 8 or later. The manual recommends a JDK rather than a JRE, because recording HTTPS needs the JDK's keytool.
Is JMeter only for websites?
No. It started with web applications, but it can also test FTP, JDBC databases, LDAP, JMS and Java-based services.
Why shouldn't I run a load test in GUI mode?
The GUI uses resources the test needs and is meant for building and debugging. Run the load in non-GUI mode with -n -t.
Can I run my JMeter script in the cloud without servers?
Yes. Upload the .jmx to LoadFocus, pick regions and load, and it provisions the load generators for the run.
Related terms
Related LoadFocus Tools
Put this concept into practice with LoadFocus, the same platform that powers everything you just read about.