Ubuntu Siege 压力测试工具

  • 安装
$ sudo apt install siege
  • Siege命令常用参数
-c 200 指定并发数200
-r 5 指定测试的次数5
-f urls.txt 制定url的文件
-i internet系统,随机发送url
-b 请求无需等待 delay=0
-t 5 持续测试5分钟
# -r和-t一般不同时使用
  • 常用的几个子
# 模拟10秒内每秒访问20次
$ sudo siege http://web.meilapp.com/products -c20 -t10s

# 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 3.0.8
** Preparing 20 concurrent users for battle.
The server is now under siege...
Lifting the server siege...      done.

Transactions:              2 hits            # 总共测试次数
Availability:              100.00 %          # 成功次数百分比
Elapsed time:              9.02 secs         #  总共耗时多少秒
Data transferred:          0.01 MB           # 总共数据传输
Response time:             2.73 secs         # 等到响应耗时
Transaction rate:          0.22 trans/sec    # 平均每秒处理请求数
Throughput:                0.00 MB/sec       # 吞吐率
Concurrency:               0.61              # 最高并发
Successful transactions:   9                 # 成功的请求数
Failed transactions:       0                 # 失败的请求数
Longest transaction:       5.40
Shortest transaction:      0.00
posted @ 2017-08-30 20:51  阿拉善的樵夫  阅读(1111)  评论(0编辑  收藏  举报