brief introduction
Siege is a high-performance, open source HTTP stress testing tool designed to evaluate the stress tolerance of WEB applications. Siege supports authentication, cookies, HTTP, https and ftp protocols. According to the configuration, multiple users can access a WEB site concurrently, record the response time of all requests of each user, and repeat it under a certain number of concurrent accesses.
Siege can request random URL s from the preset list you choose, so siege can be used to simulate user request load, while ab cannot. But don't use siege to perform the highest performance benchmark tuning test. This aspect ab is much more accurate.
Siege supports multiple links, get and post requests, and can conduct multiple stress tests on the web system and send continuous requests.
- Siege official website: https://www.joedog.org/
- Siege Download: http://download.joedog.org/siege/siege-latest.tar.gz
- Github: https://github.com/JoeDog/siege
install
Extract and install:
-- yum Direct installation yum install -y siege -- You can also compile and install tar -zxvf siege-latest.tar.gz cd siege-4.1.1 ./configure --with-ssl=/usr/local/openssl make && make install [root@docker35 siege-4.1.1]# siege -h New configuration template added to /root/.siege Run siege -C to view the current settings in that file SIEGE 4.1.1 Usage: siege [options] siege [options] URL siege -g URL Options: -V, --version VERSION, prints the version number. -h, --help HELP, prints this section. -C, --config CONFIGURATION, show the current config. -v, --verbose VERBOSE, prints notification to screen. -q, --quiet QUIET turns verbose off and suppresses output. -g, --get GET, pull down HTTP headers and display the transaction. Great for application debugging. -p, --print PRINT, like GET only it prints the entire page. -c, --concurrent=NUM CONCURRENT users, default is 10 -r, --reps=NUM REPS, number of times to run the test. -t, --time=NUMm TIMED testing where "m" is modifier S, M, or H ex: --time=1H, one hour test. -d, --delay=NUM Time DELAY, random delay before each request -b, --benchmark BENCHMARK: no delays between requests. -i, --internet INTERNET user simulation, hits URLs randomly. -f, --file=FILE FILE, select a specific URLS FILE. -R, --rc=FILE RC, specify an siegerc file -l, --log[=FILE] LOG to FILE. If FILE is not specified, the default is used: PREFIX/var/siege.log -m, --mark="text" MARK, mark the log file with a string. between .001 and NUM. (NOT COUNTED IN STATS) -H, --header="text" Add a header to request (can be many) -A, --user-agent="text" Sets User-Agent in request -T, --content-type="text" Sets Content-Type in request -j, --json-output JSON OUTPUT, print final stats to stdout as JSON --no-parser NO PARSER, turn off the HTML page parser --no-follow NO FOLLOW, do not follow HTTP redirects Copyright (C) 2021 by Jeffrey Fulmer, et al. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Parameter details:
- -C. Or -- config prints and displays the current configuration on the screen. The configuration is included in the configuration file $home / In siegerc, you can edit the parameters so that every siege will run according to it
- -v detailed operation information can be seen during operation
- -C, N, or -- concurrent=n simulate that n users are accessing at the same time. N should not be set too large, because the larger the size, the more resources of the local machine are consumed by the siege. The number of concurrent users is 10 by default. Note: by default, the siege only supports 255 concurrent users. You can customize it and modify / root / siege/siege. limit value under conf.
- -i. -- random Internet access URLs Txt to simulate the real access situation (randomness), when URLs Txt is valid when it exists. Simulate network users to randomly click the URL
- -D, N, -- delay = n hit delay between each url, between 0-n
- -r n,--reps=n repeat the test n times, r and t cannot be used at the same time
- -t n,--time=n continuously run siege 'n' for seconds (e.g. 10S), minutes (10M), hours (10H)
- -l after running, save the statistical data to the log file siege Log, usually located in / usr / local / var / siege Log, or in Custom in siegerc
- -R SIEGERC,--rc=SIEGERC specifies to run with a specific siege configuration file. The default is $home / siegerc
- -f FILE, --file=FILE specifies to run siege with a specific urls file. The default is urls Txt, located in etc/urls.txt under the siege installation directory txt
- -5. -- version print version number
- -h. -- help print help information
- -g. -- get pull http header information
- -p. -- print prints the contents of the entire page
- -b. -- benchmark request has no delay
- -H. -- header = "text" add a header to a request. Multiple headers are supported
- -A. -- user agent = "text" set user agent for request
- -T. -- content type = "text" set the content type for the request
performance parameter
parameter | describe |
---|---|
Transactions | Hit Counts |
Availability | hit rate |
Elapsed time | The time spent in the whole pressure measurement, from the first to the last |
Data transferred | Total of the whole pressure measurement data transmission |
Response time | Response time is the average time spent responding to each simulated user request |
Transaction rate | The transaction rate is the average number of transactions that the server can process per second In short: transactions divided by elapsed time |
Throughput | Throughput is the average number of bytes transmitted per second from the server to all simulated users |
Concurrency | Concurrency is the average number of simultaneous connections, which increases with the decline of server performance |
Successful transactions | Number of successful transactions |
Failed transactions | Number of failed transactions |
Longest transaction | Maximum transaction time |
Shortest transaction | Minimum transaction time |
Show default configuration
[root@docker35 ~]# siege -C CURRENT SIEGE CONFIGURATION Mozilla/5.0 (pc-x86_64-linux-gnu) Siege/4.1.1 Edit the resource file to change the settings. ---------------------------------------------- version: 4.1.1 verbose: true color: true quiet: false debug: false protocol: HTTP/1.1 HTML parser: enabled get method: HEAD connection: close concurrent users: 25 time to run: n/a repetitions: n/a socket timeout: 30 cache enabled: false accept-encoding: gzip, deflate delay: 0.000 sec internet simulation: false benchmark mode: false failures until abort: 1024 named URL: none URLs file: /usr/local/etc/urls.txt thread limit: 500 logging: false log file: /usr/local/var/log/siege.log resource file: /root/.siege/siege.conf timestamped output: false comma separated output: false allow redirects: true allow zero byte data: true allow chunked encoding: true upload unique files: true json output: false no-follow: - ad.doubleclick.net - pagead2.googlesyndication.com - ads.pubsqrd.com - ib.adnxs.com proxy auth: www auth:
Test multiple URLs
Usage example:
siege -c 200 -t 10S -i -d 1 -f url.txt
Note: - c is the concurrency and - t is the time. url.txt is a text file. Each line is a URL, which will be accessed randomly.
url.txt file is as follows:
https://www.xmmup.com/linuxchakanzuixiaohaoneicundejincheng.html https://www.xmmup.com/changjiandelinuxcaozuoxitongneihecanshu.html https://www.xmmup.com/ https://www.xmmup.com/neicunfenpeizhongdenuma.html https://www.xmmup.com/linuxchakanzuixiaohaoneicundejincheng.html https://www.xmmup.com/phpyouhuakuozhanopcache.html
Result description:
- Transactions: 30000 hits: 30000 processes completed
- Availability: 100.00%: success rate
- Elapsed time: 68.59 secs: total elapsed time
- Data transferred: 817.76 MB: 817.76 MB in total
- Response time: 0.04 secs: response time, showing the speed of network connection
- Transaction rate: 437.38 transaction / sec: an average of 437.38 transactions per second
- Throughput: 11.92 MB/sec: average data transferred per second
- Concurrency: 17.53: actual maximum concurrent connections
- Successful transactions: 30000: number of successful transactions
- Failed transactions: 0: number of failed transactions
- Longest transaction: 3.12: maximum time per transmission
- Shortest transaction: 0.00: the shortest time for each transmission
Pressure measurement single website
siege -c 1000 -t 10S https://www.xmmup.com
Get the Header information of the specified URL and display the HTTP processing information
siege -g https://www.xmmup.com
Other tests
- In URLs Txt
siege -c 200 -r 100 -f urls.txt
- Randomly select URLs Txt
siege -c 200 -r 100 -f urls.txt -i
- delay=0, more accurate stress test than functional test
siege -c 200 -r 100 -f urls.txt -i -b
- Support application/json mode request
siege -c1 -r1 "http://192.168.16.101:6005/bpm/processInstances/review PUT <./1.json"
- Multiple Header parameters are supported
siege -c10 -r1 -p --header="Authorization: Bearer b7c75bae-9d68-4a74-bffb-95eb08a40918" --header="sg: 123456"
- Specifies the http request header document type
siege -H "Content-Type:application/json" -c 200 -r 100 -f urls.txt -i -b