Home

Awesome

JMeter for ECS

JMeter Images for Distributed Testing on EC2 Container Service (ECS)

This application uses two images:

Warning: Using these Docker images will incur compute and storage costs in AWS. Care is taken to terminate all instances and volumes after JMeter tests complete, but bugs could allow these resources to continue to run. See the issues list for more detail.

How to Use

The smithmicro/lucy Docker image can be run as-is with a number of required environement variables.

Prerequisites to use this image:

** If you do not have a VPC created, you can use the included aws-setup.sh script to create the VPC, Subnet and required Security Group.

Docker run template:

docker run -v <oath to jmx>:/plans -v <path to pem>:/keys -v <path to logs>:/logs \
    --env AWS_ACCESS_KEY_ID=<key id> \
    --env AWS_SECRET_ACCESS_KEY=<access key> \
    --env AWS_DEFAULT_REGION=<region> \
    --env SECURITY_GROUP=<security group within your VPC> \
    --env SUBNET_ID=<subnet IDs within your VPC> \
    --env KEY_NAME=<key pair name without extension> \
    --env MINION_COUNT=<number of minions> \
    smithmicro/lucy /plans/demo.jmx

For 5 test instances in N. Virginia, docker run would look like this, assuming your jmeter-key.pem file is located in the keys subdirectory:

docker run -v $PWD/plans:/plans -v $PWD/keys:/keys -v $PWD/logs:/logs \
    --env AWS_ACCESS_KEY_ID=ABCDEFGHIJKLMNOPQRST \
    --env AWS_SECRET_ACCESS_KEY=abcdefghijklmnopqrstuvwxyz0123456789ABCDEF \
    --env AWS_DEFAULT_REGION=us-east-1 \
    --env SECURITY_GROUP=sg-12345678 \
    --env SUBNET_ID=subnet-12345678,subnet-87654321 \
    --env KEY_NAME=jmeter-key \
    --env MINION_COUNT=5 \
    smithmicro/lucy /plans/demo.jmx

Architecture

This Docker image replaces the JMeter master/slave nomenclature with Gru, Minion and Lucy. Gru manages the Minions from within ECS, but Lucy orchestrates the entire process.

+--------------------------------------+
|  EC2                                 |
|  +--------------------------------+  |
|  |  ECS                           |  |
|  |                +--------+      |  |
|  |  +-------+     | +--------+    |  |      +--------+
|  |  |       |---->| | +--------+ ---------->|        |
|  |  |  Gru  |<----| | |        | ---------->| Target |
|  |  |       |     +-| | Minion | ---------->|        |
|  |  +-------+       +-|        |  |  |      +--------+
|  |     ^ |            +--------+  |  |
|  +-----|-|------------------------+  |
+--------|-|---------------------------+
         | |
    .jmx | | .log/.jtl
         | v
     +----------+
     |          |
     |   Lucy   |
     |          |
     +----------+

Lucy runs the lucy.sh script to perform the following steps:

Volumes

The lucy container uses 3 volumes:

Environment Variables

The following required and optional environment variables are supported:

VariableRequiredDefaultNotes
AWS_DEFAULT_REGIONYesNoneAWS Region (e.g. us-east-1)
AWS_ACCESS_KEY_IDYesNoneAWS Access Key
AWS_SECRET_ACCESS_KEYYesNoneAWS Secret Key
INPUT_JMXYesNoneFile path of JMeter Test file to run (.jmx). You can optionally specify this as the first command line option of docker run
KEY_NAMEYesNoneAWS Security Key Pair .pem file (do not specify the .pem extension)
SECURITY_GROUPYesNoneAWS Secuirty group that allows ports 22,1099,50000,51000/tcp and 4445/udp from all ports (e.g. sg-12345678)
SUBNET_IDYesNoneOne or more Subnets (comma separated) that are assigned to your VPC
VPC_IDVPC assigned to SUBNET_IDWe dautomatically erive this from your SUBNET_ID
JMETER_VERSIONlatestsmithmicro/jmeter Image tag. See Docker Hub for available versions.
INSTANCE_TYPEt2.microTo double your memory, pass t2.small
MEM_LIMIT950mIf you are using t2.small, set MEM_LIMIT to 1995m
MINION_COUNT2
PEM_PATH/keysThis must match your Volume map. See Volume section above.
CLUSTER_NAMEJMeterName that appears in your AWS Cluster UI
GRU_PRIVATE_IPNoneSet to true if you would like to run Lucy within AWS. See GitHub Issue 8 for details.
JMETER_FLAGSNoneCustom JMeter command line options. For example, passing -X will tell the Minion to exit at the end of the test
RETAIN_CLUSTERNoneSet to true if you want to re-use your cluster for future tests. Warning, you will incur AWS charges if you leave your cluster running.
CUSTOM_PLUGIN_URLNoneThe URL of a custom plugin you want to install in the Minions. File will be copied to $JMETER_HOME/lib/ext.
COPY_DIRNoneSet to true if you want to copy the directory in which the .jmx file is located to all Minions and Gru. The files will be located in all Docker containers in /plans. Update your JMX file to reference external files at /plans/...

Notes

All current JMeter Plugins are installed via the Plugins Manager.

For more information on JMeter Distributed Testing, see:

Inspired by...

https://en.wikipedia.org/wiki/Despicable_Me_2

Minions