JMeter via proxy server

I’m using JMeter for performance test.

In this article, I introduce how to use JMeter via proxy server. This method can be used if your  application can’t be accessed without proxy server. And,I think we can not access to internet without proxy server in many company.

FYI, Internet option settings is not applied to JMeter.

【Method 1】Start JMeter with JVM parameters

When execute “jmeter.bat” to start JMeter, add some JVM parameters to the command.

“-H” means proxy server hostname or IP address, and “-P” means port number.

This is the example. In the case of locate JMeter directly under C drive.

C:\apache-jemeter-2.9\bin>jmeter.bat -H <hostname or IP address> -P <port number>

FYI, there are other JVM parameters.

-H [proxy server hostname or ip address]
-P [proxy server port]
-N [nonproxy hosts] (e.g. *.apache.org|localhost)
-u [username for proxy authentication – if required]
-a [password for proxy authentication – if required]
Example : jmeter -H my.proxy.server -P 8000 -u username -a password -Nlocalhostt

【Method 2】Add JVM parameters to “jmeter.bat” directly

In “jemeter.bat”, the following command is written as default.

%JM_START% %JM_LAUNCH% %ARGS% %JVM_ARGS% -jar "%JMETER_BIN%ApacheJMeter.jar" %JMETER_CMD_LINE_ARGS%

Before edit “jemeter.bat”, make backup just in case.

Then, add hostname and port number to JVM parameters, as follows.

%JM_START% %JM_LAUNCH% %ARGS% %JVM_ARGS% -jar "%JMETER_BIN%ApacheJMeter.jar" %JMETER_CMD_LINE_ARGS% -H <proxy server hostname or IP address> -P <port number>