JMeter - 2.9 - (Remote Test|Distributed testing)

1 - About

In distributed testing, JMeter run in server mode on the remote node(s) that are controlled from the client. The client sends the test plan to all the servers. Then each server run it (JMeter does not distribute the load between servers).

3 - Topologie

  • (Client|Master): the system running Jmeter which controls the slave remote (and doesn't send any request)
  • (Server|Slave|Remote) Node: the system running JMeter in server mod (jmeter-server), which takes commands from the client and send the test plan requests to the target system(s)
  • Target: the server to stress test

Listeners in the test plan send their results back to the client JMeter which writes the results to the specified files.

Samples are not sent back synchronously by default as they are generated. Since JMeter 2.9, default is MODE_STRIPPED_BATCH, which returns samples in batch mode (every 100 samples or every minute by default). This is to improve the maximum throughput of the server test as otherwise the sample result has to be sent back before the thread can continue.

The MODE_STRIPPED_BATCH strips response data from Sample Result, so if you need it change to another mode. See Sender Mode

JMeter/RMI requires:

  • a connection from the client to the server. Default port 1099.
  • and a reverse connection in order to return results from the server to the client. This will use a high-numbered port controlled by jmeter property “client.rmi.localport”

4 - Prerequisites

All the nodes (client and servers):

  • are running the same version of JMeter.
  • are running the same version of Java. For JMeter 2.9, Java 6 runtime or higher
  • have extra test data files available in the appropriate directory
  • are on the same subnet
  • can communicate (the firewalls must be turned off of set up to allow the connections)
  • must be started with the same property (file and command line option)

5 - Steps

5.1 - Remote Servers

5.1.1 - Custom jmeter-server script

The script jmeter-server(.bat) is used to run JMeter in remote node. You must modify this script to start JMeter with the same JMeter option.

For instance, to point to a custom user property file, add the –addprop option in the following line:


${DIRNAME}/jmeter ${RMI_HOST_DEF} -Dserver_port=${SERVER_PORT:-1099} -s -j jmeter-server.log --addprop user.gui.properties "[email protected]"

5.1.2 - Start the server

Start then the JMeter server component script on all server machines:

  • Unix

JMETER_HOME/bin/jmeter-server
[[email protected] bin]$ ./jmeter-server

  • Windows

JMETER_HOME/bin/jmeter-server.bat

Output:


Created remote object: UnicastServerRef [liveRef: [endpoint:[192.168.0.114:48840](local),
objID:[1aaa5703:13e6447841d:-7fff, 2817466081349018584]]]

where the endpoint is the IP 192.168.0.114 with the port 48840. It defines the listening port.

The following processes are started:


/bin/sh ./jmeter -Dserver_port=1099 -s -j jmeter-server.log
java -server -XX:+HeapDumpOnOutOfMemoryError -Xms512m -Xmx512m -XX:NewSize=128m -XX:MaxNewSize=128m -XX:MaxTenuringThreshold=2 -Dsun.rmi.dgc.client.gcInterval=600000 -Dsun.rmi.dgc.server.gcInterval=600000 -XX:PermSize=64m -XX:MaxPermSize=128m -jar ./ApacheJMeter.jar -Dserver_port=1099 -s -j jmeter-server.log

5.1.3 - Configuration

5.1.3.1 - endpoint port

The endpoint port is randomly assigned. If you want to set it up, change the below property


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

5.1.3.2 - RMI Configuration

Since JMeter 2.3.1, the JMeter server application starts the RMI registry itself; there is no need to start RMI registry separately. To revert to the previous behaviour, define the JMeter property server.rmi.create=false on the server host systems.

By default, RMI uses a dynamic port for the JMeter server engine. This can cause problems for firewalls, so versions of JMeter after 2.3.2 will check for the JMeter property server.rmi.localport . If this is non-zero, it will be used as the local port number for the server engine.

5.1.4 - Test the connection

From the client node, use telnet to connect to the process.


telnet  192.168.0.114   48926


Trying 192.168.0.114...
Connected to di-obiee-02.hotitem.local (192.168.0.114).
Escape character is '^]'.
exit
Connection closed by foreign host.

5.1.5 - Check the jmeter-server.log

The log is written in the file: jmeter-server.log


2013/05/02 12:09:48 INFO  - jmeter.util.JMeterUtils: Setting Locale to en_US 
2013/05/02 12:09:48 INFO  - jmeter.JMeter: Loading system properties from: /home/oracle/apache-jmeter-2.9/bin/system.properties 
2013/05/02 12:09:48 INFO  - jmeter.JMeter: Setting System property: server_port=1099 
2013/05/02 12:09:48 INFO  - jmeter.JMeter: Copyright (c) 1998-2013 The Apache Software Foundation 
2013/05/02 12:09:48 INFO  - jmeter.JMeter: Version 2.9 r1437961 
2013/05/02 12:09:48 INFO  - jmeter.JMeter: java.version=1.6.0_35 
2013/05/02 12:09:48 INFO  - jmeter.JMeter: java.vm.name=Java HotSpot(TM) 64-Bit Server VM 
2013/05/02 12:09:48 INFO  - jmeter.JMeter: os.name=Linux 
2013/05/02 12:09:48 INFO  - jmeter.JMeter: os.arch=amd64 
2013/05/02 12:09:48 INFO  - jmeter.JMeter: os.version=2.6.32-100.26.2.el5 
2013/05/02 12:09:48 INFO  - jmeter.JMeter: file.encoding=UTF-8 
2013/05/02 12:09:49 INFO  - jmeter.JMeter: Default Locale=English (United States) 
2013/05/02 12:09:49 INFO  - jmeter.JMeter: JMeter  Locale=English (United States) 
2013/05/02 12:09:49 INFO  - jmeter.JMeter: JMeterHome=/home/oracle/apache-jmeter-2.9 
2013/05/02 12:09:49 INFO  - jmeter.JMeter: user.dir  =/home/oracle/apache-jmeter-2.9/bin 
2013/05/02 12:09:49 INFO  - jmeter.JMeter: PWD       =/home/oracle/apache-jmeter-2.9/bin 
2013/05/02 12:09:49 INFO  - jmeter.JMeter: IP: 192.168.0.114 Name: di-obiee-02.hotitem.local FullName: di-obiee-02.hotitem.local 
2013/05/02 12:09:49 INFO  - jmeter.engine.RemoteJMeterEngineImpl: Starting backing engine on 1099 
2013/05/02 12:09:49 INFO  - jmeter.engine.RemoteJMeterEngineImpl: IP address=192.168.0.114 
2013/05/02 12:09:49 INFO  - jmeter.engine.RemoteJMeterEngineImpl: IP address is a site-local address; this may cause
problems with remote access.
Can be overridden by defining the system property 'java.rmi.server.hostname' - see jmeter-server script file 
2013/05/02 12:09:49 INFO  - jmeter.engine.RemoteJMeterEngineImpl: Creating RMI registry (server.rmi.create=true) 
2013/05/02 12:09:49 INFO  - jmeter.engine.RemoteJMeterEngineImpl: Bound to registry on port 1099 

5.2 - Client

5.2.1 - Configuration

5.2.1.1 - Define the servers IP

To define the servers IP, you can:

  • Add the value of the servers IP in the “remote_hosts” property

In non-Gui mode:

  • Use the -r command line and -Jremote_hosts={serverlist}
  • Use the -R command line option to specify the remote host(s) to use. E.g. jmeter -Rhost1,127.0.0.1,host2
5.2.1.2 - Server Exit after test

If you define the JMeter property server.exitaftertest=true. The server will exit after it runs a single test. See also the -X flag (described below)

5.2.2 - Start the client and the test

5.2.2.1 - Gui

Start the client with the script

  • For MS-Windows, “bin/jmeter.bat”.
  • For UNIX, “bin/jmeter”.

You will notice that the Run menu contains two new sub-menus:

  • “Remote Start”
  • and “Remote Stop”

These menus contain the client that you set in the properties file. Use the remote start and stop instead of the normal JMeter start and stop menu items.

5.2.2.2 - Command line

To start the remote server(s) from the command-line use the jmeter command:


jmeter -n -t script.jmx -r

or


jmeter -n -t script.jmx -R server1,server2...

where you can use the following flag:

  • n to start Jmeter in a non-gui mode
  • t to define the test file
  • r to start the remote server as defined in the JMeter properties file
  • R to define the list of servers and start them
  • -Gproperty=value - define a property in all the servers (may appear more than once)
  • -Z - Exit remote servers at the end of the test.

The command-line client will exit when all the remote servers have stopped.

6 - Configuration

6.1 - Property

All configurations, remote server as client are made in the JMeter Properties file under the section “Remote hosts and RMI configuration”.


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

# Remote Hosts - comma delimited
remote_hosts=127.0.0.1
#remote_hosts=localhost:1099,localhost:2010

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

# To change the port to (say) 1234:
# On the server(s)
# - set server_port=1234
# - start rmiregistry with port 1234
# On Windows this can be done by:
# SET SERVER_PORT=1234
# JMETER-SERVER
#
# On Unix:
# SERVER_PORT=1234 jmeter-server
#
# On the client:
# - set remote_hosts=server:1234

# Parameter that controls the RMI port used by the RemoteSampleListenerImpl
# Default value is 0 which means port is randomly assigned
#client.rmi.localport=0

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

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

# From JMeter 2.3.1, the jmeter server creates the RMI registry as part of the server process.
# To stop the server creating the RMI registry:
#server.rmi.create=false

# From JMeter 2.3.1, define the following property to cause JMeter to exit after the first test
#server.exitaftertest=true

6.2 - Remote batching

In the JMeter Properties file


#---------------------------------------------------------------------------
# Remote batching configuration
#---------------------------------------------------------------------------
# How is Sample sender implementations configured:
# - true (default) means client configuration will be used
# - false means server configuration will be used
#sample_sender_client_configured=true

# Remote batching support
# Since JMeter 2.9, default is MODE_STRIPPED_BATCH, which returns samples in
# batch mode (every 100 samples or every minute by default)
# Note also that MODE_STRIPPED_BATCH strips response data from SampleResult, so if you need it change to
# another mode
# Hold retains samples until end of test (may need lots of memory)
# Batch returns samples in batches
# Statistical returns sample summary statistics
# hold_samples was originally defined as a separate property,
# but can now also be defined using mode=Hold
# mode can also be the class name of an implementation of org.apache.jmeter.samplers.SampleSender
#mode=Standard
#mode=Batch
#mode=Hold
#mode=Statistical
#Set to true to key statistical samples on threadName rather than threadGroup
#key_on_threadname=false
#mode=Stripped
#mode=StrippedBatch
#mode=org.example.load.MySampleSender
#hold_samples=true
#
#num_sample_threshold=100
# Value is in milliseconds
#time_threshold=60000
#
# Asynchronous sender; uses a queue and background worker process to return the samples
#mode=Asynch
# default queue size
#asynch.batch.queue.size=100
#
# DiskStore: as for Hold mode, but serialises the samples to disk, rather than saving in memory
#mode=DiskStore

# Note: the mode is currently resolved on the client; 
# other properties (e.g. time_threshold) are resolved on the server.

# To set the Monitor Health Visualiser buffer size, enter the desired value
# monitor.buffer.size=800

7 - Support

7.1 - Permission denied


[[email protected] bin]$ ./jmeter-server
-bash: ./jmeter-server: Permission denied

Verify that the script jmeter-server en jmeter have the execute right.

8 - Documentation / Reference


Data Science
Data Analysis
Statistics
Data Science
Linear Algebra Mathematics
Trigonometry

Powered by ComboStrap