wrk
wrk 是一个通用的性能压力测试工具,可通过linux编绎安装,叵通过 brew 安装
brew install wrk
使用:
wrk -t12 -c400 -d30s http://127.0.0.1:8080/index.html
这条语句使用12个进程,连续测试30秒,并同时保持400个并发
loadtest
loadtest 是支持通过 npm 安装的一个性能测试工具, 支持 windows和linux,在 node.js 的项目中使用非常方便
全局安装:
npm install -g loadtest
使用
连续测试下面的服务20秒,保持100个并发
loadtest http://localhost:8054/test -t 20 -c 100
测试结果
[Sat Jun 06 2020 09:53:04 GMT+0800 (GMT+08:00)] INFO Requests: 0, requests per second: 0, mean latency: 0 ms
[Sat Jun 06 2020 09:53:09 GMT+0800 (GMT+08:00)] INFO Requests: 2202, requests per second: 442, mean latency: 224.6 ms
[Sat Jun 06 2020 09:53:14 GMT+0800 (GMT+08:00)] INFO Requests: 5035, requests per second: 565, mean latency: 178.6 ms
[Sat Jun 06 2020 09:53:19 GMT+0800 (GMT+08:00)] INFO Requests: 8195, requests per second: 628, mean latency: 157.5 ms
[Sat Jun 06 2020 09:53:24 GMT+0800 (GMT+08:00)] INFO
[Sat Jun 06 2020 09:53:24 GMT+0800 (GMT+08:00)] INFO Target URL: http://localhost:8054/test
[Sat Jun 06 2020 09:53:24 GMT+0800 (GMT+08:00)] INFO Max time (s): 20
[Sat Jun 06 2020 09:53:24 GMT+0800 (GMT+08:00)] INFO Concurrency level: 100
[Sat Jun 06 2020 09:53:24 GMT+0800 (GMT+08:00)] INFO Agent: none
[Sat Jun 06 2020 09:53:24 GMT+0800 (GMT+08:00)] INFO
[Sat Jun 06 2020 09:53:24 GMT+0800 (GMT+08:00)] INFO Completed requests: 11340
[Sat Jun 06 2020 09:53:24 GMT+0800 (GMT+08:00)] INFO Total errors: 0
[Sat Jun 06 2020 09:53:24 GMT+0800 (GMT+08:00)] INFO Total time: 20.0070496 s
[Sat Jun 06 2020 09:53:24 GMT+0800 (GMT+08:00)] INFO Requests per second: 567
[Sat Jun 06 2020 09:53:24 GMT+0800 (GMT+08:00)] INFO Mean latency: 174.5 ms
[Sat Jun 06 2020 09:53:24 GMT+0800 (GMT+08:00)] INFO
[Sat Jun 06 2020 09:53:24 GMT+0800 (GMT+08:00)] INFO Percentage of the requests served within a certain time
[Sat Jun 06 2020 09:53:24 GMT+0800 (GMT+08:00)] INFO 50% 165 ms
[Sat Jun 06 2020 09:53:24 GMT+0800 (GMT+08:00)] INFO 90% 229 ms
[Sat Jun 06 2020 09:53:24 GMT+0800 (GMT+08:00)] INFO 95% 249 ms
[Sat Jun 06 2020 09:53:24 GMT+0800 (GMT+08:00)] INFO 99% 296 ms
[Sat Jun 06 2020 09:53:24 GMT+0800 (GMT+08:00)] INFO 100% 349 ms (longest request)
回复 (0)
微信扫码 立即评论