It is essential to know how much traffic a web server can handle under stress for future planning. As a developer and IT professional, load testing is the most crucial task to determine the capacity of a website and infrastructure. There are many load testing tools available today such as jMeter, gatling, Apache bench, Siege etc.
Siege is one of the popular HTTP load testing and benchmarking utility tool to measure the performance of web servers under stress. It can be used to evaluate response time of the web server, transaction rate, data transferred, concurrency and throughput.
In this context, we shall look into how to use siege to test load on the web server.
How to install Siege Load testing tool ?
Follow the steps below to install the utility tool in the Linux system.
On Ubuntu / Debian, run the below command:
$ apt install siege
For RHEL / CentOS system, execute:
$ yum install epel-release
$ yum install siege
To compile and install siege from source code, do the below steps.
i. Install build-essential and development packages to build the source code:
$ apt install build-essential [Ubuntu/Debian]
$ yum install groupinstall ‘Development Tools’ [CentOS/RHEL]
ii. Download the siege source code using wget command:
$ wget http://download.joedog.org/siege/siege-latest.tar.gz
iii. Extract the source code using tar command:
$ tar -xvzf siege-latest.tar.gz
iv. Build the application using the following command.
$ cd siege-*/
$ ./configure --prefix=/usr/local --with-ssl=/usr/bin/openssl
$ make && make install
How to configure Siege Load testing tool ?
Once the installation is completed, now we need to adjust siege configuration. Run the following command if you have built the package from the source code:
The configuration file is located at the user's home directory ~/.siege/siege.conf. Use the following command to find the content of the configuration file.
$ cat siege.conf | egrep -v "^$|#"
With the current configuration, a number of concurrent users specified will be initiated to test the load on the web server.
How to test website load testing using Siege tool ?
Using siege is very simple and easy. Just specify the name of the website and run the command as:
$ siege linuxapt.com
Here, the number of concurrent users being used for 1 minute will be displayed. If the availability remains 100% without any connection issues, then the web server is in good condition. Also note the response time and successful transactions to evaluate the web server capacity to handle the traffic.
How to perform Load testing on multiple websites ?
Sometimes you may need to run load tests on multiple URLS at a time. For this, create a text file containing urls and execute siege command specifying filename as:
$ cat urls.txt
$ siege -f /root/urls.txt
Siege provides many command line options to use different settings while performing load tests:
- -c – The number of concurrent users.
- -b – No delays between the requests.
- -l – Log file.
- -H – Add a header to request.
- -r – Number of time to run the test.
- -f – Test URLS from the specified file.
- -t – How much time to run the test.