How to run jmeter over ssh tunnel

16 February 2012 (updated 04 March 2015)

There's an old guide to do this here but it's pretty outdated. Connecting to the server over ssh tunnel is the easiest way to do this as you would have to open a bunch of firewall ports on the server AND the client otherwise. I'm assuming you have JRE and Linux on both the server and client. Should work on other OS with some minor adjustments. See bellow for the putty configuration if you have the client on windows. Note that jmeter recommends that the client and server have the same OS and JRE version.

On the server and client, download and extract somewhere jmeter:

wget http://www.apache.org/dist/jmeter/binaries/apache-jmeter-2.6.tgz
tar -xf apache-jmeter-2.6.tgz
cd apache-jmeter-2.6

On the client edit bin/jmeter.properties and add:

remote_hosts=127.0.0.1:55501
client.rmi.localport=55512
mode=Batch
num_sample_threshold=250

On the server edit bin/jmeter.properties and add:

server_port=55501
server.rmi.localhostname=127.0.0.1
server.rmi.localport=55511

Now connect to the server using this:

ssh -L 55501:127.0.0.1:55501 -L 55511:127.0.0.1:55511 -R 55512:127.0.0.1:55512 user@hostname

If you're using putty it should look like this:

Screenshort of Putty port forwarding configuration

Now run:

bin/jmeter-server -Djava.rmi.server.hostname=127.0.0.1

And on the client run:

bin/jmeter.sh -Djava.rmi.server.hostname=127.0.0.1
# or
bin/jmeter.sh -Djava.rmi.server.hostname=127.0.0.1 -t /path/to/test-plan.jmx

Now you can use the remote node!

This entry was tagged as apache jmeter load testing ssh