4

http 并发测试工具 (http-little-toy) v0.0.3 发布

 2 years ago
source link: https://studygolang.com/articles/35969?fr=sidebar
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

http-little-toy

一个简单的 http 并发测试工具。

  1. 新增记录请求响应作为日志

  2. 新增支持命令行设置 Http header

README.md

⭐️README.MD⭐️ En

如果喜欢就star⭐️一下吧,让它沉睡在你的收藏库里。

https://github.com/leihenshang/http-little-toy

https://gitee.com/leihenshang/http-little-toy

灵感来源于 github 上各种版本的 wrk http并发测试工具,有一天看了一个go写的版本,就这?我也能行啊。我自己也造一个轮子吧。orz.

造轮子好玩吗? 真好玩!

  • [x] 命令行中加入设置 header

  • [x] 命令行中加入设置 body 负载

  • [ ] 完善一下 request.json 请求文件的逻辑

  • [x] 添加记录响应数据日志的功能,方便分析

一般使用 -d 控制请求时间(秒),-t 控制线程数(当做用户数量来理解)就可以了。

还能使用request.json文件,你不用重新编写命令参数了,不过可能还有点小问题,在完善中。

$ http-little-toy -h
Usage: httpToy <options>
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.
  1. 直接使用 go install github.com/leihenshang/http-little-toy ,再把你的go/bin放到环境变量里,使用 http-little-toy 带上参数,起飞吧,骚年。

  2. 手动编译成二进制文件直接运行,可以放到全局变量中直接从命令行中执行。

# 把项目编译成可执行文件并输出到当前目录
go build -o httpToy

执行测试命令

# 使用纯命令
 ./httpToy -d 10 -t 80 -u http://127.0.0.1:9090

# or

# 使用请求文件
./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

</div


Recommend

  • 32
    • www.tuicool.com 7 years ago
    • Cache

    Toy – the thin c++ game engine

    Coding games first The first concern of toy is to bring the thinnest and simplest stack of technology for making games directly from C++ , instead of foc...

  • 11
    • zserge.com 5 years ago
    • Cache

    How to write a (toy) JVM

    How to write a (toy) JVMWhether we like it or not, but Java is one of the most widely used programming languages. However, since most of the applications in Java are either too boring or too complex - not every Java developer has enough c...

  • 36
    • Github github.com 5 years ago
    • Cache

    Awk-JVM is a toy JVM in Awk

    awk-jvm a toy jvm in awk, based on this tutorial: https://zserge.com/posts/jvm/ notes this requires gawk, because of functions and the built...

  • 7
    • twistedoakstudios.com 4 years ago
    • Cache

    Breaking a Toy Hash Function

    Breaking a Toy Hash Function posted by Craig Gidney on July 2, 2013 You probably know that

  • 9
    • www.otsukare.info 4 years ago
    • Cache

    HTTP, a little story of development

    HTTP, a little story of development Lun 10 décembre 2012by Karl Dubost (Worked at Opera from...

  • 16
    • memorystomp.com 4 years ago
    • Cache

    Graph Toy

    Graph Toy Graph Toy Originally by Inigo Quilez (iq/rgba) with some local changes. Simple on-line graph visualizer Render Range:...

  • 10
    • www.technobuffalo.com 4 years ago
    • Cache

    Best BPA-Free Teething Toy 2021

    We may earn a commission for purchases using our links. Learn more. Best BPA-Free Teething Toy 2021

  • 8

    ← 上一篇 下一篇 → WRK:一个可编程的HTTP性能测试工具 发表于

  • 6
    • osp.io 3 years ago
    • Cache

    HTTP 负载测试工具-ali

    HTTP 负载测试工具-ali – 开源派 ali一款基于 Go 编写的 HTTP 负载测试开源工具,遵守MIT开源协议。ali可在命令行中实时展示指定 URL 的延迟、速率限制、加载时间、表头信息等内容。

  • 8

    jcstress:Java并发压力测试工具 - 极道 Java

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK