当前位置: 首页 > OpenSource > 正文

用siege做http的压力测试

siege是一个开源的压力测试用具,有点类似apache的ab

http://www.joedog.org/Siege/Manual
download from ftp://ftp.joedog.org/pub/siege
 
./configure –prefix=/home/siege && make  && make install

[root@ bin]# ./siege
SIEGE 2.67
Usage: siege [options]
       siege [options] URL
       siege -g URL
Options:
  -V, –version           VERSION, prints version number to screen.
  -h, –help              HELP, prints this section.
  -C, –config            CONFIGURATION, show the current configuration.
  -v, –verbose           VERBOSE, prints notification to screen.
  -g, –get               GET, pull down headers from the server and display HTTP
                          transaction. Great for web application debugging.
  -c, –concurrent=NUM    CONCURRENT users, default is 10
  -u, –url=”URL”         Deprecated. Set URL as the last argument.
  -i, –internet          INTERNET user simulation, hits the URLs randomly.
  -b, –benchmark         BENCHMARK, signifies no delay for time testing.
  -t, –time=NUMm         TIME based testing where “m” is the modifier S, M, or H
                          no space between NUM and “m”, ex: –time=1H, one hour test.
  -r, –reps=NUM          REPS, number of times to run the test, default is 25
  -f, –file=FILE         FILE, change the configuration file to file.
  -R, –rc=FILE           RC, change the siegerc file to file.  Overrides
                          the SIEGERC environmental variable.
  -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
  -H, –header=”text”     Add a header to request (can be many)
  -A, –user-agent=”text” Sets User-Agent in request
 
 
  siege 的使用方法
 
  $ ./siege -u www.google.com -d1 -r10 -c25
  -u has been deprecated.
  提示-u参数已经不推荐了
 
也可以使用url列表的方式:

  ./siege -c 20 -r 30 -f url.txt
 
 
 vi url.txt
  http://www.google.com

运行的结果如下:

** SIEGE 2.67
** Preparing 20 concurrent users for battle.
The server is now under siege…
HTTP/1.1 200   0.17 secs:    6385 bytes ==> /
HTTP/1.1 200   0.17 secs:    6385 bytes ==> /
HTTP/1.1 200   0.17 secs:    6385 bytes ==> /
HTTP/1.1 200   0.17 secs:    6385 bytes ==> /
HTTP/1.1 200   0.17 secs:    6375 bytes ==> /
HTTP/1.1 200   0.17 secs:    6375 bytes ==> /
HTTP/1.1 200   0.18 secs:    6385 bytes ==> /
HTTP/1.1 200   0.18 secs:    6375 bytes ==> /
HTTP/1.1 200   0.33 secs:    6385 bytes ==> / 
  done.
Transactions:                    600 hits
Availability:                 100.00 %
Elapsed time:                  24.53 secs
Data transferred:               3.66 MB
Response time:                  0.18 secs
Transaction rate:              24.46 trans/sec
Throughput:                     0.15 MB/sec
Concurrency:                    4.46
Successful transactions:         600
Failed transactions:               0
Longest transaction:            3.40
Shortest transaction:           0.17
 
FILE: /home/siege/var/siege.log
You can disable this annoying message by editing
the .siegerc file in your home directory; change
the directive ‘show-logfile’ to false.

本文固定链接: https://www.2hei.net/2008/07/11/siege_http_press_test/ | 2hei.net

该日志由 u2 于2008年07月11日发表在 OpenSource 分类下,
原创文章转载请注明: 用siege做http的压力测试 | 2hei.net
关键字: ,

报歉!评论已关闭.