ScaleScaleScaleScale

Tips / Nginx


Nginx Benchmarking using Siedge

benchmark nginx

Siege, is a Benchmarking tool like the famous Apache Benchmark, that will help you to do some stress tests over your Nginx web server. It provides a very large number of configuration options like concurrency users, predefined time and much more. Siege is ideal to test your server to see how much traffic it can support, how it will react and of course, to detect performance improvements when you apply changes to your websites. Some other features are:

  • Support for HTTP/HTTPS / Basic authentication
  • Support for POST and GET HTTP methods, Cookies and transaction logging
  • Support for multiple URL benchmarking
  • HTTP Headers extraction

Let’s begin with the installation

If you are using CentOS/Fedora use this method:

yum install siege

If you are using Ubuntu or Debian

apt-get install siege

Otherwise, you can install from source:

Download latest Siege from http://download.joedog.org/siege/, example:

wget http://download.joedog.org/siege/siege-3.0.6.tar.gz
tar -xvpzf siege-3.0.6.tar.gz
cd siege-3.0.6/
./configure
make
make install

Benchmarking Nginx with Siege

siege -q -t10s http://www.scalescale.com/tips/nginx

The -t option specifies the time you want siege to run the benchmarks, on this example we used 10 seconds. You can also add the -c option, which will add the posibility to use concurrent connections, on this example

[user@localhost ~]$ siege -q -c5 -t15s http://www.scalescale.com/tips/nginx

Lifting the server siege... done.

Transactions: 67 hits
Availability: 100.00 %
Elapsed time: 14.59 secs
Data transferred: 0.28 MB
Response time: 0.55 secs
Transaction rate: 4.59 trans/sec
Throughput: 0.02 MB/sec
Concurrency: 2.54
Successful transactions: 67
Failed transactions: 0
Longest transaction: 0.74
Shortest transaction: 0.51

FILE: /home/user/siege.log
You can disable this annoying message by editing
the .siegerc file in your home directory; change
the directive 'show-logfile' to false.

There are many options that you may use:

siege --help

Output:

[user@localhost ~]$ siege --help
SIEGE 3.0.1-beta4
Usage: siege [options]
siege [options] URL
siege -g URL
Options:
-V, --version VERSION, prints the version number.
-h, --help HELP, prints this section.
-C, --config CONFIGURATION, show the current config.
-v, --verbose VERBOSE, prints notification to screen.
-q, --quiet QUIET turns verbose off and suppresses output.
-g, --get GET, pull down HTTP headers and display the
transaction. Great for application debugging.
-c, --concurrent=NUM CONCURRENT users, default is 10
-i, --internet INTERNET user simulation, hits URLs randomly.
-b, --benchmark BENCHMARK: no delays between requests.
-t, --time=NUMm TIMED testing where "m" is modifier S, M, or H
ex: --time=1H, one hour test.
-r, --reps=NUM REPS, number of times to run the test.
-f, --file=FILE FILE, select a specific URLS FILE.
-R, --rc=FILE RC, specify an siegerc file
-l, --log[=FILE] LOG to FILE. If FILE is not specified, the
default is used: PREFIX/var/siege.log
-m, --mark="text" MARK, mark the log file with a string.
-d, --delay=NUM Time DELAY, random delay before each requst
between 1 and NUM. (NOT COUNTED IN STATS)
-H, --header="text" Add a header to request (can be many)
-A, --user-agent="text" Sets User-Agent in request
-T, --content-type="text" Sets Content-Type in request

On this examples I used this to benchmark nginx performance, but you can use Siege to benchmark almost any kind of webserver, not just only Nginx. Feel free to test it, explore all it’s options and share your thoughts.

Popular search terms:

  • https://www scalescale com/tips/nginx/nginx-benchmarking-using-siedge/
  • nginx stress test
  • nginx stress test tool
  • nginx benchmark concurrent connection
profile

Esteban Borges

Linux Geek, Webperf Addict, Nginx Fan. CTO @Infranetworking

  • Thomas Ling

    what software did you use to graph the results of your tests ?

    • admin

      I took the graphic from my machine, didn’t know where it was generated, it was used just as an example for this post.

      I’m looking for the same, a good graphic generator for benchmarks. If in the future you discover some tool to do it, please let me know.

      • Christopher

        did you found such a graphic generator ? 🙂