While I am waiting for Apache to build with the libtool –debug option, I thought I would share my thoughts on the siege utility. Siege is an open source HTTP regression and debugging utility. I have used curl and ab in the past to debug and benchmark websites, but prefer siege, since it allows me to debug and benchmark websites with a single well written utility. To debug the HTTP requests to a server, you can run run siege with the “-g” (Grab headers) and “-u” (URL to grab) option:
$ siege -g -v -u https://prefetch.net
** siege 2.62
** Preparing 1 concurrent users for battle.
The server is now under siege...
GET / HTTP/1.0
Host: prefetch.net
Accept: */*
Accept-Encoding: *
User-Agent: JoeDog/1.00 [en] (X11; I; Siege 2.62)
Connection: close
HTTP/1.1 200 OK
Date: Thu, 14 Apr 2005 23:35:19 GMT
Server: Apache/2.0.52
Set-Cookie: Horde=b18606e131eb443ce6557c790ed17bdd; path=/; domain=prefetch.net
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Connection: close
Content-Type: text/html; charset=ISO-8859-1
This displays a summary of the request/entity headers for the entire HTTP transaction, and is super useful for debugging. To simulate 5-users hitting a website with a delay between successive page loads, siege can be run with the “-c” (user count), “-r” (number of times to run the test), and “-d” (add delay between 1 and the option passed to “-d”) options:
$ siege -b -v -c 5 -r 5 -d 10 -u https://prefetch.net
** siege 2.62
** Preparing 5 concurrent users for battle.
The server is now under siege...
HTTP/1.1 200 0.57 secs: 578 bytes ==> /
HTTP/1.1 200 0.66 secs: 578 bytes ==> /
HTTP/1.1 200 0.76 secs: 578 bytes ==> /
HTTP/1.1 200 0.76 secs: 578 bytes ==> /
HTTP/1.1 200 0.95 secs: 578 bytes ==> /
HTTP/1.1 200 0.74 secs: 500 bytes ==> /
HTTP/1.1 200 0.95 secs: 500 bytes ==> /
HTTP/1.1 200 0.90 secs: 500 bytes ==> /
HTTP/1.1 200 0.65 secs: 500 bytes ==> /
HTTP/1.1 200 0.95 secs: 500 bytes ==> /
HTTP/1.1 200 0.66 secs: 500 bytes ==> /
HTTP/1.1 200 0.67 secs: 500 bytes ==> /
HTTP/1.1 200 0.98 secs: 500 bytes ==> /
HTTP/1.1 200 0.98 secs: 500 bytes ==> /
HTTP/1.1 200 1.18 secs: 500 bytes ==> /
HTTP/1.1 200 0.68 secs: 500 bytes ==> /
HTTP/1.1 200 0.83 secs: 500 bytes ==> /
HTTP/1.1 200 0.80 secs: 500 bytes ==> /
HTTP/1.1 200 0.85 secs: 500 bytes ==> /
HTTP/1.1 200 0.73 secs: 500 bytes ==> /
HTTP/1.1 200 0.45 secs: 500 bytes ==> /
HTTP/1.1 200 0.78 secs: 500 bytes ==> /
HTTP/1.1 200 0.56 secs: 500 bytes ==> /
HTTP/1.1 200 0.62 secs: 500 bytes ==> /
HTTP/1.1 200 0.73 secs: 500 bytes ==> /
done.
Transactions: 25 hits
Availability: 100.00 %
Elapsed time: 4.28 secs
Data transferred: 0.01 MB
Response time: 0.78 secs
Transaction rate: 5.84 trans/sec
Throughput: 0.00 MB/sec
Concurrency: 4.53
Successful transactions: 25
Failed transactions: 0
Longest transaction: 1.18
Shortest transaction: 0.45
The Failed transactions, Response time, and Longest and Shortest transactions statistics can be used to profile a website, and to get an accurate picture of the time it takes to process a transaction. Siege also allows you to define a slew of URLs in a file called urls.txt, which will be processed during a connection from each user. I would like to thank Jeffrey Fulmer for writing the software! Make sure to check out his article in this month’s SysAdmin magazine.