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.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

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.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

4 Comments

Leave a Reply
  1. Hello,

    What does this mean?

    $ cat siegerc |egrep -v "^$|#"
    

    I think it should be a siege.conf in the place of siegerc right ? or I am making mistake?

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

    Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.