Simple load testing using Siege

In a recent project we replaced an existing webapp with a new implementation. The old app got around 300 requests/second so we wanted to make sure that the new implementation could handle the same amount of traffic. Siege proved to be an easy to use utility for this.

URLs
The first question was how do we generate realistic traffic? Siege can take a file with different URLs and call them. Our app got a mix of different requests where the parameters have significant impact on the work performed. Since we had nginx in front we could look at the access log. It contained entries similar to:

To produce a useable list of URLs from this we used:

Here awk is told to use space as field separator and print the 7th field prefixed with http://testserver resulting in a links.txt file looking like:

Running the test
We ran the load test from a few instances running ubuntu. Installing siege is as you’d guess simply:
sudo apt-get install siege
Now all we had to do was to run siege with the links file, e.g.:

This tells siege to use 5 clients with zero delay between the requests, --internet means that links should be chosen randomly from the file.  Using --header means that a custom header can be specified.

Using this setup siege runs until terminated (Ctrl + C) and then prints statistics, e.g.:

Leave a Reply