Web Application testing – install Siege on Linux (or Mac OSx)

Siege is a great tool for performance and load testing your web application. I’ve been using it for the past 6 months to test WordPress websites along with other web apps that we’ve been building.

Use it to straighten out any kinks with applications like WordPress, learn if you’re server and database is flakey or prove that your CDN is super.

Siege testing vs Apache Benchmark

If you’ve used Apache Benchmark in Mac OSx or Linux then you’ll already have an idea what Siege can do. Siege is better then AB as you can create a user journey for it to follow or give it a list of pages on your website to randomly hit. The configuration file gives you a lot lot lot more then AB.

Siege testing is not load testing

Nothing beats a good Siege – but in reality if you really want to put your site under stress then you’ll need to switch to your own server setup with jMeter or checkout Blazemeter.

Finally .. you might as well give up on performance testing with Siege or Apache benchmark if you Siege server and Web App are on the same internal network / IP address range / co-located in the same data-centre.

Running Siege

Once you’ve started using Siege you won’t look back. It’s quite verbose and it’s great to watch it running through its test.

DAMIEN-RED:~ damien$ siege -c 10 http://damien.co
** SIEGE 2.70
** Preparing 10 concurrent users for battle.
The server is now under siege...
HTTP/1.1,302, 0.60, 28,/,1,2012-01-25 21:59:53
HTTP/1.1,302, 0.60, 28,/,1,2012-01-25 21:59:53
HTTP/1.1,302, 0.60, 28,/,1,2012-01-25 21:59:53
HTTP/1.1,302, 0.63, 28,/,1,2012-01-25 21:59:53
HTTP/1.1,302, 0.66, 28,/,1,2012-01-25 21:59:53
HTTP/1.1,302, 0.69, 28,/,1,2012-01-25 21:59:53
HTTP/1.1,200, 0.05, 7146,/steven-mackintosh-the-changing-man/,1,2012-01-25 21:59:54
HTTP/1.1,200, 0.20, 7146,/steven-mackintosh-the-changing-man/,1,2012-01-25 21:59:54

and at the end … Siege gives you a nice sumary

Lifting the server siege... done.
Transactions: 534 hits
Availability: 91.60 %
Elapsed time: 84.10 secs
Data transferred: 1.83 MB
Response time: 3.41 secs
Transaction rate: 6.35 trans/sec
Throughput: 0.02 MB/sec
Concurrency: 21.65
Successful transactions: 537
Failed transactions: 49
Longest transaction: 29.90
Shortest transaction: 0.05

How to Install Siege

Centos

If you’re on the latest Centos with yum install you need to type

sudo yum install siege

Ubuntu

If you’re on the latest Centos with yum install you need to type

sudo apt-get install siege

Get started with Siege

From your CLI / Terminal you’ll want to generate a config file

siege.config

this generates a hidden config settings file. Then you’ll use your favourite editor to change Siege the way you like it.

nano .siegerc

The I suggest you put something under Siege

siege -c 10 http://example.com

This will generate a performance test up to 10 consecutive users. Remember some websites struggle to get more than 2 consecutive users so go easy.

Hints: Making things tough

  1. Follow the User Manual and create a urls.txt file with a list of pages on your website.
  2. Make sure you have Webmin or Munin running so you can visualise the pain you’re inflicting on your poor web app.
  3. Run the siege for 60 minutes with something like 20 users.
  4. Run the siege for 200, 500, 1000 consecutive users. Watch your server load average go up and your free memory disappear.

Linkage

Tags: , , , ,