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.

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: - - [29/Sep/2015:06:48:12 +0000] "GET /myapp/pathA?a=1&b=2 HTTP/1.1" 200 277 "-" "Dalvik/1.6.0(Linux; U; Android 4.4.2)" 0.015 - - [29/Sep/2015:06:48:12 +0000] "GET /myapp/pathB?a=3&b=4 HTTP/1.1" 200 2042 "-" "Dalvik/1.6.0(Linux; U; Android 4.4.2)" 0.017

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

awk -F' ' '{print "http://testserver"$7}' access.log > links.txt

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.:

siege --concurrent=5 --delay=0 --header "Api-Key: xyz" --internet --file links.txt

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.:

Transactions:		         109 hits
Availability:		      100.00 %
Elapsed time:		        4.47 secs
Data transferred:	        5.10 MB
Response time:		        0.07 secs
Transaction rate:	       24.38 trans/sec
Throughput:		        1.14 MB/sec
Concurrency:		        1.72
Successful transactions:         109
Failed transactions:	           0
Longest transaction:	        0.36
Shortest transaction:	        0.05

This Post Has One Comment

  1. Qwizz Test

    Sooo 24 per second? I’m guessing you didn’t replace the 300/sec app with the new implementation?

Leave a Reply