Home / Blog / Launch a Jmeter test on several AWS instances

Launch a Jmeter test on several AWS instances

By Michael Ohl, 19 Sep 2014

Salut !

If you were wondering, well yes I am French, that said, let’s step inside this blog post.

One of my tasks here is to do some testing, more precisely testing websites.

Currently I’m using Selenium, but I’ve also used Jmeter.

The first one is mainly used to test each part of a website, for example, making sure that when clicking on a button the correct action is performed; whereas Jmeter is used inter alia to test the number of connections a website can handle.

In this tutorial we will focus on Jmeter as the title suggests it.

Steps to go through

1. Use Jmeter on Windows

1.1 Download and install Apache Jmeter

You can do this here.

This is the console you should obtain :

jmeter_console

1.2 Create a test

Loads of websites and videos explain how to create a test with Jmeter, starting from the Apache Jmeter documentation, that’s why my post is about remotly executing it.

To see the limit of connections :

  • Go to the Thread group by clicking on thread_group and change the number of users
  • Launch the test by clicking on play_button
  • Go to Aggregate Graph and look if there’s any error in the chart
  • Repeat the process

2. Launch the test remotely

What we did was testing multiple connections from one computer, but it can be interesting to simulate the case of having several users creating multiple connections.

In order to do this we use AWS instances, we will have a master and a slave but you can create as much slaves as you like.

2.1 Create a master

You can follow the steps of my previous post but in step 2 select a Ubuntu server AMI, and  you don’t need to install Elastic Search.

We faced a problem when using Windows due to connection problems, so we advise you to use Linux which is easier to configure.

Now check that you can connect to your instance via command line and install Jmeter by opening a terminal and type :

sudo apt-get install jmeter

2.2 Export the test

In order to have  your test on this machine you will need to transfer it by using the scp command.

Step 1: Click on the Windows button, type firewall, open the first link, and create an outbound rule for all ports.

Step 2: Open a console 2 command line (if  you don’t already have it click here) , go into the directory which contains both your file you want to send and your key to connect to your instance.

Step 3: Type this command by replacing what’s in red by your informations without forgetting the colon at the end of the command :

 scp -i AWS_private_key your_file ubuntu@public_DNS:

2.3 Use a graphical interface

In order to use Jmeter with a graphical interface  like on Windows, you will need to use VNC like this.

You should then have a graphical interface of a linux machine

2.4 Create slaves

This instance will be the “master” one and the others the “slaves”.

You will then have to clone this instance into others like this :

Clone AWS

2.5 Configure the Jmeter configuration files of the master

On the master type these lines :

cd /usr/share/jmeter/bin/
nano jmeter.properties

Search for the remote_hosts line in the jmeter.properties file and set it like this (without the hash at the beginning) :

remote_hosts=IP_of_the_slave:1099

2.6 Configure the Jmeter configuration files of the slave

cd /usr/share/jmeter/bin/
nano jmeter.properties

Search for the remote_hosts line in the jmeter.properties file and set it like this (without the hash aswell) :

remote_hosts=127.0.0.1
server_port=1099
server_port=1099 jmeter-server
jmeter-server

2.7 Launch remotely the test  on each slave from the master

Launch on the slave the Jmeter server by typing :

jmeter-server

Launch on the master Jmeter by simply typing :

 jmeter

Now on the master click on remote_button which is the one that has two green triangles, it will then run the test on each slave.

In order to see the limit of connections, you can check again part 1.2 of this blog.