Recently at work I was tasked with doing some load testing on a certain portion of our web application. After doing some research online I decided to use Siege. It’s a pretty cool tool, not to mention it is named very accordingly.
I’ll go over how to set it up on Mac OS X and the basics of how to use it.
1) Go here and grab the latest version: http://www.joedog.org/pub/siege/ (just download the file)
2) In terminal, find the file that was downloaded:
tar xvfz siege-3.0.5.tar.gz cd siege-3.0.5.tar.gz ./configure make make install
3) This will install Siege to /usr/local/bin/siege. In terminal type:
which siege /usr/local/bin/siege
To make sure it works, type:
You should see the following if it is installed:
SIEGE 3.0.5 Usage: siege [options] siege [options] URL siege -g URL Options: -V, --version VERSION, prints the version number. -h, --help HELP, prints this section. -C, --config CONFIGURATION, show the current config. -v, --verbose VERBOSE, prints notification to screen. -q, --quiet QUIET turns verbose off and suppresses output. -g, --get GET, pull down HTTP headers and display the transaction. Great for application debugging. -c, --concurrent=NUM CONCURRENT users, default is 10 -i, --internet INTERNET user simulation, hits URLs randomly. -b, --benchmark BENCHMARK: no delays between requests. -t, --time=NUMm TIMED testing where "m" is modifier S, M, or H ex: --time=1H, one hour test. -r, --reps=NUM REPS, number of times to run the test. -f, --file=FILE FILE, select a specific URLS FILE. -R, --rc=FILE RC, specify an siegerc file -l, --log[=FILE] LOG to FILE. If FILE is not specified, the default is used: PREFIX/var/siege.log -m, --mark="text" MARK, mark the log file with a string. -d, --delay=NUM Time DELAY, random delay before each requst between 1 and NUM. (NOT COUNTED IN STATS) -H, --header="text" Add a header to request (can be many) -A, --user-agent="text" Sets User-Agent in request -T, --content-type="text" Sets Content-Type in request Copyright (C) 2013 by Jeffrey Fulmer, et al. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
4) Now to run a simple load test:
siege -c10 -d10 -r1 http://www.websiteyouaretesting.com/
This will run 10 concurrent users (-c10), a delay of 0-10 seconds per request (-d10), each user will make 1 request (-r1).
The output should be something like this:
siege -c10 -d10 -r1 https://ess12-white.qa.echo360.com:8443/ess/echo/presentation/6d213dc5-cd4d-4a0f-9b00-fae9e8846852/media.mp3?downloadOnly=true ** SIEGE 3.0.5 ** Preparing 10 concurrent users for battle. The server is now under siege... HTTP/1.1 200 0.25 secs: 3468 bytes ==> GET /... HTTP/1.1 200 0.13 secs: 3468 bytes ==> GET /... HTTP/1.1 200 0.12 secs: 3468 bytes ==> GET /... HTTP/1.1 200 0.12 secs: 3468 bytes ==> GET /... HTTP/1.1 200 0.12 secs: 3468 bytes ==> GET /... HTTP/1.1 200 0.14 secs: 3468 bytes ==> GET /... HTTP/1.1 200 0.14 secs: 3468 bytes ==> GET /... HTTP/1.1 200 0.12 secs: 3468 bytes ==> GET /... HTTP/1.1 200 0.16 secs: 3468 bytes ==> GET /... HTTP/1.1 200 0.12 secs: 3468 bytes ==> GET /... done. Transactions: 10 hits Availability: 100.00 % Elapsed time: 10.12 secs Data transferred: 0.03 MB Response time: 0.14 secs Transaction rate: 0.99 trans/sec Throughput: 0.00 MB/sec Concurrency: 0.14 Successful transactions: 10 Failed transactions: 0 Longest transaction: 0.25 Shortest transaction: 0.12 FILE: /usr/local/var/siege.log You can disable this annoying message by editing the .siegerc file in your home directory; change the directive 'show-logfile' to false.
After the test runs it will give you a short report of the stats of the test. The stats are also logged in /usr/local/var/siege.log.
Short explanation of the report:
The number of server requests.
This is the percent of availability of successful requests.
How long the entire test took.
The total data transferred to every user.
The average time it took to respond to each user’s request.
The average number of transactions that occurred per second.
The average number of data transferred per second from server to all users.
The average number of concurrent requests.
The number of successful requests.
The number of failed requests.
The longest time a single transaction took out of the total transactions.
The shortest time a single transaction took out of the total transactions.
5.) Last note, if you type in terminal:
This will show you the configuration for Siege. This can be changed to your liking, just need to edit the .siegerc file. For me it is located here: /Users/your_username/.siegerc, it should be located there for you as well.