家资是何物,积帙列梁梠。这篇文章主要讲述接口压力测试工具之go-wrk相关的知识,希望能为你提供帮助。
??go-wrk?
??
是一个用Go语言实现的轻量级的http基准测试工具,类似于??wrk?
??,本文将简单介绍一下如何使用??go-wrk?
?实现接口的性能(压力)测试。
github地址:??https://github.com/tsliwowicz/go-wrk???
?
安装:
go get github.com/tsliwowicz/go-wrk
使用:
Usage: go-wrk
Options:
-Hheader line, joined with ; (Default )
-MHTTP method (Default GET)
-TSocket/request timeout in ms (Default 1000)
-bodyrequest body string or @filename (Default )
-cNumber of goroutines to use (concurrent connections) (Default 10)
-caCA file to verify peer against (SSL/TLS) (Default )
-certCA certificate file to verify peer against (SSL/TLS) (Default )
-dDuration of test in seconds (Default 10)
-fPlayback file name (Default)
-helpPrint help (Default false)
-hostHost Header (Default )
-httpUse HTTP/2 (Default true)
-keyPrivate key file name (SSL/TLS (Default )
-no-cDisable Compression - Prevents sending the "Accept-Encoding: gzip" header (Default false)
-no-kaDisable KeepAlive - prevents re-use of TCP connections between different HTTP requests (Default false)
-redirAllow Redirects (Default false)
-vPrint version details (Default false)
./go-wrk -c 80 -d 5http://192.168.1.118:8080/json
持续5秒中, 开启每秒80个并发请求
返回结果:
Running 10s test @ http://192.168.1.118:8080/json
80 goroutine(s) running concurrently
142470 requests in 4.949028953s, 19.57MB read
Requests/sec:28787.47
Transfer/sec:3.95MB
Avg Req Time:0.0347ms
Fastest Request:0.0340ms
Slowest Request:0.0421ms
Number of Errors:0
还有其他参数:-n 10000就是模拟1w次请求
【接口压力测试工具之go-wrk】
推荐阅读
- oracle拨云见日第6篇之网络配置
- 快速搞懂 Apache SkyWalking 的 OAL
- php手册Filesystem函数大全(解析)
- 全面解锁Kubernetes(百度爱番番技术实践全揭秘!)
- #yyds干货盘点#Vue $watch监听对象属性,数组内对象属性改变
- Flutter 专题29 图解自定义底部状态栏 ACEBottomNavigationBar#yyds干货盘点#
- Java 在Word中嵌入多媒体(视频音频)文件
- #yyds干货盘点#Aop的两个最常见的应用场景
- #星光计划2.0# 添加树莓派4B到OHOS3.0编译框架