diff --git a/README.md b/README.md index a39b587..2652476 100644 --- a/README.md +++ b/README.md @@ -39,40 +39,63 @@ BUILD_WITHOUT_QUIC=1 make ```sh $ ./emqtt_bench conn --help -Usage: emqtt_bench conn [--help ] [-h []] [-p []] - [-V []] [-c []] - [-n []] [-i []] - [-u ] [-P ] - [-k []] [-C []] [-x []] - [-S []] [--certfile ] - [--keyfile ] [--quic []] - [--ifaddr ] [--prefix ] +Usage: emqtt_bench conn [--help ] [-d ] [-h []] + [-p []] [-V []] [-c []] + [-n []] [--load-qst ] + [-Q []] [-i []] [-u ] + [-P ] [-k []] [-C []] + [-x []] [-S []] + [--certfile ] [--keyfile ] + [--quic []] [--ifaddr ] + [--prefix ] [-s []] [-l ] + [--num-retry-connect []] + [-R []] + [--force-major-gc-interval []] + [--log_to []] + + --help help information + -d, --dist enable distribution port + -h, --host mqtt server hostname or comma-separated + hostnames [default: localhost] + -p, --port mqtt server port number [default: 1883] + -V, --version mqtt protocol version: 3 | 4 | 5 [default: 5] + -c, --count max count of clients [default: 200] + -n, --startnumber start number [default: 0] + -Q, --qoe Enable QoE tracking [default: false] + -i, --interval interval of connecting to the broker + [default: 10] + -u, --username username for connecting to server + -P, --password password for connecting to server + -k, --keepalive keep alive in seconds [default: 300] + -C, --clean clean session [default: true] + -x, --session-expiry Set 'Session-Expiry' for persistent sessions + (seconds) [default: 0] + -S, --ssl ssl socoket for connecting to server + [default: false] + --certfile client certificate for authentication, if + required by server + --keyfile client private key for authentication, if + required by server + --quic QUIC transport [default: false] + --load-qst load quic session tickets from dets file + --ifaddr local ipaddress or interface address + --prefix client id prefix + -s, --shortids use short ids for client ids [default: false] + -l, --lowmem enable low mem mode, but use more CPU + --num-retry-connect number of times to retry estabilishing a + connection before giving up [default: 0] + -R, --connrate connection rate(/s), default: 0, fallback to + use --interval [default: 0] + --force-major-gc-interval interval in milliseconds in which a major GC + will be forced on the bench processes. a + value of 0 means disabled (default). this + only takes effect when used together with + --lowmem. [default: 0] + --log_to Control where the log output goes. console: + directly to the console null: quietly, + don't output any logs. [default: console] - --help help information - -h, --host mqtt server hostname or comma-separated hostnames [default: - localhost] - -p, --port mqtt server port number [default: 1883] - -V, --version mqtt protocol version: 3 | 4 | 5 [default: 5] - -c, --count max count of clients [default: 200] - -n, --startnumber start number [default: 0] - -i, --interval interval of connecting to the broker [default: 10] - -u, --username username for connecting to server - -P, --password password for connecting to server - -k, --keepalive keep alive in seconds [default: 300] - -C, --clean clean session [default: true] - -x, --session-expiry Set 'Session-Expiry' for persistent sessions - (seconds) [default: 0] - -S, --ssl ssl socoket for connecting to server [default: - false] - --certfile client certificate for authentication, if required - by server - --keyfile client private key for authentication, if required - by server - --quic QUIC transport [default: false] - --ifaddr local ipaddress or interface address - --prefix client id prefix - -l, --lowmem enable low mem mode, but use more CPU ``` For example, create 50K concurrent connections at the arrival rate of 100/sec: @@ -85,44 +108,66 @@ For example, create 50K concurrent connections at the arrival rate of 100/sec: ```sh $ ./emqtt_bench sub --help -Usage: emqtt_bench sub [--help ] [-h []] [-p []] - [-V []] [-c []] +Usage: emqtt_bench sub [--help ] [-d ] [-h []] + [-p []] [-V []] [-c []] [-n []] [-i []] - [-t ] [-q []] [-u ] - [-P ] [-k []] [-C []] - [-x []] [-S []] + [-t ] [-q []] + [--load-qst ] [-Q []] + [-u ] [-P ] [-k []] + [-C []] [-x []] [-S []] [--certfile ] [--keyfile ] [--ws []] [--quic []] [--ifaddr ] [--prefix ] - [-l ] - - --help help information - -h, --host mqtt server hostname or comma-separated hostnames [default: - localhost] - -p, --port mqtt server port number [default: 1883] - -V, --version mqtt protocol version: 3 | 4 | 5 [default: 5] - -c, --count max count of clients [default: 200] - -n, --startnumber start number [default: 0] - -i, --interval interval of connecting to the broker [default: 10] - -t, --topic topic subscribe, support %u, %c, %i variables - -q, --qos subscribe qos [default: 0] - -u, --username username for connecting to server - -P, --password password for connecting to server - -k, --keepalive keep alive in seconds [default: 300] - -C, --clean clean start [default: true] - -x, --session-expiry Set 'Session-Expiry' for persistent sessions - (seconds) [default: 0] - -S, --ssl ssl socoket for connecting to server [default: - false] - --certfile client certificate for authentication, if required - by server - --keyfile client private key for authentication, if required - by server - --ws websocket transport [default: false] - --quic QUIC transport [default: false] - --ifaddr local ipaddress or interface address - --prefix client id prefix - -l, --lowmem enable low mem mode, but use more CPU + [-s []] [-l ] + [--num-retry-connect []] + [-R []] + [--force-major-gc-interval []] + [--log_to []] + + --help help information + -d, --dist enable distribution port + -h, --host mqtt server hostname or comma-separated + hostnames [default: localhost] + -p, --port mqtt server port number [default: 1883] + -V, --version mqtt protocol version: 3 | 4 | 5 [default: 5] + -c, --count max count of clients [default: 200] + -n, --startnumber start number [default: 0] + -i, --interval interval of connecting to the broker + [default: 10] + -t, --topic topic subscribe, support %u, %c, %i variables + -q, --qos subscribe qos [default: 0] + -Q, --qoe Enable QoE tracking [default: false] + -u, --username username for connecting to server + -P, --password password for connecting to server + -k, --keepalive keep alive in seconds [default: 300] + -C, --clean clean start [default: true] + -x, --session-expiry Set 'Session-Expiry' for persistent sessions + (seconds) [default: 0] + -S, --ssl ssl socoket for connecting to server + [default: false] + --certfile client certificate for authentication, if + required by server + --keyfile client private key for authentication, if + required by server + --ws websocket transport [default: false] + --quic QUIC transport [default: false] + --load-qst load quic session tickets from dets file + --ifaddr local ipaddress or interface address + --prefix client id prefix + -s, --shortids use short ids for client ids [default: false] + -l, --lowmem enable low mem mode, but use more CPU + --num-retry-connect number of times to retry estabilishing a + connection before giving up [default: 0] + -R, --connrate connection rate(/s), default: 0, fallback to + use --interval [default: 0] + --force-major-gc-interval interval in milliseconds in which a major GC + will be forced on the bench processes. a + value of 0 means disabled (default). this + only takes effect when used together with + --lowmem. [default: 0] + --log_to Control where the log output goes. console: + directly to the console null: quietly, + don't output any logs. [default: console] ``` For example, create 50K concurrent connections at the arrival rate of 100/sec: @@ -134,52 +179,96 @@ For example, create 50K concurrent connections at the arrival rate of 100/sec: ## Pub Benchmark ```sh -$ ./emqtt_bench pub --help -Usage: emqtt_bench pub [--help ] [-h []] [-p []] - [-V []] [-c []] +./emqtt_bench pub --help +Usage: emqtt_bench pub [--help ] [-d ] [-h []] + [-p []] [-V []] [-c []] [-n []] [-i []] [-I []] [-u ] [-P ] [-t ] [-s []] - [-q []] [-r []] [-k []] - [-C []] [-x []] [-L []] - [-S []] [--certfile ] - [--keyfile ] [--ws []] - [--quic []] [--ifaddr ] - [--prefix ] [-l ] - - --help help information - -h, --host mqtt server hostname or comma-separated hostnames [default: - localhost] - -p, --port mqtt server port number [default: 1883] - -V, --version mqtt protocol version: 3 | 4 | 5 [default: 5] - -c, --count max count of clients [default: 200] - -n, --startnumber start number [default: 0] - -i, --interval interval of connecting to the broker [default: 10] - -I, --interval_of_msg interval of publishing message(ms) [default: 1000] - -u, --username username for connecting to server - -P, --password password for connecting to server - -t, --topic topic subscribe, support %u, %c, %i variables - -s, --size payload size [default: 256] - -q, --qos subscribe qos [default: 0] - -r, --retain retain message [default: false] - -k, --keepalive keep alive in seconds [default: 300] - -C, --clean clean start [default: true] - -x, --session-expiry Set 'Session-Expiry' for persistent sessions - (seconds) [default: 0] - -L, --limit The max message count to publish, 0 means - unlimited [default: 0] - -S, --ssl ssl socoket for connecting to server [default: - false] - --certfile client certificate for authentication, if - required by server - --keyfile client private key for authentication, if - required by server - --ws websocket transport [default: false] - --quic QUIC transport [default: false] - --ifaddr One or multiple (comma-separated) source IP - addresses - --prefix client id prefix - -l, --lowmem enable low mem mode, but use more CPU + [-m ] [-q []] [-Q []] + [--load-qst ] [-r []] + [-k []] [-C []] [-x []] + [-L []] [-S []] + [--certfile ] [--keyfile ] + [--ws []] [--quic []] + [--ifaddr ] [--prefix ] + [-s []] [-l ] [-F []] + [-w []] + [--max-random-wait []] + [--min-random-wait []] + [--num-retry-connect []] + [-R []] + [--force-major-gc-interval []] + [--log_to []] + + --help help information + -d, --dist enable distribution port + -h, --host mqtt server hostname or comma-separated + hostnames [default: localhost] + -p, --port mqtt server port number [default: 1883] + -V, --version mqtt protocol version: 3 | 4 | 5 [default: + 5] + -c, --count max count of clients [default: 200] + -n, --startnumber start number [default: 0] + -i, --interval interval of connecting to the broker + [default: 10] + -I, --interval_of_msg interval of publishing message(ms) + [default: 1000] + -u, --username username for connecting to server + -P, --password password for connecting to server + -t, --topic topic subscribe, support %u, %c, %i, %s + variables + -s, --size payload size [default: 256] + -m, --message set the message content for publish + -q, --qos subscribe qos [default: 0] + -Q, --qoe Enable QoE tracking [default: false] + -r, --retain retain message [default: false] + -k, --keepalive keep alive in seconds [default: 300] + -C, --clean clean start [default: true] + -x, --session-expiry Set 'Session-Expiry' for persistent + sessions (seconds) [default: 0] + -L, --limit The max message count to publish, 0 means + unlimited [default: 0] + -S, --ssl ssl socoket for connecting to server + [default: false] + --certfile client certificate for authentication, if + required by server + --keyfile client private key for authentication, if + required by server + --ws websocket transport [default: false] + --quic QUIC transport [default: false] + --load-qst load quic session tickets from dets file + --ifaddr One or multiple (comma-separated) source + IP addresses + --prefix client id prefix + -s, --shortids use short ids for client ids [default: + false] + -l, --lowmem enable low mem mode, but use more CPU + -F, --inflight maximum inflight messages for QoS 1 an 2, + value 0 for 'infinity' [default: 1] + -w, --wait-before-publishing wait for all publishers to have (at least + tried to) connected before starting + publishing [default: false] + --max-random-wait maximum randomized period in ms that each + publisher will wait before starting to + publish (uniform distribution) [default: 0] + --min-random-wait minimum randomized period in ms that each + publisher will wait before starting to + publish (uniform distribution) [default: 0] + --num-retry-connect number of times to retry estabilishing a + connection before giving up [default: 0] + -R, --connrate connection rate(/s), default: 0, fallback + to use --interval [default: 0] + --force-major-gc-interval interval in milliseconds in which a major + GC will be forced on the bench processes. + a value of 0 means disabled (default). + this only takes effect when used together + with --lowmem. [default: 0] + --log_to Control where the log output goes. + console: directly to the console + null: quietly, don't output any logs. + [default: console] + ``` For example, create 100 connections and each publishes messages at the rate of 100 msg/sec. diff --git a/src/emqtt_bench.erl b/src/emqtt_bench.erl index 64d8e01..5cbe7e8 100644 --- a/src/emqtt_bench.erl +++ b/src/emqtt_bench.erl @@ -56,6 +56,8 @@ "set the message content for publish"}, {qos, $q, "qos", {integer, 0}, "subscribe qos"}, + {qoe, $Q, "qoe", {boolean, false}, + "Enable QoE tracking"}, {retain, $r, "retain", {boolean, false}, "retain message"}, {keepalive, $k, "keepalive", {integer, 300}, @@ -76,6 +78,7 @@ "websocket transport"}, {quic, undefined, "quic", {boolean, false}, "QUIC transport"}, + {nst_dets_file, undefined, "load-qst", string, "load quic session tickets from dets file"}, {ifaddr, undefined, "ifaddr", string, "One or multiple (comma-separated) source IP addresses"}, {prefix, undefined, "prefix", string, "client id prefix"}, @@ -127,6 +130,8 @@ "topic subscribe, support %u, %c, %i variables"}, {qos, $q, "qos", {integer, 0}, "subscribe qos"}, + {qoe, $Q, "qoe", {boolean, false}, + "Enable QoE tracking"}, {username, $u, "username", string, "username for connecting to server"}, {password, $P, "password", string, @@ -147,6 +152,7 @@ "websocket transport"}, {quic, undefined, "quic", {boolean, false}, "QUIC transport"}, + {nst_dets_file, undefined, "load-qst", string, "load quic session tickets from dets file"}, {ifaddr, undefined, "ifaddr", string, "local ipaddress or interface address"}, {prefix, undefined, "prefix", string, "client id prefix"}, @@ -181,6 +187,8 @@ {count, $c, "count", {integer, 200}, "max count of clients"}, {startnumber, $n, "startnumber", {integer, 0}, "start number"}, + {qoe, $Q, "qoe", {boolean, false}, + "Enable QoE tracking"}, {interval, $i, "interval", {integer, 10}, "interval of connecting to the broker"}, {username, $u, "username", string, @@ -201,6 +209,7 @@ "client private key for authentication, if required by server"}, {quic, undefined, "quic", {boolean, false}, "QUIC transport"}, + {nst_dets_file, undefined, "load-qst", string, "load quic session tickets from dets file"}, {ifaddr, undefined, "ifaddr", string, "local ipaddress or interface address"}, {prefix, undefined, "prefix", string, "client id prefix"}, @@ -816,6 +825,8 @@ mqtt_opts([{ssl, Bool}|Opts], Acc) -> mqtt_opts(Opts, [{ssl, Bool}|Acc]); mqtt_opts([{lowmem, Bool}|Opts], Acc) -> mqtt_opts(Opts, [{low_mem, Bool} | Acc]); +mqtt_opts([{qoe, Bool}|Opts], Acc) -> + mqtt_opts(Opts, [{with_qoe_metrics, Bool} | Acc]); mqtt_opts([{inflight, InFlight0}|Opts], Acc) -> InFlight = case InFlight0 of 0 -> infinity;