Siege a simple load testing and benchmarking tool
Siege is simple load testing and benchmarking tool. Siege support GET and POST method to test your webservers through cookies, HTTP , HTTPS and FTP protocols. You can test single or multiple web urls in a single test .
Installation on Linux :
Download latest version Siege from official website https://www.joedog.org/siege-home/. Current latest version is “siege-3.1.0” or https://www.joedog.org/pub/siege/siege-latest.tar.gz
Copy siege files into your project directory and compile it. In below example I have installed it under siege directory.
$ mkdir siege $ wget http://download.joedog.org/siege/siege-3.1.0.tar.gz $ tar zxvf siege-3.1.0.tar.gz $ cd siege-3.1.0 $ ./configure $ make $ make install
If you have successfully installed siege then check your installation using “siege -C”
CURRENT SIEGE CONFIGURATION Mozilla/5.0 (unknown-x86_64-linux-gnu) Siege/3.1.0 Edit the resource file to change the settings. ---------------------------------------------- version: 3.1.0 verbose: true quiet: false debug: false protocol: HTTP/1.1 get method: HEAD proxy-host: ec2-52-8-80-160.us-west-1.compute.amazonaws.com proxy-port: 3924 connection: close concurrent users: 15 time to run: n/a repetitions: n/a socket timeout: 30 accept-encoding: gzip delay: 1.000 sec internet simulation: false benchmark mode: false failures until abort: 1024 named URL: none URLs file: /usr/local/etc/urls.txt logging: true log file: /home/prod/siege/logs/siege.log resource file: /usr/local/etc/siegerc timestamped output: false comma separated output: false allow redirects: true allow zero byte data: true allow chunked encoding: true upload unique files: true
Usages :
Test Single Url:
siege -u www.domain.com -d1 -r10 -c10
Parameter Details
-d1 => Delay 1 second
-c10 => Number of concurrent request. (i.e 10)
-r10 => Number of repetition. (i.e. 10)
If we don’t pass -u then it will take url from default url directory (/usr/local/etc/urls.txt). You can check default directory by “siege -C”.
Output:
** SIEGE 3.1.0 ** Preparing 5 concurrent users for battle. The server is now under siege...done Transactions: 100 hits Availability: 100.00 % Elapsed time: 7.19 secs Data transferred: 4.36 MB Response time: 0.02 secs Transaction rate: 13.91 trans/sec Throughput: 0.61 MB/sec Concurrency: 0.32 Successful transactions: 100 Failed transactions: 0 Longest transaction: 0.08 Shortest transaction: 0.00
Test Multiple URL:
Siege has support to test multiple url. Put all test url in siege url.txt default url.txt location is /usr/local/etc/urls.txt. You can verify siege url.txt location by using “siege -C”. Now you don’t need to pass -u parameter in siege command.
siege -d1 -r10 -c10
Example url.txt file
http://domain1.cmm/dir/file http://domain2.cmm/dir/file http://domain3.cmm/dir/file
Test random url with [-i] parameter
siege -d1 -i -r10 -c10
Siege Parameter
-V –version VERSION, prints version number to screen.
-h –help HELP, prints this section.
-v –verbose VERBOSE, prints notification to screen.
-c –concurrent=NUM CONCURRENT users, default is 10
-u –url=”URL” URL, a single user defined URL for stress testing.
-i –internet INTERNET user simulation, hits the URLs randomly.
-b –benchmark BENCHMARK, signifies no delay for time testing.
-t –times=NUM TIMES, number of times to run the test, default is 25
-t –time=NUMm TIME based testing where “m” is the modifier S, M, or H no space between NUM and “m”, ex: –time=1H, 1 hour test.
-f –file=FILE FILE, change the configuration file to file.
-l –log LOG, logs the transaction to PREFIX/var/siege.log
-m –mark=”text” MARK, mark the log file with a string separator.
-d –delay=NUM Time DELAY, random delay between 1 and num designed to simulate human activity. Default value is 3
POST METHOD in Siege
To test url with post parameter change url.txt like below
http://domain1.cmm/dir/file POST param1=value1 http://domain2.cmm/dir/file POST param1=value1¶m2=value http://domain3.cmm/dir/file POST param=value