JMeter on AWS: Performance Testing on Cloud

JMeter is highly scalable performance testing tool. It can be used to perform distributed tests for large number of users. Since it may not be feasible for many of us to setup required physical infrastructure for distributed testing, we can use cloud services like AWS to perform this task. This post shows how to setup JMeter on AWS to carry out performance testing in cloud environment.

In this tutorial, we will setup JMeter Master-Slave configuration on 3 AWS EC2 instances. As shown in the illustration below, we will have 1 master sending tests to 2 slaves. These slaves in turn will run the tests on application and collect results. After the load test, slaves will send the results to master instance. Master will then combine both the results and generate a report.

JMeter on AWS: Master Slave Architecture

JMeter on AWS: Master Slave Architecture

Before starting with setup process however, let’s check out some background information. JMeter uses Java RMI (Remote Method Invocation) to perform distributed testing. RMI requires all systems to be in same subnet for communication. Since the AWS EC2 instances may not be in the same subnet, we’ll need to setup SSH tunneling for them to communicate.

We need to have our JMeter script on master system only. No need to copy them on slave systems. Also, load will be generated from both slave systems. Meaning if you want to generate load of 100 users on application, your JMeter script on master should have 50 users specified.

Now that we have all the background details, let’s get into the actual setup process. We have divided the setup procedure in 4 sections as below.

  1. Configuring EC2 instances
  2. Setup port forwarding (tunneling)
  3. Configuring JMeter
  4. Run JMeter on AWS

Let’s check them out one by one.

Configuring EC2 instances

  • Spin up 3 EC2 instances and install an OS on them. We have used RedHat OS here but you can choose other OS as per your requirement.
  • Install Java and JMeter on all 3 instances. Below is the command to install JMeter.
  • Since we are setting up SSH tunnel, it’s a good idea to steer clear of stale connection and keep SSH alive. This can be done by adding/updating below lines in /etc/ssh/ssh_config file.

Setup port forwarding (tunneling)

  • In our case, 3 connections will be required between master and slaves. 2 connections will be from master (RMI and JMeter connection) and 1 connection will be from slaves (RMI).
  • To setup tunneling for slave 1 system, use below command on your master system.
  • Similarly, use below command on master system to setup tunneling for slave 2.

Configuring JMeter

  • We need to configure JMeter on both slave systems to listen to ports where master will be sending tests. To do this on slave 1 system, add/update below lines in jmeter.properties file located in bin directory.
  • Similarly, update jmeter.properties file on slave 2 system with below lines.
  • Next, update the jmeter.properties file on master system with below lines. This configures master to send tests to slaves and receive results.

Run JMeter on AWS

We are done with all the required configurations. Now we can start executing our JMeter tests in non-GUI mode. But first, we need to start JMeter server on slave systems.

  • Use below command on both slave systems to start JMeter RMI server. You’ll need to be in bin directory to execute this command.
  • Start test on master server with below command.
  • Use ./stoptest.sh command to stop the test.

We hope the above setup of JMeter on AWS would be useful to you. We would love to hear your feedback via comments.

Comments
  1. Richard Friedman
  2. Sandip Saha
  3. Guruprasad Ramarao
  4. dudley
  5. Badal Kumar Sahu
  6. VIGNESH
    • jason
  7. Colin Palmer
  8. Mo
  9. kamal
  10. Suhail

Leave a Reply

Your email address will not be published.