Docker Up Distributed Load Testing with Tsung

Load testing is essential to ensure performance and scalability of many types of applications. When it comes to a scale that a single node is not able to generate enough payload, distributed load testing often come to rescue. Although a collection of distributed load testing tools are available, Tsung stands out for me by its magnitude higher payload, straight forward configuration, and built-in graph generation as indicated in Stefanie Forrester’s comparison.

Install and configure a Tsung cluster shouldn’t be much too complicated. However, I prefer using docker to ensure deployment reuse and separation of dependency. Tsung cluster is of a single master multiple slaves setup, where master and slaves recognize each other by hostnames and establish connection through ssh. Keep those in mind; otherwise you might run into clueless Tsung crashes as I did.

The docker image I use is ddragosd/tsung-docker. It has a single mode for single node load testing, and master/slave modes for distributed one. To setup a distributed load testing cluster, choose one node as master node and run in master mode, and all other nodes in slave mode. For the master node, except for the docker run script provided in the link, one also needs to add hostname through -h argument, and add slave nodes’ hostname and ip via –add-host argument. Similarly, for each slave node, add its own hostname and master hostname and ip to docker script.

The complete docker script is as following:

# Master node:
docker run \
 -p 21:22 \
 -p 4369:4369 \
 -p 9001-9050:9001-9050 \
 -v /local/tests:/usr/local/tsung ddragosd/tsung-docker:latest \
 -h tsung_master \
 --add-host tsung_slave1:192.168.0.1 \
 --add-host tsung_slave2:192.168.0.2 \
 -f /usr/local/tsung/mytest.xml start

# Slave node:
docker run \
 -p 21:22 \
 -p 4369:4369 \
 -p 9001-9050:9001-9050 \
 -e "SLAVE=true" \
 -h tsung_slave1 \
 --add-host tsung_master:192.168.0.0 \
 ddragosd/tsung-docker:latest

For more information about Tsung testing plan and configuration, one can refer to Tsung’s official documentation.

Advertisements
Docker Up Distributed Load Testing with Tsung

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s