JMeter – Why Non GUI mode is preferable for Load/Performance Testing? How to run JMeter in Non GUI mode?

Why JMeter:

Hope everyone knows  JMeter is the open source tool.

JMeter is an software that can be used to execute performance testing, load testing and functional testing of your web applications. JMeter can also simulate a heavy load on a server by creating tons of virtual concurrent users to web server.

JMeter which used to test the static and dynamic resources.

Why load and performance for the application? 

Please refer the below link which I shared the information earlier

https://helpyoutotest.wordpress.com/2017/10/31/load-testing/

When to use JMeter GUI Mode?

We have to use the GUI mode while creating a basic test plan and we should use it only for debugging purpose. GUI perfectly used for adding and editing the configuration elements, thread groups, and samplers as a result of which you can view a number of different listeners helping for debugging.

However, the GUI mode does have a limitation which slows down the CPU utilization while running the recorded script. If we are running multiple listeners in a script, it affects the JMeter performance. To overcome such a situation, the script should be run in the non-GUI mode. There is a benefit to drive more requests per second out of JMeter in non-GUI mode.

Why to use JMeter in Non GUI/command line mode:

  • Increasing threads (after certain limit) due to which JMeter crashes in the GUI mode.
  • For heavy test scenarios (ex: shopping application: login-view product-add to cart-view bill-remove product-pay bill) JMeter consumes memory and CPU and it may affect your test results.
  • To increase JMeter capabilities, i.e. to get more requests per second.
  • Make sure that your sample listeners are in disable mode
  • Avoid the ‘View Result Tree’ and ‘View Tree Table’ will consume more memory.
  • Use the most performing scripting language (see JSR223 section)

Why not to use GUI mode for extensive load testing?

  • The individual system can handle up to 300 to 500 threads as per your System configuration and it will differ If you are using less memory.
  • The JMeter app will crash or hang when you are running the script with many users.
  • When ever we are using more listeners and View result tree and it will consume a lot of CPU and Memory, it will make the JMeter application to freeze for a while so your load testing will not be more accurate.

If you want do extensive load testing with more number of users, then we have to do distributed load testing to send the request to the server through multiple systems. The GUI mode is recommended when you want to run your plan with 50 to 100 users.

We will see how to do distributed load testing in another blog.

Running JMeter in command line mode:

Running JMeter using command line in non-GUI mode is very simple.

  1. Open command prompt
  2. Go into JMeter’s bin folder
  3. Enter following command to run your test plan,  (Syntax: jmeter -n –t <Yourfilename.jmx> -l <Yourfilename.jtl>)

Example: jmeter -n -t <Yourfilename.jmx> -l <Yourfilename.jtl> -H my.proxy.server -P 8000

-n This specifies JMeter is to run in non-gui mode-t[name of JMX file that contains the Test Plan].

-l [name of JTL file to log sample results to].

-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

-g [path to CSV file] generate report dashboard only-egenerate report dashboard after load test-ooutput folder where to generate the report dashboard after load test. Folder must not exist or be empty

The script also lets you specify the optional firewall/proxy server information:

-H[proxy server hostname or ip address]-P[proxy server port]

Please see the sample script which was executed in Command prompt

 

Leave a comment