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,
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.
Install Siege to Linux
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
Testing Command
siege -b -c=10 -t=5m "http://..."
Commands
Siege features a number of command line options to use when you want to deviate from the default configuration but do not wish to edit the file.
-c [num]
: Set the number of concurrent users. Most web servers have less than a couple hundred users trying to access their website at the same time, so setting this to more than a few hundred is often not needed.-t [num]
: Set a time limit for which Siege runs. Siege can run with the modifierss
for seconds,m
for minutes, orh
for hours. There should be no space between the number and the modifier (-t10s
not-t10 s
).-d [num]
: Set the delay for each Siege user. Each user is then delayed for a random amount of seconds in between 1 and the set number. The default value is 3.-i
: Used in conjunction with a URLs file, this causes each user to randomly hit one of the URLs, with no predetermined pattern. Similar to real life (the ‘i’ stands for “internet”), where you will not know where site visitors go, not all pages may be hit.-v
: Verbose output. This outputs the results Siege gets in real time before printing the final results.-f [file]
: Run Siege with a file containing a list of URLs that is not the defaulturls.txt
file.-g [url]
: Pull down the HTTP headers.-l
: Generates a log file.-m "[message]"
: Include a message in the log file.-C
: Outputs Siege’s current configuration profile.-V
: Outputs Siege’s version information.-h
: Outputs help information.