There are limitations on the number of requests that can be simulated for load testing from a single machine. Distributed testing comes to the rescue. In a distributed setup there is one controller called master and number of slaves controlled by master. Distributed load testing can be tricky and may produce incorrect results if not configured correctly. Test results depends on the following factors.
- Network bandwidth.
- Master and slave systems configuration including memory, processor speed.
- Configuration of the load testing tool like number of users running in parallel.
Setup 1:
- 1 Master controller - Quad Core 3.00GHz 8GB memory,
- 7 Slaves all with Intel(R) Xeon(R) CPU, E5420 @2.50GHz, 2.49 GHz, 2.00 GB of RAM
Setup 1 |
- 1 Master controller an Amazon EC2 instance – Dual Core 2.6GHz 2GB memory
- 12 Slaves with similar configuration as Master
Setup 2 |
- Following are the steps for load testing setup using Amazon cloud.
- Open elastic fox, a firefox plugin for managing EC2 instances. From the images tab in elasticfox search for ‘jMeter’. You may find existing EC2 instances for master and slaves. Alternatively you can create an instance of existing linux AMI with JDK installed and JAVA_HOME environment variable is setup. You can create any number of slaves from instances -> right click on slave instance ->Launch more of these.
- Download and install jMeter by unzipping the tar file to home directory (or any other directory) of master and slave instances.
i) Installed jMeter version is jakarta-jmeter-2.4
ii) jMeter Installed in /home directory
4. jMeter updates and aggregates the results from all slaves instantly which may consume heavy resources of master and may result in system halt for large scale load testing. Update /bin/jmeter.properties as shown below.
mode=Batch
num_sample_threshold=100
jMeter running with ‘Batch’ mode collects and aggregates the results if it exceeds the
num_sample_threshold value.
Specify slaves’ public dns name separated by comma.
remote_hosts=slave1_public_dns, slave2_public_dns
5. Navigate to /bin directory and start slave by running
jmeter-server
6. Navigate to /bin directory and start master by running jmeter.sh from bin directory as below.
jmeter
You may run jMeter with increased heap memory as shown below
JVM_ARGS="-Xms512m -Xmx512m" jmeter
7. From jMeter user interface click ‘Run->Remote Start All’ as shown in the image below to start test case on all slaves.
8. After completion of running test cases shutdown all slaves from Run->Remote Stop All
9. You may shutdown Amazon EC2 instances from elasticfox. Right click on each instance and click terminate.