Mac OS X下压力测试工具Siege安装与使用

安装:

brew siege

查看安装是否成功:

安装路径:
$ which siege
/usr/local/bin/siege

版本:
$ siege -V
SIEGE 4.0.2

参数说明:

$ siege -h
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.
  -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 requst
  -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

查看当前配置:

$ siege -C

使用一:

$ siege -c 50 -r 10 https://news.gnyy.co

参数说明: -c 是并发量,并发数为20人(默认10) -r 是重复次数, 重复10次

使用二:随机选取txt文件中的列出的所有网址

url.txt

https://news.gnyy.co
https://www.gnyyy.cn
https://8jieke.com
siege -c 5 -r 10 -f url.txt

参数说明: -c 是并发量,并发数为5人 -r 是重复次数, 重复10次 ,-f 指定文件路径及名称,url.txt文本文件(每行都是一个url),会从里面随机访问

使用三:模拟POST/GET请求

url.txt

# URL (POST):
https://news.gnyy.co/index.php POST uid=yudis&sign=liud
siege -c 5 -r 10 -f url.txt

结果说明:

$ siege -c 50 -r 10 -d 5 https://8jieke.com

/ /请求http://8jieke.com,并发人数为50,重复10次,每次请求间隔5秒

 

Transactions: 500 hits (处理次数,本次处理了500此请求)
Availability: 100.00 % (可用性/成功次数的百分比,比如本次100%成功)
Elapsed time: 36.67 secs (运行时间,本次总消耗36.67秒)
Data transferred: 0.32 MB (数据传送量)
Response time: 0.31 secs (响应时间)
Transaction rate: 13.64 trans/sec (处理请求频率,每秒钟处理8.89次请求)
Throughput: 0.01 MB/sec (吞吐量,传输速度)
Concurrency: 4.21 (实际最高并发连接数)
Successful transactions: 500 (成功的传输次数)
Failed transactions: 0 (失败的传输次数)
Longest transaction: 2.74 (处理传输是所花的最长时间)
Shortest transaction: 0.17 (处理传输是所花的最短时间)

转载于:https://www.cnblogs.com/yudis/articles/6211431.html

很好用的网络压力测试工具 Linux版 siege安装 unzip filename.zip cd siege-*.*.* ./configure --prefix=/usr/local/siege --mandir=/usr/local/man --with-ssl=/usr/local/ssl mkdir -p /usr/local/siege/etc mkdir -p /usr/local/siege/var make make install 查看配置文件 /usr/local/siege/bin/siege -C 二、siege使用 举例说明: 50个用户(每次并发量)重复100次 共产生 50*100 个请求 /usr/local/siege/bin/siege -c 50 -r 100 www.baidu.com 50个用户 重复100次 发送GET参数 /usr/local/siege/bin/siege -c 50 -r 100 http://www.baidu.com/s?wd=siege&rsv_spt=1&issp=1&rsv_bp=0&ie=utf-8&tn=baiduhome_pg&rsv_sug3=4&rsv_sug=2&rsv_sug1=4&rsv_sug4=60 50个用户 重复100次 发送POST参数 (注意引号) /usr/local/siege/bin/siege -c 50 -r 100 "https://www.abc.com/a.php POST name=zhangsan" 50个用户 重复100次 发送POST参数(从文件中读取) /usr/local/siege/bin/siege -c 50 -r 100 "https://www.abc.com/a.php POST < /root/ab_test/post.xml" 另外还有挺多参数 详情请man 或 siege -h siege报表解析,请man查看,暂略(有点累了,不想写了。。。。。)。 Transactions: 10 hits :服务器接收的请求数 Availability: 100.00 % :有效情况的比例 Elapsed time: 1.06 secs : 测试所用的时间 Data transferred: 0.04 MB :每个模拟用户的数据传输量 Response time: 0.03 secs :响应每个模拟用户请求的平均时间 Transaction rate: 9.43 trans/sec :服务器每秒处理事务的平均数 Throughput: 0.04 MB/sec :服务器每秒跟所有模拟用户的数据传输量 Concurrency: 0.25 :每秒的模拟连接 Successful transactions: 10 :处理成功的事务数(code<400) Failed transactions: 0 : 处理失败的事务数(code>400) Longest transaction: 0.04 :最长的事务处理时间 Shortest transaction: 0.02 :最短的事务处理时间
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值