Ubuntu

How to install Siege on Ubuntu

Siege is an open-source regression test and benchmark utility used to stress test a website URL with several simulated users accessing a website. Developers can check the performance of their code using Siege. It works by hitting a web server simultaneously with many concurrent users. These users put the webserver under stress for a configurable period or until a manual interrupts the user running the Siege program.

What will we cover?

In today’s guide, we will learn about the Siege benchmarking tool. We will see how to install and use it with Ubuntu 20.04. Let us quickly learn the basic overview of Siege.

Attention: Please read the note below before attempting to run this guide in a real-life environment:

“ It should be noted that Siege is a stressing tool as such it generates a heavy load on the server it is targeted to; hence you should not use it against any website or server without the owner’s permission. If you do so, you may put yourself in trouble as you have illegally DDoSed a third website or server without their consent.”

Performance Metrics of Siege

Critical performance metrics for analysis provided by Siege benchmarking tool can be broadly classified as:

Availability: It gives the percentage of socket connections which the server has successfully handled. It is calculated by the number of socket failures (including timeouts) divided by the total of all connection requests. The result does not comprise 400 and 500 range server errors included in “Failed transactions”.

Total Transactions: It is the number of server hits. By default, there are 25 simulated users, each of which strikes the target server 10 times, giving 250 transactions. The number of transactions can exceed the number of strikes because Siege computes every server strike a transaction, i.e., redirections and authentication strikes are computed as two hits. Siege sticks to the HTTP specification, and it emulates the behavior of a browser.

Response Time: It is the average time taken for responding to the requests of each simulated user.

Transaction Rate: It is the average number of transactions the server can handle in a duration of a second or transactions divided by total time passed.

Throughput: It is defined as the mean number of bytes transmitted per second by the server to every simulated user.

Successful Transactions: It is the number of times the server acknowledged with a return code smaller than 400.

Failed Transactions: It is the number of times the server acknowledged with a return code greater than or equal to 400, including all the failed socket transactions with socket timeouts.

Elapsed Time: It is the duration for which the Siege tool runs the test. It is calculated from the time the Siege is started till a simulated user finishes its transactions.

Data Transferred: The total amount of data transferred to every simulated user of the Siege test. It comprises the header information and content of the data packet.

Concurrency: It is the mean number of concurrent connections. It increases as server performance decreases.

Longest transaction: It is the longest time that a single transaction can take from among all the transactions.

Shortest transaction: It is the shortest time that a single transaction can take from among all the transactions.

Installing Siege on Ubuntu 20.04

  1. To install Siege on your system, first update the repository lists:
  2. sudo apt update -y
  3. Now install Siege from Ubuntu’s default repository using:
  4. sudo apt install siege -y

  5. To check the installed version of Siege, use the command:
  6. siege --version

Using Siege

The syntax for using siege is:

  1. siege [options]
  2. siege [options] [url]
  3. siege -g [url]

Siege has many command-line options, as shown in the table below.:

-V or –version Outputs the version number
-h or –help/td>

Prints the summary of all command-line options.
-C or –config Displays the configuration present in $HOME/.siegerc file.
-v or –verbose Provides verbose on-screen output like HTTP return status and GET request.
-b or –benchmark YBenchmarking test is done with zero delays.
-t or –time GUsed to specify the duration of time for a test
–reps GUsed for specifying the number of times you want to repeat a test.

Experimental Setup

Let us deploy an Apache web server on one of the machines (With IP address 192.168.42.216) and run a Siege test against it from another machine.

  1. In its simplest way, we can run the Siege test on a web server by simply using the server’s IP address or its domain name. It will run the test with the default configuration as shown below:
  2. sudo siege 192.168.42.216

  3. To run the test for 40 seconds, use the format below:
  4. sudo siege -t40S http://192.168.42.216

  5. To run the test for 30 concurrent users, use the format below:
  6. sudo siege -c30 http://192.168.42.216

  7. To run the test for 40 seconds and 30 concurrent users, use the format below:
  8. sudo siege -t40S -c30 192.168.42.216

Conclusion

In this guide, we learned about installing and using the Siege benchmarking tool. Try to explore more possibilities with Siege by using different options.

About the author

Ali Imran Nagori

Ali imran is a technical writer and Linux enthusiast who loves to write about Linux system administration and related technologies. You can connect with him on LinkedIn
.