I have to do distributed testing using JMeter. The objective is to have multiple remote servers in AWS controlled by one local server send a file download request to another server in AWS.


How can I set up the different servers in AWS?
How can I connect to them remotely?


Can someone provide some step by step instructions on how to do it?
I have tried several things but keep running into connectivity issues across networks.


3 个解决方案



We had a similar task and we ran into a bunch of issues as well. Here are the details of the whole process and what we did to resolve the issues we encountered. Hope it helps.


We needed to send requests from 5 servers located in various regions of the world. So we launched 5 micro instances in AWS, each in a different region. We chose the regions to be as geographically apart as possible.


Remote (server) JMeters config

Here is how we set up each instance.


  1. Installed java:


    $ sudo apt-get update
    $ sudo apt-get install default-jre 
  2. Installed JMeter:


    $ mkdir jmeter
    $ cd jmeter;
    $ wget ftp://apache.mirrors.pair.com//jmeter/binaries/apache-jmeter-2.9.tgz
    $ gunzip apache-jmeter-2.9.tgz;tar xvf apache-jmeter-2.9.tar
  3. Edited the jmeter.properties file in the /bin folder of the JMeter installation and uncomment the line containing the server.rmi.localport setting. We changed the port to 50000.

    编辑JMeter安装的/ bin文件夹中的jmeter.properties文件,并取消注释包含server.rmi.localport设置的行。我们将端口更改为50000。

  4. Started JMeter server. Make sure the address and the port the server reports listening to are correct.


    $ cd ~/jmeter/apache-jmeter-2.9/bin
    $ vi jmeter-server

Local (client) JMeter config

Then we set up JMeter to run tests remotely on these instances on our local client machine:


  • Ensured to use the same version of JMeter as was running on the servers. Installed Java and JMeter as described above.
  • 确保使用与在服务器上运行的相同版本的JMeter。如上所述安装Java和JMeter。
  • Enabled remote testing by editing the jmeter.properties file that can be found in the bin folder of the JMeter installation. The parameter remote_hosts needed to be set with the public DNS of the remote servers we were connecting to.
  • 通过编辑可在JMeter安装的bin文件夹中找到的jmeter.properties文件启用远程测试。需要使用我们连接的远程服务器的公共DNS设置参数remote_hosts。
  • remote_hosts=54.x.x.x,54.x.x.x,54.x.x.x,54.x.x.x,54.x.x.x
  • remote_hosts = 54.x.x.x,54.x.x.x,54.x.x.x,54.x.x.x,54.x.x.x

We were now able to tell our client JMeter instance to run tests on any or all of our specified remote servers.


Issues and resolutions

Here are the issues we encountered and how we resolved them:


  1. The client failed with:


    ERROR - jmeter.engine.ClientJMeterEngine: java.rmi.ConnectException: Connection - refused to host:

    错误 - jmeter.engine.ClientJMeterEngine:java.rmi.ConnectException:Connection - 拒绝主机:

    It was due to the server host returning the private IP address as its address because of Amazon NAT. We fixed this by setting the parameter RMI_HOST_DEF that the /usr/local/jmeter/bin/jmeter-server script includes in starting the server:

    这是由于服务器主机因为Amazon NAT而将私有IP地址作为其地址返回。我们通过设置/ usr / local / jmeter / bin / jmeter-server脚本在启动服务器时包含的参数RMI_HOST_DEF来修复此问题:


    Now, the AWS instance returned the server’s external IP, and we could start the test.


  2. When the server node attempted to return the result and tried to connect to the client, the server tried to connect to the external IP address of my local machine. But it threw a connection refused error:


    2013/05/16 12:23:37 ERROR - jmeter.samplers.RemoteListenerWrapper: testStarted(host) java.rmi.ConnectException: Connection refused to host: xxx.xxx.xxx.xx;

    2013/05/16 12:23:37错误 - jmeter.samplers.RemoteListenerWrapper:testStarted(host)java.rmi.ConnectException:连接拒绝主机:xxx.xxx.xxx.xx;

    We resolved this issue by setting up reverse tunnels at the client side.


    • First, we edited the jmeter.properties file in the /bin folder of the JMeter installation and uncommented the line containing the client.rmi.localport setting. We changed the port to 60000:

      首先,我们在JMeter安装的/ bin文件夹中编辑了jmeter.properties文件,并取消注释了包含client.rmi.localport设置的行。我们将端口更改为60000:

    • Then we connected to each of the servers using SSH, and setup a reverse tunnel to port 60000 on the client.


      $ ssh -i ~/.ssh/54-x-x-x.us-east.pem -R 60000:localhost:60000 [email protected]

    We kept each of these sessions open, as the JMeter server needs to be able to deliver the test results to the client.


    • Then we set up the JVM_ARGS environment variable on the client, in the jmeter.sh file in the /bin folder:

      然后我们在客户端上的/ bin文件夹中的jmeter.sh文件中设置JVM_ARGS环境变量:

      export JVM_ARGS="-Djava.rmi.server.hostname=localhost"

    By doing this, JMeter will tell the servers to connect to localhost:60000 for delivering their results. This ends up being tunneled back to the client.


  3. The SSH connections to the servers kept dropping after staying idle for a little bit. To prevent that from happening, we added a parameter to each of the SSH tunnel set up directing the client to wait 60 seconds before sending a null packet to the server to keep the connection alive:


    $ ssh -i ~/.ssh/54-x-x-x.us-east.pem -o ServerAliveInterval=60 -R 60000:localhost:60000 [email protected]

(.ssh/config version of all required SSH settings:

(.ssh / config所有必需的SSH设置版本:

 Host 54.x.x.x
   HostName 54.x.x.x
   Port 22
   User ubuntu
   ServerAliveInterval 60
   IdentityFile  ~/.ssh/54-x-x-x.us-east.pem
   IdentitiesOnly yes

Just use ssh 54.x.x.x after setting this up. )

设置完成后,只需使用ssh 54.x.x.x. )



I just went though this on openstack and found the same issues... no idea why the jmeter remoting documentation only covers half the required steps. You can do it without tunnels or touching the properties files.


You need


  • All nodes to advertise their public IP - on AWS/OS this defaults to the private IP
  • 所有节点都要宣传他们的公共IP - 在AWS / OS上,这默认为私有IP
  • Ingress rules for the RMI port which defaults to 1099 - I use this
  • RMI端口的入口规则默认为1099 - 我使用它
  • Ingress rules for the RMI "local" port which defaults to dynamic. Below I use 4001 for the client and 4000 for servers. The port can be the same but note the properties are different.
  • RMI“本地”端口的入口规则默认为动态。下面我使用4001作为客户端,使用4000作为服务器。端口可以​​是相同的但注意属性是不同的。

If you are using your workstation as the client you probably still need tunnels. Above Archana Aggarwal has good tips for tunnels.

如果您使用工作站作为客户端,您可能仍需要隧道。 Archana Aggarwal上面有隧道的好建议。

Remote servers

Set java.rmi.server.hostname and server.rmi.localport inline or in the properties file.


jmeter-server -Djava.rmi.server.hostname=publicip -Dserver.rmi.localport=4000

Sneaky server on client

You can also run one on the same machine as the client. For clarity I've set java.rmi.server.hostname but left server.rmi.localport as dynamic


jmeter-server -Djava.rmi.server.hostname=localip


Set java.rmi.server.hostname and client.rmi.localport inline or in the properties file. Use -R etc like so:


jmeter -n -t Test.jmx -Rremotepublicip1,remotepublicip2 -Djava.rmi.server.hostname=clientpublicip -Dclient.rmi.localport=4001 -GmypropA=1 -GmypropB=2 -lresults.jtl



When you go for distributed testing using JMeter in AWS, I would suggest you to use docker - which will help us with jmeter test infrastructure very quickly. This way we can also ensure that same version of java and jmeter are installed in all the instances of amazon which is very important of JMeter distributed testing.

当您在AWS中使用JMeter进行分布式测试时,我建议您使用docker - 这将非常快速地帮助我们使用jmeter测试基础架构。这样我们还可以确保在所有亚马逊实例中安装相同版本的java和jmeter,这对JMeter分布式测试非常重要。

Ensure that - you set below properties and ports are open for jmeter-server. [they do not have to be 1099,50000 exactly]

确保 - 您为jmeter-server打开了以下属性和端口。 [他们不必完全是1099,50000]


for client



java.rmi.server.hostname=SERVER_IP - this step is very important as the container in aws instance will have their own IP address in the docker network - so master and slave can not communicate. So we explicitly set this property

java.rmi.server.hostname = SERVER_IP - 这一步非常重要,因为aws实例中的容器在docker网络中将拥有自己的IP地址 - 因此master和slave无法通信。所以我们明确设置了这个属性

More info: