takanorig / mqtt-bench Goto Github PK
View Code? Open in Web Editor NEWBenchmark tool for MQTT Broker
Benchmark tool for MQTT Broker
My total clients are not going beyond 1024 on my VPS (virtual private server @2.4GHz & 1GB RAM). Whenever i try to increase the clients beyond 1024 it gives this error: "Connected error: Network Error : %!s()".
P.S: Broker on my PC can handle more than 10,000 clients with same settings.
excute:
mqtt-bench -action=p -broker="tcp://27.0.0.1:1883" -clients=20000 -count=10
goroutine 1761 [IO wait]:
net.runtime_pollWait(0x7f376441bc80, 0x72, 0xc8200820e0)
/usr/lib/golang/src/runtime/netpoll.go:157 +0x60
net.(_pollDesc).Wait(0xc820909a30, 0x72, 0x0, 0x0)
/usr/lib/golang/src/net/fd_poll_runtime.go:73 +0x3a
net.(_pollDesc).WaitRead(0xc820909a30, 0x0, 0x0)
/usr/lib/golang/src/net/fd_poll_runtime.go:78 +0x36
net.(_netFD).Read(0xc8209099d0, 0xc820ce6750, 0x1, 0x1, 0x0, 0x7f37658d9140, 0xc8200820e0)
/usr/lib/golang/src/net/fd_unix.go:232 +0x23a
net.(_conn).Read(0xc82014c380, 0xc820ce6750, 0x1, 0x1, 0x0, 0x0, 0x0)
/usr/lib/golang/src/net/net.go:172 +0xe4
io.ReadAtLeast(0x7f376771c050, 0xc82014c380, 0xc820ce6750, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0)
/usr/lib/golang/src/io/io.go:298 +0xe6
io.ReadFull(0x7f376771c050, 0xc82014c380, 0xc820ce6750, 0x1, 0x1, 0x1, 0x0, 0x0)
/usr/lib/golang/src/io/io.go:316 +0x62
git.eclipse.org/gitroot/paho/org.eclipse.paho.mqtt.golang.git/packets.ReadPacket(0x7f376771c050, 0xc82014c380, 0x0, 0x0, 0x0, 0x0)
/data/go/src/git.eclipse.org/gitroot/paho/org.eclipse.paho.mqtt.golang.git/packets/packets.go:105 +0xd4
git.eclipse.org/gitroot/paho/org%2eeclipse%2epaho%2emqtt%2egolang%2egit.incoming(0xc820cacc00)
/data/go/src/git.eclipse.org/gitroot/paho/org.eclipse.paho.mqtt.golang.git/net.go:78 +0x263
created by git.eclipse.org/gitroot/paho/org%2eeclipse%2epaho%2emqtt%2egolang%2egit.(*Client).Connect.func1
/data/go/src/git.eclipse.org/gitroot/paho/org.eclipse.paho.mqtt.golang.git/client.go:254 +0x14a4
1476173392: Client mqttbench1b81e-19960 has exceeded timeout, disconnecting.
1476173392: Socket error on client mqttbench1b81e-19960, disconnecting.
I am facing an issue for checking benchmark of broker over SSL.
Command I am using:
~/mqtt-bench -broker=tcp://127.0.0.1:8883 -action=pub -tls=client:ca.crt,client.crt,client.key -x=true
I am getting following error log:
Connected error: Network Error : %!s(<nil>)
help! thx
2016-11-03 19:21:12.040714115 +0800 CST Start benchmark
2016-11-03 19:21:12.22926646 +0800 CST End benchmark
panic: close of closed channel
goroutine 1977 [running]:
panic(0x231b80, 0xc42015a700)
/usr/local/go/src/runtime/panic.go:500 +0x1a1
git.eclipse.org/gitroot/paho/org%2eeclipse%2epaho%2emqtt%2egolang%2egit.(*Client).disconnect(0xc4208f8000)
/Users/seven/Workspace/golang/src/git.eclipse.org/gitroot/paho/org.eclipse.paho.mqtt.golang.git/client.go:428 +0x96
git.eclipse.org/gitroot/paho/org%2eeclipse%2epaho%2emqtt%2egolang%2egit.(*Client).Disconnect(0xc4208f8000, 0xa)
/Users/seven/Workspace/golang/src/git.eclipse.org/gitroot/paho/org.eclipse.paho.mqtt.golang.git/client.go:388 +0x27c
main.Disconnect(0xc4208f8000)
/Users/seven/Workspace/golang/src/charge_platform/mqtt_broker/mqtt_benchmark.go:372 +0x34
main.AsyncDisconnect.func1(0xc42018a3c0, 0xc420210000)
/Users/seven/Workspace/golang/src/charge_platform/mqtt_broker/mqtt_benchmark.go:363 +0x54
created by main.AsyncDisconnect
/Users/seven/Workspace/golang/src/charge_platform/mqtt_broker/mqtt_benchmark.go:364 +0xca
panic: close of closed channel
goroutine 1982 [running]:
panic(0x231b80, 0xc420c46210)
/usr/local/go/src/runtime/panic.go:500 +0x1a1
git.eclipse.org/gitroot/paho/org%2eeclipse%2epaho%2emqtt%2egolang%2egit.(*Client).disconnect(0xc4204f2900)
/Users/seven/Workspace/golang/src/git.eclipse.org/gitroot/paho/org.eclipse.paho.mqtt.golang.git/client.go:428 +0x96
git.eclipse.org/gitroot/paho/org%2eeclipse%2epaho%2emqtt%2egolang%2egit.(*Client).Disconnect(0xc4204f2900, 0xa)
/Users/seven/Workspace/golang/src/git.eclipse.org/gitroot/paho/org.eclipse.paho.mqtt.golang.git/client.go:388 +0x27c
main.Disconnect(0xc4204f2900)
/Users/seven/Workspace/golang/src/charge_platform/mqtt_broker/mqtt_benchmark.go:372 +0x34
main.AsyncDisconnect.func1(0xc42018a3c0, 0xc420210000)
/Users/seven/Workspace/golang/src/charge_platform/mqtt_broker/mqtt_benchmark.go:363 +0x54
created by main.AsyncDisconnect
/Users/seven/Workspace/golang/src/charge_platform/mqtt_broker/mqtt_benchmark.go:364 +0xca
I am running mosquitto broker on my ubuntu server. When I test it with this command
sudo ./mqtt-bench -broker=tcp://127.0.0.1:1883 -action=subcount=50 -intervaltime=10
It show only this this message and no summary. I checked my broker, it's fine.
2016-05-12 07:46:10.338469193 +0700 WIB Start benchmark
But when i do the same test for pub. Everything goes fine.
sudo ./mqtt-bench -broker=tcp://127.0.0.1:1883 -action=pub -count=50 -intervaltime=10
2016-05-12 07:52:06.890018967 +0700 WIB Start benchmark
2016-05-12 07:52:07.406071964 +0700 WIB End benchmark
Result : broker=tcp://127.0.0.1:1883, clients=10, totalCount=494, duration=515ms, throughput=959.22messages/sec
Hi. Thanks for this great tool!
The thing I'm missing is the possibility to have multiple connection credentials, in order to simulate different users connecting to the broker. My use case is that I have an auth plugin for mosquitto and I'd like to run some benchmarks, maybe see how it stands against jpmens' auth plugin and also what's the real overhead over running regular mosquitto with no plugin, and so I'd love having the option to set a lot of users so that all backends get properly used.
If you are ok with the idea but don't have time to make it happen, I wouldn't mind forking, extending and then making a PR. If you are not interested, just let me know.
Thanks again!
Hi,
I'm using your tool to make some benchmarks on MQTT.
There is one option missing in your tool setting the start number of a topic.
For example :
./mqtt_bench -start_number=10 to -topic="streaming/foo/ -count=10 -action=p
will publish data in topic : streaming/foo/10, streaming/foo/11, ..., streaming/foo/20.
Can you add a such option ?
Getting below error message while install mqtt-bench. Please help me.
package git.eclipse.org/gitroot/paho/org.eclipse.paho.mqtt.golang.git/packets: cannot download, git.eclipse.org/gitroot/paho/org.eclipse.paho.mqtt.golang uses insecure protocol
For downloading binaries there's a Deprecation Warning on Drone site and it seems that there is not any file to download.
shortly, if number of publisher is 10 with message 100, then if number of subscriber is 10 with count message 1000, but the publisher has stopped. question is how to handle or make subscriber stop waiting messages, due to the publisher had stopped.
@takanorig thanks for the great work, it would be nice including:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.