Jul 022011
 

siege

Do you want to test how your new site work under an heavy load ?
Put it under 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.”




PLATFORM SUPPORT
Siege was written on GNU/Linux and has been successfully ported to AIX, BSD, HP-UX and Solaris. It should compile on most System V UNIX variants and on most newer BSD systems.

Installation

Siege it’s available on Debian and Ubuntu so you can install it with:

aptitude install siege

Basic usage

Siege allows you to stress a web server with ‘n’ number of users for ‘t’ number of times, where n and t are defined by the user. It records the duration time of the test as well as the duration of each single transaction.

For a first test run you can use the command:

siege -b -c 10 -r 3 http://yoursite.com
 
** SIEGE 2.70
** Preparing 10 concurrent users for battle.
The server is now under siege...
HTTP/1.1 200   2.40 secs:   11707 bytes ==> /
HTTP/1.1 200   3.13 secs:   11707 bytes ==> /
HTTP/1.1 200   3.39 secs:   11707 bytes ==> /
HTTP/1.1 200   3.45 secs:   11707 bytes ==> /
HTTP/1.1 200   3.52 secs:   11707 bytes ==> /
HTTP/1.1 200   3.57 secs:   11707 bytes ==> /
HTTP/1.1 200   3.61 secs:   11707 bytes ==> /
HTTP/1.1 200   3.64 secs:   11707 bytes ==> /
HTTP/1.1 200   3.70 secs:   11707 bytes ==> /
HTTP/1.1 200   3.74 secs:   11707 bytes ==> /
HTTP/1.1 200   4.09 secs:   11707 bytes ==> /
HTTP/1.1 200   4.00 secs:   11707 bytes ==> /
HTTP/1.1 200   5.25 secs:   11707 bytes ==> /
HTTP/1.1 200   4.34 secs:   11707 bytes ==> /
HTTP/1.1 200   4.48 secs:   11707 bytes ==> /
HTTP/1.1 200   4.82 secs:   11707 bytes ==> /
HTTP/1.1 200   4.77 secs:   11707 bytes ==> /
HTTP/1.1 200   5.00 secs:   11707 bytes ==> /
HTTP/1.1 200   4.95 secs:   11707 bytes ==> /
HTTP/1.1 200   5.54 secs:   11707 bytes ==> /
HTTP/1.1 200   5.42 secs:   11707 bytes ==> /
HTTP/1.1 200   4.61 secs:   11707 bytes ==> /
HTTP/1.1 200   5.45 secs:   11707 bytes ==> /
HTTP/1.1 200   5.67 secs:   11707 bytes ==> /
HTTP/1.1 200   6.26 secs:   11707 bytes ==> /
HTTP/1.1 200   5.64 secs:   11707 bytes ==> /
HTTP/1.1 200   7.34 secs:   11707 bytes ==> /
HTTP/1.1 200   6.58 secs:   11707 bytes ==> /
HTTP/1.1 200   8.01 secs:   11707 bytes ==> /
HTTP/1.1 200   7.11 secs:   11707 bytes ==> /
done.
Transactions:		          30 hits
Availability:		      100.00 %
Elapsed time:		       15.29 secs
Data transferred:	        0.33 MB
Response time:		        4.78 secs
Transaction rate:	        1.96 trans/sec
Throughput:		        0.02 MB/sec
Concurrency:		        9.38
Successful transactions:          30
Failed transactions:	           0
Longest transaction:	        8.01
Shortest transaction:	        2.40

This has run the benchmark on http://yourwebsite.com website, running with 10 concurrent connections to the website, running the test in a loop 3 times.

By default all output from the siege benchmarking tests would be logged in the ouput file /var/siege.log
Another option that siege provides is the ability to check a number of provided website url address via the -i option.

-i, --internet          INTERNET,  generates  user  simulation by randomly hitting the URLs read from the urls.txt file.
This option is viable only with the urls.txt file.

Another example

 
siege -c 30 -i -t 10m -d 5 -f sitemap.txt

This simulated 30 concurrent users all requesting random pages from a list of URLs (taken from the files sitemap.txt), with a 5 second delay after each page (to simulate the user reading the page). This was set to run for 10 minutes.

It’s possible to set your options in the file /$HOME/.siegerc config such as:

/root/.siegercerbose = true
show-logfile = true
logging = true
protocol = HTTP/1.1
chunked = true
cache = false
connection = close
concurrent = 15
delay = 1
accept-encoding = gzip
spinner = true
internet = true
benchmark = true

Siege is a small and well done program, that in the Unix-style is good for one thing, calling differents URL and doing in that way a benchmark on a website. To keep in mind in your load test.

Popular Posts:

Flattr this!

  2 Responses to “Put your site under Siege”

  1. […] this, for a bit more on one of the […]

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

*