Siege by Joe Dog Software is a great utility for quickly getting some useful data about the load handling capabilities of almost any web application. If you already have siege skip to the end where I lay out some usage tips.
If you need to Install Siege
Upgrade software (Debian apt):
sudo apt-get update && sudo apt-get upgrade
On Debian you can simply:
Extract the program:
tar -zxvf siege-latest.tar.gz
Change to Siege directory:
Configure and complete the install:
./configure make sudo make install
Generate a configuration file:
Let’s Run Siege
Running Siege is easy, try just the defaults along with your domain or IP address:
You should see some useful output. Now let’s set some variables and really stress the server. Two critical options that need to be set are the number of concurrent users (-c, default is 10) and the duration of the test in terms of either repetitive queries or time (-t). Let’s start with a simple example of 25 concurrent users for one minute.
siege -c25 -t1M www.example.com
** Siege 2.59 ** Preparing 25 concurrent users for battle. The server is now under siege... Lifting the server siege... done. Transactions: 406 hits Availability: 99.75 % Elapsed time: 59.66 secs Data transferred: 10340918 bytes Response time: 2.36 secs Transaction rate: 6.81 trans/sec Throughput: 173330.84 bytes/sec Concurrency: 16.07 Successful transactions: 412 Failed transactions: 1
Some of the other commonly used options for this would be –v (verbose) and –d to set a delay (the default is 0).
Another good tip is to use Siege to hit a number of pages on your website at random. Simply configure the program to read from a urls.txt file that lists the selected pages:
siege -f path/to/your/urls.txt
Happy sieging! Check out the official Siege manual for more information.