Key takeaways
- Non-GUI mode is the only sensible way to run a real load test.
- Pass the test plan and the results file on the command line and let it run headless.
- The GUI is for building and debugging plans, not for generating load.
If you want to start Apache JMeter in non-GUI mode, use the following command line options:
Is Your Infrastructure Ready for Global Traffic Spikes?
Unexpected load surges can disrupt your services. With LoadFocus’s cutting-edge Load Testing solutions, simulate real-world traffic from multiple global locations in a single test. Our advanced engine dynamically upscales and downscales virtual users in real time, delivering comprehensive reports that empower you to identify and resolve performance bottlenecks before they affect your users.
- -n – non-GUI mode – this specifies JMeter is to run in non-GUI mode
- -t – JMX file – location of the test plan and the name of JMX file that contains the Test Plan
- -l – log file name of JTL file to log sample results to
Example
jmeter -n -t my_test_plan.jmx -l log.jtl
Optional
- -j – name of JMeter run log file
- -r – Run the test in the servers specified by the JMeter property “remote_hosts”
- -R – list of remote servers Run the test in the specified remote servers
- -H – proxy server hostname or ip address
- -P – proxy server port
Example
jmeter -n -t my_test_plan.jmx -l log.jtl -H my.proxy.server -P 8000
Tips for running JMeter in non-GUI mode:
- here are details on how to add jmeter to the PATH variable of your environment
- remove any listeners that are GUI mode specific (you can do this by opening your JMX file in GUI mode and remove the GUI specific listeners)
- get summary results in the terminal by activating the summary option in the jmeter.properties file
Additional scripts that come with Apache JMeter installation can be found in the /bin folder where you’ve downloaded JMeter.
For Windows systems:
- jmeter-n.cmd – drop a JMX file on this to run a non-GUI test
- jmeter-n-r.cmd – drop a JMX file on this to run a non-GUI test remotely
- mirror-server.cmd – runs the JMeter Mirror Server in non-GUI mode
- shutdown.cmd – Run the Shutdown client to stop a non-GUI instance gracefully
- stoptest.cmd – Run the Shutdown client to stop a non-GUI instance abruptly
For Unix/Linux systems:
- mirror-server.sh – runs the JMeter Mirror Server in non-GUI mode
- shutdown.sh – Run the Shutdown client to stop a non-GUI instance gracefully
- stoptest.sh – Run the Shutdown client to stop a non-GUI instance abruptly
The commands will only be accepted if the scripts are run from the same host. Details on how to start JMeter on Mac system can be found here. Also, here is how to load test a website with Apache JMeter.
Frequently Asked Questions
What are the command line options?
-n for non-GUI mode, -t for the JMX test plan and -l for the results file. Those three cover a standard headless run.
Think your website can handle a traffic spike?
Fair enough, but why leave it to chance? Uncover your website’s true limits with LoadFocus’s cloud-based Load Testing for Web Apps, Websites, and APIs. Avoid the risk of costly downtimes and missed opportunities—find out before your users do!
Why does non-GUI matter?
Because the interface consumes the CPU and memory you wanted for generating load. Running headless is the difference between measuring the server and measuring your own machine.
So what is the GUI for?
Building and debugging the plan. Use it to get the scenario right, then run the finished plan headless.
Related reading
- How to Increase Heap Size in JMeter?
- Should You Use the JMeter GUI to Run Load Tests?
- How To Use Apache JMeter To Load Test a Web Server
Run this JMX in the cloud, from 25+ regions
LoadFocus is an all-in-one Cloud Testing Platform for Websites and APIs for Load Testing, Apache JMeter Load Testing, Page Speed Monitoring and API Monitoring!
Upload your JMeter script to LoadFocus and run it with thousands of virtual users from 25+ cloud locations, with no load generators to manage. Results show p95/p99 response times, throughput and errors per request, and a free tier is included.