Share your love
How To Install Siege on Ubuntu 22.04
In this tutorial, we want to teach you How To Install and Use Siege Stress Tester on Ubuntu 22.04.
If you’re a web admin, one of your constant challenges is optimizing sites so they perform their best. After all, a slow website could easily turn off clients and customers. To optimize those sites, you might want to first benchmark them to know how well (or poorly) they perform.
One tool to help you benchmark your websites is the command-line application, Siege. Siege performs web server load testing and gives you complete details for:
- The number of hits recorded
- Amount of bytes transferred
- Response time
- Concurrency
- Return status
Siege also supports both the HTTP/1.0 and 1.1 protocols, the GET and POST directives, cookies, transaction logging, and basic authentication.
Install and Use Siege Stress Tester on Ubuntu 22.04
To complete this guide, you must log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide on Initial Server Setup with Ubuntu 22.04.
Install Siege Stress Tester on Ubuntu 22.04
First, you need to update and upgrade your local package index with the command below:
sudo apt update && sudo apt upgrade
Siege is available in the default Ubuntu 22.04 repository. So you can install Siege with the following command:
sudo apt install siege -y
At this point, you can verify your Siege installation by checking its version:
siege --version
Output
...
SIEGE 4.0.7
Copyright (C) 2018 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 Stress Tester on Ubuntu 22.04
At this point, you need to make some configuration changes to the Siege config file. The main option you will need to change is the log path.
Open the file with your favorite text editor, here we use vi editor:
sudo vi /etc/siege/siegerc
At this point, find the line below and uncomment it by removing the # from the beginning of the line:
logfile = $(HOME)/var/log/siege.log
When you are done, save and close the file.
Common Options of Siege
These are some useful options for Siege on Ubuntu 22.04:
- -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 helpful information.
- -l: It is used to generate a log file.
How To Use Siege Stress Tester
At this point, you can test your web server, do note this will pretty much look like a DDOS attack on 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, you can use the siege command on Ubuntu 22.04 and test the default amongst workers, which is 25 for one minute, by specifying -t 1m
as shown below:
siege https://www.example.com -t 1m
Also, 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
Another feature of Siege is to manage multiple domains on Ubuntu 22.04. First, open the following file with your favorite text editor, here we use vi:
sudo vi /etc/siege/urls.txt
At this point, add the URLs you want to be benchmark tested, for example:
https://www.example.com
https://www.example2.com
http://192.168.50.1
When you are done, save and close the file.
Also, you can execute the multiple website stress test on Ubuntu 22.04 by running the following command:
siege -f /etc/siege/urls.txt
For more information, you can visit the JoeDog page.
Conclusion
At this point, you have learned to Install and Use Siege Stress Tester on Ubuntu 22.04.
Hope you enjoy it.
Also, you may be like these articles:
How To Install Homebrew on Ubuntu 22.04