http-little-toyHTTP 并發(fā)測(cè)試工具
http-little-toy 是 Golang 編寫(xiě)的 http 并發(fā)測(cè)試工具。
軟件地址
http-little-toy: 一個(gè)簡(jiǎn)單的http基準(zhǔn)測(cè)試工具。 (gitee.com
介紹
靈感來(lái)源于 github 上各種版本的 wrk http并發(fā)測(cè)試工具,有一天看了一個(gè)go寫(xiě)的版本,就這?我也能行啊。于是自己也造一個(gè)輪子。orz.
造輪子真好玩。
todo
-
[x] 命令行中加入設(shè)置 header 頭
-
[x] 命令行中加入設(shè)置 body 負(fù)載
-
[ ] 完善一下 request.json 請(qǐng)求文件的邏輯
-
[x] 添加記錄響應(yīng)數(shù)據(jù)日志的功能,方便分析
使用
一般使用 -d 控制請(qǐng)求時(shí)間(秒),-t 控制線程數(shù)(當(dāng)做用戶數(shù)量來(lái)理解)就可以了。
還能使用request.json文件,你不用重新編寫(xiě)命令參數(shù)了,不過(guò)可能還有點(diǎn)小問(wèn)題,在完善中。
$ http-little-toy -h
Usage: httpToy
Options:
-H
The http header. --default=[].
-allowRedirects
allowRedirects. --default=true.
-body
The http body. --default="".
-caCert
caCert. --default="".
-clientCert
clientCert. --default="".
-clientKey
clientKey. --default="".
-compression
Use keep-alive for http protocol. --default=true.
-d
Duration of request.The unit is seconds. --default=0.
-f
specify the request definition file. --default="".
-gen
generate the request definition file template to the current directory. --default=false.
-h
show help tips. --default=false.
-keepAlive
Use keep-alive for http protocol. --default=true.
-log
record request log to file. default: './log' --default=false.
-skipVerify
TLS skipVerify. --default=false.
-t
Number of threads. --default=0.
-timeOut
the time out to wait response. --default=1000.
-u
The URL you want to test. --default="".
-useHttp2
useHttp2. --default=false.
-v
show app version. --default=false.
安裝教程
-
直接使用 go install github.com/leihenshang/http-little-toy ,再把你的go/bin放到環(huán)境變量里,使用 http-little-toy 帶上參數(shù),起飛吧,騷年。
-
手動(dòng)編譯成二進(jìn)制文件直接運(yùn)行,可以放到全局變量中直接從命令行中執(zhí)行。
手動(dòng)編譯
# 把項(xiàng)目編譯成可執(zhí)行文件并輸出到當(dāng)前目錄
go build -o httpToy
執(zhí)行:
# 使用純命令
./httpToy -d 10 -t 80 -u http://127.0.0.1:9090
# or
# 使用請(qǐng)求文件
./httpToy -d 10 -t 80 -f request_sample.json
# 使用test-server
go run . -u http://localhost:9090 -H aaa:bbbb -H ccc:ddd -body "hhhhh2333333" -d 2 -t 1
評(píng)論
圖片
表情
