Siege is an open-source multi-threaded regression test and benchmark utility focusing primarily on load testing and benchmarking. It can stress test a single URL with a user-defined number of simulated users or read many URLs into memory and stress them simultaneously. The program reports the total number of hits recorded, bytes transferred, response time, concurrency, and return status.
In the following tutorial, you will learn how to install Siege Benchmarking Tool on Debian 11 Bullseye, along with some basic commands on testing the limits of your servers using the command line terminal.
Table of Contents
Before proceeding with the tutorial, it is good to ensure your system is up-to-date with all existing packages.
sudo apt update && sudo apt upgrade
Install Siege – APT Method
Debian 11 comes with Siege in its default repositories. To install the software, use the following command.
sudo apt install siege -y
Next, confirm the version installed.
How to Configure Siege
First, get to know the command commands and what they mean.
- -t : This option is used to set a time limit for which Siege runs.
- -c : This option is used to set the number of concurrent users.
- -d : This option is used to set the delay time for each user.
- -C : This option is used to specify your own configuration file.
- -i : It is used to hit random URLs.
- -T : It is used to set the Content-Type in requests.
- -h : It is used to display help information.
- -l : It is used to generate a log file.
Setting up Siege is quite simple, as most defaults are fine. The main option you will need to change is the log path.
First, open up the configuration file using nano editor:
sudo nano /etc/siege/siegerc
Find and uncomment the line
# logfile = $(HOME)/var/log/siege.log which should be on line 19.
Next, save the file
(CTRL+X) to exit.
Test Website with Siege (Live test)
Now it’s time to test your web server, do note this will pretty much look like a DDOS attack to some firewalls and WAF, so make sure to have permission before using any HTTP benchmarking tool. Ideally, it would be best not to use this except for your servers.
First, use the
siege command and test the default amongst of workers, which is 25 for one minute, by specifying
-t 1m as follows.
siege https://www.example.com -t 1m
This will stress test with the default 25 concurrent users for 1 minute. Once the benchmark is complete, you will see the results.
Note, typically, you would run for 5 to 15 minutes as 1 minute was just an example.
Next, another variable you may want to include is the number of workers, for example
-c 100 will add 100 workers.
siege https://www.example.com -c 100 -t 2m
Now in the configuration file, you can edit the time, concurrent users, data, timestamps if you have a specific test you run daily on your sites.
Test Multiple Websites with Siege
Another handy feature if you a sysadmin or managing multiple domains and sites is using the multiple siege feature in the following file
Open the file with nano:
sudo nano /etc/siege/urls.txt
Next, add the URLs you want to be benchmark tested:
https://www.example.com https://www.example2.com http://192.168.50.1
To save the file
(CTRL+X) to exit.
To execute the multiple website stress test execute the following:
siege -f /etc/siege/urls.txt
Comments and Conclusion
In the above small tutorial, you have learned how to install the HTTP benchmarking tool Siege for Debian 11 successfully.
Server performance is critical for a good user experience. With the Siege benchmarking tool, you can test the basics of server load testing and give you some tools to help identify potential problems before they impact your users. Siege can also be handy for cloud computes, with server load testing before buying a larger plan to find which plan is right for you.