How to Install and Use Siege Benchmarking Tool on Ubuntu 20.04
Siege is an open-source multi-threaded load testing and benchmarking tool for Linux. You can perform a stress test using a single URL with a specific number of users or you can put all URLs in files and. stress them simultaneously. It also allows you to test a web server with n number of users t number of times. Siege offers three modes of operation: Regression, internet simulation, and brute force.
In this tutorial, we will explain how to install Siege Benchmarking Tool on Ubuntu 20.04.
Prerequisites
- A server running Ubuntu 20.04.
- A root password is configured the server.
Getting Started
Before starting, update your system packages to the latest version. You can update them using the following command:
apt-get update -y
Once all the packages are updated, you can proceed to the next step.
Install Siege
By default, Siege is available in the Ubuntu 20.04 default repository. You can install it by just running the following command:
apt-get install siege -y
Once the Siege is installed, you can verify the installed version of Siege using the following command:
siege --version
You should see the following output:
SIEGE 4.0.4 Copyright (C) 2017 by Jeffrey Fulmer, et al. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Configure Siege
The default Siege configuration file is located at /etc/siege/siegerc. You will need to edit this configuration file and define your log file:
nano /etc/siege/siegerc
Uncomment the following line:
logfile = $(HOME)/var/log/siege.log
Save and close the file when you are finished.
Test a Single Website with Siege
You can use siege command by specifying any website to test the load as shown below:
siege test.example.com
You should see the following output:
Transactions: 57832 hits Availability: 99.95 % Elapsed time: 401.49 secs Data transferred: 706.55 MB Response time: 0.17 secs Transaction rate: 144.04 trans/sec Throughput: 1.76 MB/sec Concurrency: 24.35 Successful transactions: 57852 Failed transactions: 31 Longest transaction: 100.01 Shortest transaction: 0.00
Test Multiple Website with Siege
You can also test multiple websites by adding your website URLs in the file /etc/siege/urls.txt.
nano /etc/siege/urls.txt
Add your desired URLs as shown below:
http://example1.com www.example.com 192.168.0.2
Save and close the file when you are finished. Then, run the siege command by specifying your URL file as shown below:
siege -f /etc/siege/urls.txt
This will perform a stress test by reading all URLs one by one from the /etc/siege/urls.txt file.
Siege comes with a lot of options. A brief explanation of each is shown below:
- -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.
Conclusion
In the above article, you learned how to install Siege to benchmark your website performance. You can now use all options one by one with Siege and test the result.