Optimizing Software Development
RSS icon Email icon Home icon
  • JMeter Script with Proxy Support

    Posted on October 3rd, 2005 levent.gurses 1 comment

    JMeter comes with several launch scripts:

    • jmeter.bat - GUI execution with proxy support:
      -H [proxy server hostname or ip address]
      -P [proxy server port]
      -u [username for proxy authentication - if required]
      -a [password for proxy authentication - if required]
    • jmeter-n.bat - background mode with no proxy support
    • jmeterw.bat - GUI mode using javaw with proxy support

    For some reason proxy is NOT supported in the unattended script, jmeter-n.bat . An easy way to add proxy support to jmeter-n.bat is to change the launch statement in the following way:

    rem See the unix startup file for the rationale of the following parameters,
    rem including some tuning recommendations
    set HEAP=-Xms256m -Xmx256m
    set NEW=-XX:NewSize=128m -XX:MaxNewSize=128m
    set SURVIVOR=-XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=50%
    set TENURING=-XX:MaxTenuringThreshold=2
    set EVACUATION=-XX:MaxLiveObjectEvacuationRatio=20%
    set RMIGC=-Dsun.rmi.dgc.client.gcInterval=600000 -Dsun.rmi.dgc.server.gcInterval=600000
    set PERM=-XX:PermSize=64m -XX:MaxPermSize=64m
    set DEBUG=-verbose:gc -XX:+PrintTenuringDistribution
    set PROXY=-H my.proxy.server -P my.proxy.port
    set ARGS=%HEAP% %NEW% %SURVIVOR% %TENURING% %EVACUATION% %RMIGC% %PERM% %DEBUG%
     
    java %JVM_ARGS% %ARGS% -jar ApacheJMeter.jar %PROXY% %JMETER_CMD_LINE_ARGS%

    Notice that various launch options such as memory, garbage collection and debug mode can also be changed from this file.