Skip to content

MQTT client for bench broker.MQTT Broker 发布消息测试工具

License

Notifications You must be signed in to change notification settings

wxiao1002/mqtt-bench

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MQTT Bench

MQTT 发布消息测试工具

快速开始

编译好的程序包

./mqtt-bench-linux -csvPath /root/clients.csv -broker tcp://localhost:1883 -clients 1000 -benchmarkTime 20 -messageInterval 1
  • 上述示范是 读取/root/clients.csv 文件解析用户名密码,生成1000个客户端并连接到 tcp://localhost:1883 ,以1秒一条的消息频率发布消息测试20 分钟

源码运行

go run main.go -csvPath /root/clients.csv -broker tcp://localhost:1883 -clients 1000 -benchmarkTime 20 -messageInterval 1

参数解析

  • broker :mqtt broker 地址
  • csvPath:读取用户密码地址,第一列用户,第二列密码
  • clients:创建多少个连接,csv 读取到的数目大于等于该值
  • benchmarkTime: 压测时间,分钟开始
  • messageInterval:生产消息的时间间隔,秒
  • topic:发布主题,为空的话 会是 api/{username}/attributes,username 是占位符到时候会自动替换成用户名

运行结果

pPdN091.png

打包

  • sh build/linux.sh
  • sh build/linux_arm.sh
  • sh build/windows.sh

english doc

[./README-en.md]

About

MQTT client for bench broker.MQTT Broker 发布消息测试工具

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published