Load test your website with Siege
Stress
Monitoring the performance of a website and fixing performance issues is a day-to-day job for sys admins. Ignoring this part of the job could result in the loss of potential customers. Siege is an open source benchmarking tool that can greatly help you in this regard. Benchmarking tools [1] perform standardized tests for accessing the relative capabilities of hardware or software and evaluating their results.
Raison d'Stress
Siege puts your website under different stress conditions and then evaluates the following performance parameters, among others:
- Availability of the server
- Response time
- Number of successful and failed transactions
- Throughput
Siege developers define each parameter, which I talk about later in this article. Before getting your hands dirty, though, please read the "Important Note" box.
Important Note
Running Siege against third-party websites and servers without the consent of the owner is an illegal practice. Siege has a distributed denial-of-service (DDoSing) effect; as such, it can bring down a running server. This article is written only for educational purposes, and you alone are responsible for any damage caused by any misuse of this software.
Although running Siege does not require much expert knowledge, interpreting its result is what you should care about, and I will try to make that part simple. Running Siege requires sudo privileges, so be sure you have administrative access to your system. In this article, I provide instructions on how to use the Siege benchmarking tool to stress test a website hosted on an Ubuntu 20.04 server.
Why Care About Siege?
Your job as a software developer doesn't end until you are confident your code will be stable in the worst conditions. Surviving traffic spikes, system crashes, memory overuse, and so on are core milestones that software needs to achieve. Siege plays a vital role in checking the stability of your code in rush hour traffic conditions.
Siege checks the strength of your code by placing it under stress, so you will know whether your site can sail smoothly under scores of transactions or whether it will crash. In this way, you can estimate how much customer volume your website can withstand until it breaks.
Installing Siege
Siege can be installed two ways: from the official distribution package or from source code.
To install from the official Ubuntu repositories, open a terminal and execute the command:
sudo apt-get install siege -y
That's it. Siege is installed.
To install from the source code, download the latest
version of the file [2] and enter the following commands to extract the file (Figure 1), change to the extracted directory, run the configure
script (Figure 2), and complete the installation:
$ tar -xzf siege-latest.tar.gz $ cd siege-<version>/ $ ./configure $ sudo sh -c "make && make install"
That's it. Siege should now be installed on your system. To make sure everything is ready to go, enter:
$ siege -V
Next, you want to enable logging by opening the file siegerc
in Nano,
$ sudo nano /etc/siege/siegerc
and searching for the line:
#logfile = $(HOME)/var/log/siege.log
Simply remove the starting hash symbol (#
) to uncomment and save the file.
Buy this article as PDF
(incl. VAT)