Developers are always quite worried about how their web applications would perform once they are released in real time to general public. Once the site is rolled out, it may come down and crash due to sudden surge in the number of users, depicting DoS (Denial of Service) attack.
Wouldn’t it be nice to test and benchmark your web application while still in development phase and before moving to pre-production or production servers.
‘Siege‘ can do this grunt work for you.
Siege is a command line utility which exposes the performance related issues of web based applications. Siege simulates a real world scenario where a given number of users would be calling the url within a given short period of time.
For example, Siege can tell – “How will server perform if it is called by 100 users within a period of 10 seconds”.
Following are the features of Siege.
- Siege is an open source load testing and benchmarking utility.
- Siege can be used for HTTP/HTTPS and basic authentication based sites.
- What Siege does is that it actually creates real-world simulation of how the application will perform for given number of users over a given period of time.
- Siege supports GET, POST HTTP methods, Cookies and transaction logging.
- Siege can be used for extracting and checking the HTTP headers.
- Multiple urls can be tested simultaneously with Siege.
Siege can be installed on Linux (or other *nix), Solaris, Mac systems. Currently there is no installer for Windows (as its written on GNU/Linux) but Windows based server urls can be tested.
Installing on Linux
You can download latest package distribution from its developer site.
Installing on Ubuntu
Siege comes as a standard packaged distribution for Ubuntu and its variants.
Installing on Mac
Siege can be installed on Mac OSX via homebrew
Open the Terminal app and type following command
Note: Use Siege only to test your application. Calling another web application url with high volume of request is treated as DoS attack on the server and is illegal.
The url can be tested using following command.
Siege utility can have following options.
- -cNUM : is to simulate the number of concurrent users (NUM count can be changed).
- -dNUM : is the duration in second to run the test. (NUM is in seconds)
- -rNUM : is the number of times the test can be repeated.
- -v : is the verbose mode. Transaction information is printed on the screen.
- -i : is the for internet. The requests are fired randomly between the number given in -d option.
- -f : is used if multiple urls are tested from file
Siege can be used to check the header of the site or webpage using following command.
Multiple urls can be tested by creating a file with the multiple urls separated by a line. The command is
Web App Performance Results
The result is printed as shown below. The url in the command is masked. You can replace it with the url to be tested.
The various parameters in the output can be analysed to check the performance of the server against the values provided. At start, keep the values of -c and -d options low and then increment them linearly, observing the ‘Failed Transactions’ count. The maximum values used till the ‘Failed Transactions’ changes to non-zero can be treated as the threshold values for the application and the server.
Do not keep the values for -c,-d or -r options high in the beginning as this may flood the server with too many requests and finally resulting in its crash/failure.