Siege is an excellent way to stress test a web environment and or application. Much more flexible and “real world” than AB (Apache Bench), and a great way to see if your Web Hosting provider is providing you what they say they are. Essentially Siege simulates real users visiting your website and you can configure how they visit, how long they visit, and where among other things. Be warned though sending a bunch of virtual users to “Siege” a site can essentially cause a DOS attack and get you in some trouble, so follow this guide and tips carefully.
Install Siege On Centos 7
yum update -y
yum install wget nano build-essential zlib zlib-devel libssl-dev openssl-devel -y
yum group install development tools
tar -zxvf siege-latest.tar.gz
make && make install
Siege should now be installed and almost ready to be used. If you are looking to simulate real world use than you will want to browse through your site and collect a list of different URL’s. I normally use anywhere from 10-20 for testing. You will need to create a txt file to store these urls in.
URLs should be in this format
Now that you have your file let’s make sure that siege.conf is setup correctly for real world testing.
limit = 255 This is default and if you need to go over 255 concurrent users you will need to adjust this. I usually set it to 3000.
parser = true This grabs things like .css files and images, this gives more real world performance results.
We are almost ready, we just need to do one more thing and that is increase ulimit or we will most likely get errors about too many open files. Default is 1024 and I usually boost this to 10000.
ulimit -n 10000
Now rather than specify common test settings in siege.conf we will invoke them in the run command as this allows us to change settings on the fly much easier. Here is a sample command:
siege -c50 -d3 -t30M -i -f /usr/local/etc/sample_urls.txt
This tells siege to send 50 concurrent users with a random access delay of 1-3 seconds for 30 minutes. -i means randomize url selection and -f tells it to read from the file specified.
That’s it you are ready to siege!
Siege Warning And Responsibility
Siege is a DOS attack when launched with many concurrent users and will take down websites and possibly even slow down or crash the webserver and or entire server. Use it responsibly and only on sites that you own or have permission to test. When running siege watch the test and if you see it start returning errors about unavailable (red text) than stop the test before you make a mess.
I take no responsibility for any damage or mess you might make, be careful!