介绍
Superbenchmarker是用于对HTTP API和网站进行性能测试的负载生成器命令行工具。受Apache Benchmark的启发,它打算成为steriods上的Apache Benchmark(ab.exe)。它会在测试结束时在终端窗口中显示最终结果,但也会在Web界面中不断报告。
安装
- 管理员身份打开powershell
- 运行下面命令
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
- 执行
choco install superbenchmarker
- 输入 sb,你会看到帮助文档
- 执行压测命令
- 使用单个线程触发100个GET请求,-c (–concurrency)(默认: 1) 并发请求数,-n ( --numberOfRequests)(默认: 100) 请求总数
sb -u "http://example.com" -c 1 -n 100
- 提交一个post请求
sb -u 'http://localhost:8188/order/save' -d -m POST -t template.txt
template.txt
Authorization: Basic GV5ITpub3Bhc3N3b3JkaGVyZQ==
Content-Type: application/json
{
"id": "3",
"name": "xiaomi",
"auth": "test"
}