I. Installation of siege
Two. Siege combat
- Siege Common parameters
- -c specifies concurrency
- -R Specifies the number of repetitions
- -D Specifies the delay time for the request, and note that the random delay between each request
- -f Specifies a URL list that can be given to multiple Site pressure
- -t Specifies the use case execution time, such as-T 10s -t 1M (H) and so on
- -G Get the requested headers information and print it, debug dedicated
- -h Specifies the requested headers information
- -L or--log=[file] Specifies the path of the test result
-
Requirement 1: Use siege to pressurize multiple pages
Use siege to pressurize multiple pages, and the concurrency number is 5, run 1 minutes
page url:http://ur.tencent.com/ Categories/7http://ur.tencent.com/categories/7/?page=2http://ur.tencent.com/categories/7/?page=3
On the virtual machine Ubuntu access to the above three connections, the number of concurrent is 5, continuous running 1 minutes
[email protected]:~/test$ siege-c 5-t 1m-f url.txtlifting the server siege ... done. transactions:345 hitsavailability:100.00%elapsed time:59.73 secsdata transferr ed:1.88 mbresponse time:0.36 secstransaction rate:5.78 trans/secthroughput: 0.03 mb/secconcurrency:2.10successful transactions:345failed Transactions:0longe St Transaction:27.16shortest transaction:0.21
Requirement 2: Save siege log
Save the log in Result.csv and open the Result.csv
[email protected]:~/test$ siege -c 5 -t 1M -f url.txt --log=result.csv[email protected]:~/test$ more result.csv Date & Time, Trans, Elap Time, Data Trans, Resp Time, Trans Rate, Throughput, Concurrent, OKAY, Failed2018-02-07 04:10:10, 160, 59.30, 0, 0.35, 2.70, 0.00, 0.95, 160, 4
Requirement 3: Enable gzip compression at time of pressure measurement
Accept-encoding is set to gzip, and the log is saved in Result_gzip.csv and opened Result_gzip.csv
[email protected]:~/test$ siege -c 5 -t 1M -f url.txt -H "Accept-Encoding:gzip" --log=result_gzip.csv[email protected]:~/test$ more result_gzip.csv Date & Time, Trans, Elap Time, Data Trans, Resp Time, Trans Rate, Throughput, Concurrent, OKAY, Failed2018-02-07 04:22:44, 197, 59.83, 1, 0.35, 3.29, 0.02, 1.14, 197, 3
Requirement 4: Pressure measurement on mobile site
Set User-agent as iphone to server
[email protected]:~/test$ siege -c 1 -r 1 -A "Apple-iPhone5C2/1001.525" http://www.baidu.comTransactions: 1 hitsAvailability: 100.00 %Elapsed time: 0.09 secsData transferred: 0.00 MBResponse time: 0.08 secsTransaction rate: 11.11 trans/secThroughput: 0.01 MB/secConcurrency: 0.89Successful transactions: 1Failed transactions: 0Longest transaction: 0.08Shortest transaction: 0.08