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. In this article, we will learn how to use siege to test load on the web server.
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.
Installing Siege Load testing tool
Installation of siege benchmarking tool is a simple and easy process. Follow the steps below to install the utility tool in the Linux system.
Ubuntu/Debian
$ apt install siege
RHEL/CentOS
$ yum install epel-release $ yum install siege
Install from source code
If you want to compile the source code and install the application in the Linux system, follow the steps below.
Install build-essential and development packages to build the source code.
$ apt install build-essential [Ubuntu/Debian] $ yum install groupinstall ‘Development Tools’ [CentOS/RHEL]
Download the siege source code using wget command.
$ wget http://download.joedog.org/siege/siege-latest.tar.gz
Extract the source code using tar command
$ tar -xvzf siege-latest.tar.gz
Build the application using the following command.
$ cd siege-*/ $ ./configure --prefix=/usr/local --with-ssl=/usr/bin/openssl $ make && make install
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.
$ siege.config
Output:
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, 25 concurrent users will be initiated to test the load on the web server.
Testing 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 linuxways.com
Output:
In this example, 5 concurrent users are being used for 1 minute. 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.
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
Output:
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
Conclusion
In this article, we learned how to test load in web servers using siege benchmarking tools. Also I have covered how to test load on multiple websites creating url files using siege benchmarking tool.