Load Testing Web Servers with Siege Benchmarking Tool

Knowing how much traffic your web server can handle when under stress is essential for planning future grow of your website or application. By using tool called siege, you can run a load test on your server and see how your system performs under different circumstances.

You can use siege to evaluate the amount of data transferred, response time, transaction rate, throughput, concurrency and how many times the server returned responses. The tool has three modes, in which it can operate – regression, internet simulation and brute force.

Important: Siege should only be ran against servers you own or on such you have explicit permission to test. In some countries, using siege on unauthorized websites can be considered a crime.

Installing Siege HTTP Load Testing Utility in Linux

Siege is multi platform and can be installed under Ubuntu/Debian and CentOS/RHEL distributions using following commands.

To install Siege under Debin/Ubuntu, you can run:

$ sudo apt install siege

For CentOS/RHEL, you need to install and enable repository to install siege with:

# yum install epel-release
# yum install siege

Alternatively, you can build the Siege from source. For that purpose you will need to have build-essential and development packages installed.

$ sudo apt install build-essential       #Ubuntu/Debian
# yum groupinstall 'Development Tools'   #CentOS/RHEL

Then you can download Siege using wget command and install from sources as shown.

$ wget http://download.joedog.org/siege/siege-latest.tar.gz
$ tar -zxvf siege-latest.tar.gz
$ cd siege-*/
$ sudo ./configure --prefix=/usr/local --with-ssl=/usr/bin/openssl
$ sudo make && make install

Configuring Siege HTTP Load Testing Utility in Linux

Once you have completed the installation, you can adjust your siege configuration file. It is located in /etc/siege/siegerc. In case you have decided to build the package from source, you will have to run:

$ sudo siege.config

This will generate siege.conf file located in your user’s home ~/.siege/siege.conf.

The contents of the file should look something like this. Note that I have uncomment the logfile and time directives:

# cat siegerc |egrep -v "^$|#"
Sample Output
logfile = $(HOME)/var/log/siege.log
verbose = false
color = on
quiet = false
show-logfile = true
logging = false
gmethod = HEAD
parser = true
nofollow = ad.doubleclick.net
nofollow = pagead2.googlesyndication.com
nofollow = ads.pubsqrd.com
nofollow = ib.adnxs.com
limit = 255
protocol = HTTP/1.1
chunked = true
cache = false
connection = close
concurrent = 25
time = 1M
delay = 0.0
internet = false
benchmark = false
accept-encoding = gzip, deflate
url-escaping = true
unique = true

With the current configuration, siege will imitate 25 concurrent users over 1 minute.

You are now ready to run your siege.

Testing Website Load with Siege Benchmarking Utility

Running siege is quite easy, you only need to specify the website you wish to test like this:

# siege example.com
Web Server Load Testing with Siege

Web Server Load Testing with Siege

If the availability remains at 100% and there are no failed connections, your system did well and there were no issues. You should also keep an eye on the response time.

Run Siege Against Multiple Websites

You can test multiple URLs, by setting siege to read them from file. You can describe the URLs in /usr/local/etc/urls.txt like this:

Multiple Web server Load Testing

Multiple Web server Load Testing

Now to tell siege to test the URLs from the file, use the -f option like this:

# siege -f /usr/local/etc/urls.txt

You can also use command line options, if you want to try different settings from the ones described in the configuration file.

  • -C – specify your own configuration file.
  • -q – suppresses siege‚Äôs output.
  • -g – GET, pull down HTTP headers and display the transaction. Useful for debugging.
  • -c – the number of concurrent users, default is 10.
  • -r – how many times to run the test.
  • -t – how much time to run the test. You can specify S, M, or H ex: –time=10S for 10 seconds.
  • -d – random delay before each request.
  • -b – no delays between requests.
  • -i – user simulation. Uses to hit random URLs.
  • -f – test URLs from specified file.
  • -l – log file.
  • -H – Add a header to request.
  • -A – specify a user agent.
  • -T – Sets Content-Type in request.
  • --no-parser – NO PARSER, turn off the HTML page parser.
  • --no-follow – do not follow HTTP redirects.
Conclusion

Siege is a powerful tool to measure your system reliability when under high load. It can be used by web developers to test their code when site is under duress. You should always run your tests with caution as the tested server may become inaccessible during the evaluation.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

Marin Todorov

I am a bachelor in computer science and a Linux Foundation Certified System Administrator. Currently working as a Senior Technical support in the hosting industry. In my free time I like testing new software and inline skating.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

2 Responses

  1. Daniel says:

    Error
    /usr/bin/siege.config: cannot create /home/daniel/.siege/siege.conf: Directory nonexistent
    New configuration template added to /home/daniel/.siege

  2. dirk says:

    does this support https?

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.