How to use the stress test tool siege

Siege is a stress test tool for web systems under linux. It supports multiple links, supports get and post requests, and can perform stress tests on web systems with continuous requests under multiple concurrent conditions.

Install Siege

01
02
03
04
#tar -xzvf siege-latest.tar.gz
#./configure; make
#make install

Common parameters of Siege command

-c 200 specifies the number of concurrent 200
-r 5 specifies the number of tests 5
-f urls.txt specifies the file of the url
-i internet system, randomly sends the url
-b request does not need to wait for delay=0
-t 5 continues the test for 5 minutes
# -r and -t are generally not used at the same time

Examples of commonly used siege commands

# 200 concurrent requests to http://www.google.com 100 times

01
siege -c 200 -r 100 http: //www .google.com

# List all URLs in urls.txt

01
siege -c 200 -r 100 -f urls.txt

# Randomly select all URLs listed in urls.txt

01
siege -c 200 -r 100 -f urls.txt -i

# delay=0, more accurate stress tests, not functional tests

01
siege -c 200 -r 100 -f urls.txt -i -b

# Specify the http request header document type

01
siege -H "Content-Type:application/json" -c 200 -r 100 -f urls.txt -i -b

Description of Siege output results

Transactions: The total number of tests
Availability: The percentage of successful times
Elapsed time: How many seconds did it take in total
Data transferred: The total data transfer
Response time: The time it takes to wait until the response
Transaction rate: The average number of requests processed per second
Throughput: The throughput rate
Concurrency: The highest concurrent
Successful transactions : Number of successful requests
Failed transactions: Number of failed requests

Some summaries of Siege use

1. When sending a post request, the url format is: http://www.xxxx.com/ POST p1=v1&p2=v2
2. If the url contains spaces and Chinese, url encoding must be performed first, otherwise the request url sent by siege will not be precise

Add to

siege -C can view the relevant configuration parameters, which can be modified by yourself, such as whether to display the log, timeout time

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326699030&siteId=291194637