Siege is an open source regression test and benchmark utility. It can stress test a single URL with a user defined number of
simulated users, or it can read many URLs into memory and stress them simultaneously.
When launching a web application, you want to ensure that it will be able to handle the load of users accessing the site. We can get an idea of how it will perform by using a benchmarking tool. While there are many popular tools such as ab (Apache benchmarking tool) and Siege.
Siege is an http load testing and benchmarking utility. It was designed to let web developers measure their code under duress, to see how it will stand up to load on the internet. Siege supports basic authentication, cookies, HTTP and HTTPS protocols. It lets its user hit a web server with a configurable number of simulated web browsers. Those browsers place the server “under siege.”
http load Testing tool installation
- cd /usr/local/src
- wget http://www.joedog.org/pub/siege/siege-3.0.5.tar.gz
- tar -zxvf siege-3.0.5.tar.gz
- cd siege-3.0.5/
- make install
The configure script attempts to guess the values which are set on your platform. If all goes well, you should only have to run it
with some preferred arguments. The more notable ones are listed below:
–help prints the configure script’s help section
–prefix=/some/dir installs the files in /some/dir
–bindir=/some/bin installs the executable in /some/bin
–mandir=/some/man installs the man page in /some/man
–with-ssl=/some/dir where dir is where you installed ssl, this
flag is used to enable https protocol.
This will install the application ( siege ) in the default directory/usr/local/bin. If that directory is in your PATH, then to run siegeand view the online help type:
$ siege –help
You can use this benchmark tool forever, or you can specify a specific period of time. To set the duration of the test, use the -t NUMm option. The NUMm format is a representation of time. Here are some time format examples:
-t60S (60 seconds)
-t1H (1 hour)
-t120M (120 minutes)
siege -b -t60S http://domain.com
Example of the output
Lifting the server siege… done.
Transactions: 160 hits
Availability: 99.38 %
Elapsed time: 59.32 secs
Data transferred: 0.95 MB
Response time: 4.99 secs
Transaction rate: 2.70 trans/sec
Throughput: 0.02 MB/sec
Successful transactions: 171
Failed transactions: 1
Longest transaction: 26.57
Shortest transaction: 1.66
Test Multiple URLs
You can provide a file of URLs separated by line to the -f option. Another recommendation is to set the -i option that tells Siege to randomly select URLs from the text file, resulting in a more real-world test.
siege -c50 -d10 -i -f site.txt