Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JMeter with remote servers

I'm trying to setup JMeter in a distributed mode. I have a server running on an ec2 intance, and I want the master to run on my local computer. I had to jump through some hopes to get RMI working correctly on the server but was solved with setting the "java.rmi.server.hostname" to the IP of the ec2 instance.

The next (and hopefully last) problem is the server communicating back to the master.

The problem is that because I am doing this from an internal network, the master is sending its local/internal ip address (192.168.1.XXX) when it should be sending back the IP of my external connection (92.XXX.XXX.XXX).

I can see this in the jmeter-server.log:

ERROR - jmeter.samplers.RemoteListenerWrapper: testStarted(host) java.rmi.ConnectException: Connection refused to host: 192.168.1.50; nested exception is:

That host IP is wrong. It should be the 92.XXX.XXX.XX address. I assume this is because in the master logs I see the following:

2012/07/29 20:45:25 INFO - jmeter.JMeter: IP: 192.168.1.50 Name: XXXXXX.local FullName: 192.168.1.50

And this IP is sent to the server during RMI setup.

So I think I have two options:

  1. Tell the master to send the external IP
  2. Tell the server to connect on the external IP of the master.

But I can't see where to set these commands.

Any help would be useful.

like image 462
winna Avatar asked Jul 29 '12 19:07

winna


People also ask

How do I run a JMeter script on a remote server?

To run JMeter in remote node, start the JMeter server component on all machines you wish to run on by running the JMETER_HOME/bin/jmeter-server (unix) or JMETER_HOME/bin/jmeter-server. bat (windows) script. Note that there can only be one JMeter server on each node unless different RMI ports are used.

Can distributed testing is done by JMeter?

Distributed testing enables having a local JMeter (master) that handles the test execution, together with multiple remote JMeter instances (slaves) that will send the request to our target server. But before being able to run JMeter in a distributed way, there are a couple of simple steps you must perform.

Can we run JMeter on cloud?

If you already have a JMeter test plan, you can upload that along with any supporting data and let Flood run it for you, either on-premise or in the cloud.


2 Answers

For the benefit of future readers, don't take no for an answer. It is possible! Plus you can keep your firewall in place.

In this case, I did everything over port 4000.

How to connect a JMeter client and server for distributed testing with Amazon EC2 instance and local dev machine across different networks.

Setup:

  1. JMeter 2.13 Client: local dev computer (different network)
  2. JMeter 2.13 Server: Amazon EC2 instance

I configured distributed client / server JMeter connectivity as follows:

1. Added a port forwarding rule on my firewall/router:

  • Port: 4000
  • Destination: JMeter client private IP address on the LAN.

2. Configured the "Security Group" settings on the EC2 instance:

  • Type: Allow: Inbound
  • Port: 4000
  • Source: JMeter client public IP address (my dev computer/network public IP)

Update: If you already have SSH connectivity, you could use an SSH tunnel for the connection, that will avoid needing to add the firewall rules.

$ ssh -i ~/.ssh/54-179-XXX-XXX.pem ServerAliveInterval=60 -R 4000:localhost:4000 [email protected]

3. Configured client $JMETER_HOME/bin/jmeter.properties file RMI section:

note only the non-default values that I changed are included here:

#---------------------------------------------------------------------------
# Remote hosts and RMI configuration
#---------------------------------------------------------------------------

# Remote Hosts - comma delimited
# Add EC2 JMeter server public IP address:Port combo
remote_hosts=127.0.0.1,54.179.XXX.XXX:4000

# RMI port to be used by the server (must start rmiregistry with same port)
server_port=4000

# Parameter that controls the RMI port used by the RemoteSampleListenerImpl (The Controler)
# Default value is 0 which means port is randomly assigned
# You may need to open Firewall port on the Controller machine
client.rmi.localport=4000

# To change the default port (1099) used to access the server:
server.rmi.port=4000

# To use a specific port for the JMeter server engine, define
# the following property before starting the server:
server.rmi.localport=4000

4. Configured remote server $JMETER_HOME/bin/jmeter.properties file RMI section as follows:

#---------------------------------------------------------------------------
# Remote hosts and RMI configuration
#---------------------------------------------------------------------------

# RMI port to be used by the server (must start rmiregistry with same port)
server_port=4000

# Parameter that controls the RMI port used by the RemoteSampleListenerImpl (The Controler)
# Default value is 0 which means port is randomly assigned
# You may need to open Firewall port on the Controller machine
client.rmi.localport=4000

# To use a specific port for the JMeter server engine, define
# the following property before starting the server:
server.rmi.localport=4000

5. Started the JMeter server/slave with:

jmeter-server -Djava.rmi.server.hostname=54.179.XXX.XXX

where 54.179.XXX.XXX is the public IP address of the EC2 server

6. Started the JMeter client/master with:

jmeter -Djava.rmi.server.hostname=121.73.XXX.XXX

where 121.73.XXX.XXX is the public IP address of my client computer.

7. Ran a JMeter test suite.

enter image description hereJMeter GUI log output

Success!

like image 122
David Thomas Avatar answered Oct 03 '22 05:10

David Thomas


I had a similar problem: the JMeter server tried to connect to the wrong address for sending the results of the test (it tried to connect to localhost).

I solved this by setting the following parameter when starting the JMeter master:

-Djava.rmi.server.hostname=xx.xx.xx.xx

like image 7
Hugo Avatar answered Oct 03 '22 05:10

Hugo