最近需要对Istio里的bookinfo进行分析,老是手去刷新太慢了,就找了个自动点的工具——Siege
Siege是一款开源的压力测试工具,设计用于评估WEB应用在压力下的承受能力。可以根据配置对一个WEB站点进行多用户的并发访问,记录每个用户所有请求过程的相应时间,并在一定数量的并发访问下重复进行。
Siege官网:http://www.joedog.org/
安装siege
apt-get install siege
Siege命令常用参数
-c 200 ??//指定并发数200-r 5 ????//指定测试的次数5-f ??????//urls.txt 制定url的文件-i ??????//internet系统,随机发送url-b ??????//请求无需等待 delay=0-t 5 ???//持续测试5分钟 ????????//-r和-t一般不同时使用
urls.txt位于 /etc/siege/ 文件夹下,它的格式
[protocol://]host.domain.com[:port][path/to/file]
如果url中含有空格和中文,要先进行url编码,否则siege发送的请求url不准确
常用的siege命令举例
//200个并发对http://www.google.com发送请求100次siege -c 200 -r 100 http://www.google.com//对urls.txt中的所有网址进行测试siege -c 200 -r 100 -f urls.txt//随机选取urls.txt中列出的网址进行测试siege -c 200 -r 100 -f urls.txt -i//delay=0,更准确的压力测试,而不是功能测试siege -c 200 -r 100 -f urls.txt -i -b//指定http请求头 文档类型siege -H "Content-Type:application/json" -c 200 -r 100 -f urls.txt -i -b
Siege输出结果说明
** SIEGE 2.72** Preparing 10 concurrent users for battle.The server is now under siege.. done. Transactions: 300 hits ????????//已完成的事务总署Availability: 100.00 % ?????????//完成的成功率Elapsed time: 0.08 secs ????//总共使用的时间Data transferred: 0.94 MB ????//响应中数据的总大小Response time: 0.00 secs //显示网络连接的速度Transaction rate: 3750.00 trans/sec //平均每秒完成的事务数Throughput: 11.79 MB/sec //平均每秒传送的数据量Concurrency: 8.50 ????????????//实际最高并发链接数Successful transactions: 300 ?//成功处理的次数Failed transactions: 0 ???//失败处理的次数Longest transaction: 0.01 ?//最长事务处理的时间Shortest transaction: 0.00 //最短事务处理时间
此外还可以看siege的日志
vi /var/log/siege.log
Web性能压力测试工具——Siege
原文地址:https://www.cnblogs.com/yuxiaoba/p/9355449.html