Social Icons

Pages

Tuesday 23 September 2014

How to run Apache Jmeter from Command Line (non-gui mode)

Apache JMeter is mostly used when we need some number of threads to perform certain operations on different servers like LDAP, HTTP etc.
After creating test plan to be executed for the required server, we can click run button in jmeter GUI to run this test plan.
But mostly we will need to execute jmeter in non-gui mode because of following two reasons:

  1. To automate execution of jmeter.
  2. To perform more number of operations per second: In non-gui mode, jmeter threads do not need to print data on jmeter gui.

Command to execute Jmeter in non-gui mode:

Example :
jmeter -n -t test_plan.jmx -l test_log.jtl -r run.log -r  -H my.proxy.server -P 8000
Where:
-n: This specifies JMeter is to run in non-gui mode(mandatory)
-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
The script also lets you specify the optional firewall/proxy server information:
-H [proxy server hostname or ip address]
-P [proxy server port]

Stop Jmeter when executed from command line:

When you have executed jmeter from command line, then their is no gui button to stop test when required. when jmeter is executed from command line, jmeter process listens on port 4445 where we can send stoptest os shutdown request to jmeter.
Example: stoptest.cmd for windows and stoptest.sh for Linux

Stop Jmeter when executed from command line and multiple jmeter instances are running:

Example: stoptest.cmd <port> for Windows and stoptest.sh <port> for Linux
port can be seen on command execution screen where jmeter instance is running.
 Source: http:/jmeter.apache.org/

1 comment:

  1. I am having issues using the stoptest command to stop a test when loop forever is checked in the jmeter script. The stoptestNow received from /127.0.0.1 is displayed but script keep running. any idea why this happening?

    ReplyDelete

Please Comment for Any question or suggestions