编程开源技术交流,分享技术与知识

网站首页 > 开源技术 正文

http性能测试工具wrk(黑神话悟空性能测试工具上线steam)

wxchong 2024-10-12 12:34:41 开源技术 7 ℃ 0 评论

wrk能用很少的线程压出很大的并发量,原因它使用了一些操作系统特定的高性能I/O机制, 比如select, epoll, kqueue等。 其实它是复用redis的ae异步事件驱动框架。确切的说 ae 事件驱动框架并不是 redis 发明的,它来至于Tcl的解释器 jim,这个小巧高效的框架,因为被 redis 采用而更多的被大家所熟知。

wrk GitHub 源码: https://github.com/wg/wrk

wrk只能运行于 Unix 类的系统上,linux下安装

git clone https://github.com/wg/wrk

cd wrk-master

make

参数说明:

Usage: wrk <options> <url>

Options:

-c, --connections <N> Connections to keep open 连接数

-d, --duration <T> Duration of test 测试的持续时间

-t, --threads <N> Number of threads to use 线程数

-s, --script <S> Load Lua script file lua脚本

-H, --header <H> Add header to request 自定义header

--latency Print latency statistics

--timeout <T> Socket/request timeout

-v, --version Print version details 版本

Numeric arguments may include a SI unit (1k, 1M, 1G)

Time arguments may include a time unit (2s, 2m, 2h)

测试:

./wrk -t12 -c100 -d60s -T3s --latency http://www.baidu.com

12个线程,100个连接,执行60s,超时时间设置为3s,默认是1s

返回:

Running 30s test @ http://www.baidu.com

12 threads and 100 connections

Thread Stats Avg Stdev Max +/- Stdev

Latency 1.42s 3.47s 25.80s 92.34%

Req/Sec 17.59 17.95 440.00 89.50%

Latency Distribution

50% 245.60ms

75% 882.81ms

90% 3.25s

99% 20.43s

4504 requests in 30.03s, 66.67MB read

Socket errors: connect 0, read 10, write 0, timeout 0

Requests/sec: 149.96

Transfer/sec: 2.22MB

除此之外,还可以操作lua脚本,丰富的设置header信息等。

Tags:

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表