How to Install Siege Benchmarking Tool on Ubuntu 22.04 LTS

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 Ubuntu 22.04 LTS Jammy Jellyfish, along with some basic commands on testing the limits of your servers using the command line terminal.

Update Ubuntu

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

By default, Ubuntu 22.04 has Siege in its default repositories. To install the software, use the following command.

sudo apt install siege -y

Next, confirm the version installed.

siege --version
How to Install Siege Benchmarking Tool on Ubuntu 22.04 LTS

How to Configure Siege

First, get to know the command commands and what they mean.

-V,               --version VERSION, prints the version number.
-h,               --help HELP, prints this section.
-C,               --config CONFIGURATION, show the current config.
-v,               --verbose VERBOSE, prints notification to screen.
-q,               --quiet QUIET turns verbose off and suppresses output.
-g,               --get GET, pull down HTTP headers, and display the transaction. Great for application debugging.
-p,               --print PRINT, like GET only it prints the entire page.
-c,               --concurrent=NUM CONCURRENT users, default is 10
-r,               --reps=NUM REPS, number of times to run the test.
-t,               --time=NUMm TIMED testing where "m" is modifier S, M, or H
ex:               --time=1H, one hour test.
-d,               --delay=NUM Time DELAY, random delay before each request
-b,               --benchmark BENCHMARK: no delays between requests.
-i,               --internet INTERNET user simulation, hits URLs randomly.
-f,               --file=FILE FILE, select a specific URLS FILE.
-R,               --rc=FILE RC, specify an siegerc file
-l,               --log [=FILE] LOG to FILE. If FILE is not specified, the default is used: /var/log/siege.log
-m,               --mark="text" MARK, mark the log file with a string. between .001 and NUM. (NOT COUNTED IN STATS)
-H,               --header="text" Add a header to request (can be many)
-A,               --user-agent="text" Sets User-Agent in request
-T,               --content-type="text" Sets Content-Type in request
-j,               --json-output JSON OUTPUT, print final stats to stdout as JSON
--no-parser       NO PARSER, turn off the HTML page parser
--no-follow       NO FOLLOW, do not follow HTTP redirects

So, the command syntax for using Siege will be similar to the below.

siege options URL

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 located on line 19.

Example:

How to Install Siege Benchmarking Tool on Ubuntu 22.04 LTS

Next, save the file (CTRL+O) and then (CTRL+X) 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 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.

Example:

How to Install Siege Benchmarking Tool on Ubuntu 22.04 LTS

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

In the configuration file, you can edit the time, concurrent users, data, and 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 numerous siege feature in the following file /etc/siege/urls.txt

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+O) then (CTRL+X) to exit.

To execute the multiple website stress test execute the following:

siege -f /etc/siege/urls.txt

Comments and Conclusion

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 method is correct for you.



Follow LinuxCapable.com!

Like to get automatic updates? Follow us on one of our social media accounts!