
The amount of traffic that a web server can handle under stress is essential to planning the future growth of your website or application. You can run a load test on your server and see how your system works in different circumstances using a tool called Siege. In this article, we are going to teach you How to Install Siege on CentOS 7.
What is Siege?
Siege is an HTTP load testing and benchmarking tool that is open-source and multi-threaded. Siege is used to evaluate the amount of data transmitted, response time, throughput, currency, transaction rate, and the number of times the server has responded. You can test a web server with many users and multiple times. The siege has three operating modes, which are: Regression, Internet simulation, and brute force. A stress test can be performed using a URL with a certain number of users or all URLs can be placed in files and stressed at the same time. Siege supports basic authentication, cookies, HTTP, HTTPS, and FTP protocols.
How to Install Siege on CentOS 7
Before starting to install Siege, it should be mentioned that you need to have a Linux VPS server. To do this, we recommend that you choose from the plans available in NeuronVM.
First, you have to install and enable the repository with the help of the following command:
yum install epel-release
Now you can install Siege by entering the following command:
yum install siege
You need to install the necessary development packages to be able to build Siege from the source:
yum groupinstall 'Development Tools'
Next, you can download the Siege by entering the following command:
wget http://download.joedog.org/siege/siege-latest.tar.gz
tar -zxvf siege-latest.tar.gz
In this step, you need to cd the files into the folder and compile them. To do this run the following command:
cd siege-*/
sudo ./configure --prefix=/usr/local --with-ssl=/usr/bin/openssl
sudo make && make install
How to Configure Siege HTTP Load Testing Utility on CentOS 7
At first, you should execute the following command to build a package from the source:
sudo siege.config
The above command will generate siege.conf file located in your user’s home ~/.siege/siege.conf.
The contents of the file are as follows:
cat siegerc |egrep -v "^$|#"
Note that the log file and time instructions have been uncommented.
Output:
logfile = $(HOME)/var/log/siege.log verbose = false color = on quiet = false show-logfile = true logging = false gmethod = HEAD parser = true nofollow = ### nofollow = ### nofollow = ### nofollow = ### limit = 255 protocol = HTTP/1.1 chunked = true cache = false connection = close concurrent = 25 time = 1M delay = 0.0 internet = false benchmark = false accept-encoding = gzip, deflate url-escaping = true unique = true
Now Siege will imitate 25 concurrent users over 1 minute.
How to Test Website Load with Siege on CentOS 7
First, you should test your website to run Siege as follows:
siege example.com
If there is no failed connection, your system will work fine and there will be no issues.
How to Run Siege Against Multiple Websites on CentOS 7
You should set Siege to read multiple URLs from files to test them. To do this, you should describe the URLs in /usr/local/etc/urls.txt.
In this step, Siege should test the URLs from the file. To do this, enter the following command:
siege -f /usr/local/etc/urls.txt
Also, you can use command-line options to try different settings.
-C: Specify your own configuration file
-q: Suppresses siege’s output
-g: GET, pull down HTTP headers, and display the transaction
-c: The number of concurrent users is 10 by default
-r: How many times to run the test
-t: How much time to run the test
-d: Random delay before each request
-b: No delays between requests
-i: User simulation
-f: Test URLs from the specified file
-l: logfile
-H: Add a header to request
-A: Specify a user agent
-T: Sets Content-Type in the request
–no-parser: NO PARSER, turn off the HTML page parser
–no-follow: do not follow HTTP redirects
Conclusion
Siege is a powerful tool for measuring system reliability during high loading and can be used by web developers to test their code when the site is under duress. This article taught you, how to install Siege on CentOS 7. I hope this tutorial was useful for you.
FAQ
You should have a minimum of 1 GB ram, but 2 GB is recommended with a 1.1 GHz processor.