Benchmark for MQTT
git clone https://github.com/rmqtt/rmqtt-bench.gitcd rmqtt-benchcargo install --path.
$ rmqtt-bench v3 --helpUSAGE: rmqtt-bench.exe v3[FLAGS][OPTIONS]FLAGS: --helpPrints help information -S, --subSubscribe switch,default value:false -P, --pubPublish switch,default value:false -C, --cleanClean session,default value:false -r, --retainRetain message,default value:false -T, --controlControl enable,default value:false -V, --versionPrints version informationOPTIONS: --addrs <addrs>...MQTT brokerendpoint list,"host1:port host2:port host3:port"[default: localhost:1883] -c, --conns <conns>The number of connections[default:1000] -i, --interval <interval>Interval of connecting to the broker, millisecond[default:0] -E, --id-pattern <id-pattern>Client id pattern,{no} -ConnectionSerialNumber,{random} -The random number[default:{no}] -u, --username <username>Username -p, --password <password>Password -h, --handshake-timeout <handshake-timeout>Handshake timeout,Seconds[default:30] -k, --keepalive <keepalive>Keepalive,Seconds[default:60] -t, --topic <topic>Subscription orPublishTopic pattern,{cid} -Client id,{no} -ConnectionSerialNumber[default:{cid}] -q, --qos <qos>QoS,Currently, only0 and1 are supported[default:1] -a, --reconn-interval <reconn-interval>Auto reconnect interval, millisecond[default:5000] -I, --pub-interval <pub-interval>Publish message interval, millisecond[default:1000] -s, --size <size>Publish message length[default:256] -m, --message <message>Set the message contentforpublish -l, --max-limit<max-limit>Total number of published messages,0 will not be limited[default:0] -R, --topic-no-range <topic-no-range>...Publish topic serial number range, format: -R010000 --lw-msg<lw-message> --lw-qos<lw-qos> --lw-retain<lw-retain> --lw-topic<lw-topic> -o, --output-interval<output-interval>Console output interval,Seconds[default:5] -D, --ctrl-disconn-ratio<ctrl-disconn-ratio>Disconnected andReconnection ratio[default:0.4] -L, --ctrl-interval<ctrl-interval>Control interval, millisecond[default:1000] --ifaddrs<ifaddrs>...Local ipaddress,"127.0.0.1 127.0.0.2 127.0.0.3"
For example, create 25K concurrent connections concurrently
For example, create 25K concurrent connections concurrently and subscribe
$ rmqtt-bench v3 -c25000 -S -t iot/{no}
For example, create 100 concurrent connections and publish messages concurrently
$ rmqtt-bench v3 -c100 -S -t iot/{no} -P
For example, 100 concurrent connections are created and 1000 messages are published before exiting
$ rmqtt-bench v3 -c100 -S -t iot/{no} -P -l1000
For example, create 10K concurrent connections concurrently and subscribe.Then create 100 concurrent connections and publish messages to 10K connections
$ rmqtt-bench v3 -c10000 -S -t iot/{no}
$ rmqtt-bench v3 -c100 --id-pattern pub-{no} -P -t iot/{no} -R010000 -I10
Simple control, simulate real scenes.For example, 1000 concurrent connections are created at the same time,and then 20% of the connections are disconnected or reconnected every second
$ rmqtt-bench v3 -c1000 -T -L1000 -D0.2
Simulate real scenes through scripts
*Planned, please look forward to
Make sure to increase resource usage limits and expand the port range like following on Linux.
ulimit -n500000sudo sysctl -w net.ipv4.ip_local_port_range="1025 65534"
RMQTT Team.