Sie sind auf Seite 1von 3

An AWS JMeter Controller Machine

I've taken a slightly different tack and decided to build bespoke images for the controller
and injector machines. This means I don't need the install.sh script and we are always
working from a known base. The drawback is that updates will not automatically be
applied but of course this can lead to better stability in the test environment.

I built the machines in AWS. It doesn't cost too much even for an individual to use so it
is quite feasible for you to have a go at this setup without huge commercial support.

I'm not a linux expert but most steps are straight forward. You want to install the ec2-
api-tools, apache-jmeter and for CI testing, Jenkins. And you need to give AWS
permission to your user for executing the ec2 tools. Do this by adding the access and
secret keys to the user's profile. See below.

Instantiate a ubuntu instance on AWS and run 'apt-get update' as their images will
necessarily be out of date..

I roughly followed the install.sh script but also used Google to find latest versions etc.

I added Jenkins to my controller. This was mainly so I could test my setup before going
to our proper build server. It also may lend itself to a master/slave solution which I will
be investigating at a later date. Again, Jenkins was installed straight from the net
instructions.

I did run into one issue with Jenkins which was permissions, in particular for running the
various scp and ssh commands in jmeter-ec2.sh. The workaround for this is to copy your
pem file into ~/.ssh. Make sure the pem file has 600 permissions for the user in
question (locked down to the user only) otherwise the system stops you using the file. I
also had to change the owner to Jenkins when I copied this file over to that account. I
could do this with the root account.

NOTE: in the script you can't seem to refer to ~/.ssh when this is stored in a variable
(such as $PEM_PATH). I had to set PEM_PATH="$HOME/.ssh" in the jmeter-
ec2.properties file.

I'll come on to the controller software shortly, first a few screenshots to show
environment setup:

I installed everything except Jenkins under /usr/local:

The controller scripts are all under /usr/local/jmeter:

Under your jmeter project, create a results folder and a log folder (amoungst others):
The results and log folders are where we collate results, including specific transaction
results, and logs, including the jmeter machine logs and the controller output logs. In
the results folder you can also see a couple of jtl files. these are built by the 95th
percentile script for graphing in Jenkins:

Jenkins installs itself under /var/lib/jenkins:

And you can see the test run files copied into the workspace folder. These can be
archived with a standard Jenkins archive artifacts post build step:

For any users (such as 'ubuntu' or 'jenkins') that want to use the EC2 API tools (sparking
up injectors and tearing them down etc.), you will need to set up the user profile.

You should have something like the following in .profile:

PATH=$PATH:/usr/local/apache-jmeter-2.9/bin
export PATH
export JAVA_HOME=/usr
export EC2_HOME=/usr/local/ec2-api-tools
export PATH=$PATH:$EC2_HOME/bin

export AWS_ACCESS_KEY=XXXXXXXXXXXXXXXXX
export AWS_SECRET_KEY=yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
export EC2_URL=https://ec2.eu-west-1.amazonaws.com
Controller Software
The controller software basically consists of a bunch of bash scripts and properties files.
Starting with the original version, I've added a few enhancements to suit my projects.
My version can be downloaded from the main page.

A typical test run in Jenkins using my scripts is as follows. This of course is using the
jenkins on the controller machine itself. For external Jenkins servers this could be done
via ssh:

#!/bin/bash

cd /usr/local/jmeter
project="myproject" setup="false" terminate="false" count=3 ./jmeter-ec2.sh

project="myproject" workspace="${WORKSPACE}" ./results-to-workspace.sh

project="myproject" stepname="01." transaction="brands-request" limit=500


workspace="${WORKSPACE}" ./jmeter-95th.sh
project="myproject" stepname="02." transaction="4od-request" limit=2600
workspace="${WORKSPACE}" ./jmeter-95th.sh

The above script runs the main test (jmeter-ec2.sh) then copies results over to the
Jenkins workspace, then checks the 95th percentile of two transactions.

Details of the above steps are given on the following pages.

An AMI is taken of the controller once everything has been setup and tested. This isn't
strictly required here but thinking ahead, I am aiming to instantiate a whole test
environment in the cloud, plus a load test controller and subsequently injectors. This
can all then be torn down once the testing has completed.

[Home] [About (CV)] [Contact Us] [JMeter Cloud] [JM Highlights] [JM Overview] [JM Control]
[JM Inject] [JM Threads] [JM Results] [JM Assertions] [JM TPS] [JM Metrics] [JM Runtime]
[JM Collation] [JM Logs] [JM 95th] [JM 95th v2] [JM Jenkins] [JM Corporate] [JM Scripts] [JM Variables]
[JM Embedded] [JM Hosts] [JM Running] [JM Example] [JM Versions] [webPageTest] [_64 images]
[asset moniitor] [Linux Monitor] [Splunk ETL] [Splunk API] [AWS bash] [LR Rules OK] [LR Slave]
[LR CI Graphs] [LoadRunner CI] [LR CI Variables] [LR Bamboo] [LR Methods] [LR CI BASH]
[Bash methods] [Jenkins V2] [Streaming vid] [How fast] [Finding Issues] [Reporting] [Hand over]
[VB Scripts] [JMeter tips] [JMeter RAW] [Dynatrace] [Documents] [FAQ] [Legal] In
Carte
Elements
grou
compa

Das könnte Ihnen auch gefallen