Git Product home page Git Product logo

emqtt-bench's Introduction

Lightweight MQTT Benchmark Tool written in Erlang

image

eMQTT-Bench is a lightweight MQTT v5.0 benchmark tool written in Erlang.

You can download pre-built binary packeges from https://github.com/emqx/emqtt-bench/releases.

Build from source code

NOTE: Requires Erlang/OTP 22.3+ to build.

Install dependencies

emqtt-bench requires libatomic

# centos 7
sudo yum install libatomic
# ubuntu 20.04
sudo apt install libatomic1 

make

git clone https://github.com/emqx/emqtt-bench.git
cd emqtt-bench
make

Optional, you could disable QUIC support if you have problem with compiling

BUILD_WITHOUT_QUIC=1 make

Connect Benchmark

$ ./emqtt_bench conn --help
Usage: emqtt_bench conn [--help <help>] [-d <dist>] [-h [<host>]]
                        [-p [<port>]] [-V [<version>]] [-c [<count>]]
                        [-n [<startnumber>]] [--load-qst <nst_dets_file>]
                        [-Q [<qoe>]] [-i [<interval>]] [-u <username>]
                        [-P <password>] [-k [<keepalive>]] [-C [<clean>]]
                        [-x [<expiry>]] [-S [<ssl>]]
                        [--certfile <certfile>] [--keyfile <keyfile>]
                        [--quic [<quic>]] [--ifaddr <ifaddr>]
                        [--prefix <prefix>] [-s [<shortids>]]
                        [-l <lowmem>]
                        [--num-retry-connect [<num_retry_connect>]]
                        [-R [<conn_rate>]]
                        [--force-major-gc-interval [<force_major_gc_interval>]]
                        [--log_to [<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]

For example, create 50K concurrent connections at the arrival rate of 100/sec:

./emqtt_bench conn -c 50000 -i 10

Sub Benchmark

$ ./emqtt_bench sub --help
Usage: emqtt_bench sub [--help <help>] [-d <dist>] [-h [<host>]] [-p [<port>]] [-V [<version>]] [-c [<count>]]
                       [-n [<startnumber>]] [-i [<interval>]] [-t <topic>] [--payload-hdrs [<payload_hdrs>]] [-q [<qos>]]
                       [-Q [<qoe>]] [-u <username>] [-P <password>] [-k [<keepalive>]] [-C [<clean>]] [-x [<expiry>]]
                       [-S [<ssl>]] [--certfile <certfile>] [--keyfile <keyfile>] [--ws [<ws>]] [--quic [<quic>]]
                       [--load-qst <nst_dets_file>] [--ifaddr <ifaddr>] [--prefix <prefix>] [-s [<shortids>]] [-l <lowmem>]
                       [--num-retry-connect [<num_retry_connect>]] [-R [<conn_rate>]]
                       [--force-major-gc-interval [<force_major_gc_interval>]] [--log_to [<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          The start point when assigning sequence numbers to clients. This is useful when running 
                             multiple emqtt-bench instances to test the same broker (cluster), so the start number can be 
                             planned to avoid client ID collision [default: 0]
  -i, --interval             interval of connecting to the broker [default: 10]
  -t, --topic                topic subscribe, support %u, %c, %i variables
  --payload-hdrs             Handle the payload header from received message. Publish side must have the same option enabled 
                             in the same order. cnt64: Check the counter is strictly increasing. ts: publish latency counting. 
                             [default: ]
  -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. If not provided '$HOST_bench_(pub|sub)_$RANDOM_$N' is used, where $HOST is 
                             either the host name or the IP address provided in the --ifaddr option, $RANDOM is a random 
                             number and $N is the sequence number assigned for each client. If provided, the $RANDOM suffix 
                             will not be added.
  -s, --shortids             Use short client ID. If --prefix is provided, the prefix is added otherwise client ID is the 
                             assigned sequence number. [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:

./emqtt_bench sub -c 50000 -i 10 -t bench/%i -q 2

Pub Benchmark

Usage: emqtt_bench pub [--help <help>] [-d <dist>] [-h [<host>]] [-p [<port>]] [-V [<version>]] [-c [<count>]]
                       [-n [<startnumber>]] [-i [<interval>]] [-I [<interval_of_msg>]] [-u <username>] [-P <password>]
                       [-t <topic>] [--payload-hdrs [<payload_hdrs>]] [-s [<size>]] [-m <message>] [-q [<qos>]]
                       [-Q [<qoe>]] [-r [<retain>]] [-k [<keepalive>]] [-C [<clean>]] [-x [<expiry>]] [-L [<limit>]]
                       [-S [<ssl>]] [--certfile <certfile>] [--keyfile <keyfile>] [--ws [<ws>]] [--quic [<quic>]]
                       [--load-qst <nst_dets_file>] [--ifaddr <ifaddr>] [--prefix <prefix>] [-s [<shortids>]] [-l <lowmem>]
                       [-F [<inflight>]] [-w [<wait_before_publishing>]] [--max-random-wait [<max_random_wait>]]
                       [--min-random-wait [<min_random_wait>]] [--num-retry-connect [<num_retry_connect>]]
                       [-R [<conn_rate>]] [--force-major-gc-interval [<force_major_gc_interval>]] [--log_to [<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             The start point when assigning sequence numbers to clients. This is useful when running 
                                multiple emqtt-bench instances to test the same broker (cluster), so the start number can be 
                                planned to avoid client ID collision [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
  --payload-hdrs                 If set, add optional payload headers. cnt64: strictly increasing counter(64bit) per publisher 
                                ts: Timestamp when emit example: --payload-hdrs cnt64,ts [default: ]
  -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. If not provided '$HOST_bench_(pub|sub)_$RANDOM_$N' is used, where $HOST is 
                                either the host name or the IP address provided in the --ifaddr option, $RANDOM is a random 
                                number and $N is the sequence number assigned for each client. If provided, the $RANDOM 
                                suffix will not be added.
  -s, --shortids                Use short client ID. If --prefix is provided, the prefix is added otherwise client ID is the 
                                assigned sequence number. [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.

./emqtt_bench pub -c 100 -I 10 -t bench/%i -s 256

Local interface

./emqtt_bench pub --ifaddr 192.168.1.10
./emqtt_bench sub --ifaddr 192.168.2.10

TLS/SSL (cliet certificate is not required by server)

./emqtt_bench sub -c 100 -i 10 -t bench/%i -p 8883 --ssl
./emqtt_bench pub -c 100 -I 10 -t bench/%i -p 8883 -s 256 --ssl

TLS/SSL (client certificate is required by server)

./emqtt_bench sub -c 100 -i 10 -t bench/%i -p 8883 --ssl --certfile path/to/client-cert.pem --keyfile path/to/client-key.pem
./emqtt_bench pub -c 100 -i 10 -t bench/%i -s 256 -p 8883 --ssl --certfile path/to/client-cert.pem --keyfile path/to/client-key.pem

Notice

You should not set '-c' option more than 64K for TCP ports limit on one source addresses, however you can send messages from multiple source IP Addresses with '--ifaddr ' such like

./emqtt_bench sub -c 200000 -t "perf/test" --ifaddr 192.168.200.18,192.168.200.19,192.168.200.20,192.168.200.21

Make sure to increase resource usage limits and expand the port range like following on Linux.

ulimit -n 200000
sudo sysctl -w net.ipv4.ip_local_port_range="1025 65534"

Author

EMQX Team.

emqtt-bench's People

Contributors

1995parham avatar emqplus avatar enrahmad avatar gilbertwong96 avatar gorillainduction avatar hjianbo avatar huangdan avatar id avatar jfallows avatar jimmoen avatar keynslug avatar kianmeng avatar lafirest avatar qzhuyan avatar rory-z avatar seongmin avatar spring2maz avatar terry-xiaoyu avatar thalesmg avatar tigercl avatar turtledeng avatar x1001100011 avatar zmstone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

emqtt-bench's Issues

Benchmarking Clients support reconnect?

Am I right in observing that if the virtual clients lose their connection to the broker that the do not reconnect?

How difficult would adding this be, given some pointers I'd be willing to give it a try.

i set the system “ulimit -n 10240” and when the connection over 3000,the error is appear

connect error - timeout
=ERROR REPORT==== 25-Oct-2019::16:51:41.512595 ===
** State machine <0.5760.0> terminating
** Last event = {{call,{<0.5759.0>,#Ref<0.746098873.1983905793.96603>}},
{connect,emqtt_sock}}
** When server state = {initialized,
{state,undefined,<0.5759.0>,undefined,
"192.168.99.14",1883,[],emqtt_sock,undefined,
[],60000,false,
<<"tangmanrong-virtual-machine_bench_conn_173_1560344030">>,
true,undefined,undefined,4,<<"MQTT">>,300,
undefined,false,false,false,
{mqtt_msg,0,false,false,undefined,undefined,
undefined,undefined},
#{},[],#{},infinity,#{},#{},true,30000,
undefined,0,undefined,undefined,1,
{none,#{max_size => 268435455,version => 4}}}}
** Reason for termination = exit:timeout
** Callback mode = state_functions
** Stacktrace =
** [{gen_statem,loop_state_callback_result,11,
[{file,"gen_statem.erl"},{line,1306}]},
{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]
** Client <0.5759.0> stacktrace^C

DEFAULT FORMATTER CRASHEDDEFAULT

REPORT_CB/2 CRASH: #{label => {proc_lib,crash},
report =>
[[{initial_call,{emqtt,init,['Argument__1']}},
{pid,<0.620.0>},
{registered_name,[]},
{error_info,
{error,undef,
[{sys,get_log,[[]],[]},
{gen_statem,error_info,7,
[{file,"gen_statem.erl"},{line,2195}]},
{gen_statem,terminate,7,
[{file,"gen_statem.erl"},{line,2174}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,249}]}]}},
{ancestors,[<0.619.0>]},
{message_queue_len,1},
{messages,[{'EXIT',<0.619.0>,normal}]},
{links,[]},
{dictionary,[]},
{trap_exit,true},
{status,running},
{heap_size,987},
{stack_size,27},
{reductions,1544}],
[]]}; Reason: {error,undef,
[{erl_error,format_exception,
[5,error,undef,
[{sys,get_log,[[]],[]},
{gen_statem,error_info,7,
[{file,"gen_statem.erl"},
{line,2195}]},
{gen_statem,terminate,7,
[{file,"gen_statem.erl"},
{line,2174}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},
{line,249}]}],
#Fun<proc_lib.0.36012461>,
#Fun<proc_lib.1.36012461>,utf8],
[]},
{proc_lib,format_exception,4,
[{file,"proc_lib.erl"},{line,851}]},
{proc_lib,format_rep,3,
[{file,"proc_lib.erl"},{line,830}]},
{proc_lib,format_rep,3,
[{file,"proc_lib.erl"},{line,833}]},
{proc_lib,format_rep,3,
[{file,"proc_lib.erl"},{line,828}]},
{proc_lib,format_report,3,
[{file,"proc_lib.erl"},{line,815}]},
{proc_lib,do_format,2,
[{file,"proc_lib.erl"},{line,793}]}]}
DEFAULT FORMATTER CRASHEDDEFAULT FORMATTER CRASHEDDEFAULT FORMATTER CRASHEDDEFAULT FORMATTER CRASHED^C

escript: exception error: undefined function counters:new/2

Hi! I met this problem after finishing "make" process:

escript: exception error: undefined function counters:new/2
in function emqtt_bench:init/0 (/app/install/emqtt_benchmark/emqtt-bench/src/emqtt_bench.erl, line 176)
in call from emqtt_bench:start/2 (/app/install/emqtt_benchmark/emqtt-bench/src/emqtt_bench.erl, line 167)
in call from escript:run/2 (escript.erl, line 758)
in call from escript:start/1 (escript.erl, line 277)
in call from init:start_em/1
in call from init:do_boot/3

I've installed erlang/OTP 21.0 and rebar3.

Unable to benchmark on 1500 Subscription

I have created a cluster of two nodes and join them together, each node is of 1 GB RAM nd 24 GB HardDisk. As well as I have HAproxy behind the two cluster for load balancing the request to EMQTTD cluster. I have tunned each of the machines according to the tunning guide. I have defined all the tunning in the file /etc/sysctl.conf.

/etc/sysctl.conf
fs.file-max = 1048576
net.ipv4.tcp_max_tw_buckets=1048576
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_fin_timeout = 15
net.netfilter.nf_conntrack_tcp_timeout_time_wait=30
net.netfilter.nf_conntrack_max=1000000
net.nf_conntrack_max=1000000
net.core.somaxconn=32768
net.ipv4.tcp_max_syn_backlog=16384
net.core.netdev_max_backlog=16384
net.ipv4.ip_local_port_range=1000 65535
net.core.rmem_default=262144
net.core.wmem_default=262144
net.core.rmem_max=16777216
net.core.wmem_max=16777216
net.core.optmem_max=16777216
net.ipv4.tcp_rmem=1024 4096 16777216
net.ipv4.tcp_wmem=1024 4096 16777216

when I hit the load balancer with emqttd_benchmark command

./emqtt_bench_sub -h ... -p **** -c 1500 -i 100 -t ****** -q 2 -k 40000 -c false

then afterwards I get an error of [error] [Client <0.4506.0>] CONNACK Timeout! or I get an error of
client 2499 EXIT: {shutdown,tcp_closed}.

when I execute the benchmark command with 500 clients then it work well without giving any error but when I increase the clients then it throws an error of CONNACK Timeout! or client 2499 EXIT: {shutdown,tcp_closed}.

Please help me how should I do it. My target is to make at least 10000 concurrent connections with the cluster and able to send a message to all 10000 clients.

usr/bin/env: escript: No such file or directory

Environment

-Server: AWS

OS: Centos 7
Erlang/OTP: otp_src_19.2.tar.gz
EMQ: v2.0.4
Description

I have two Server on AWS 👍

OS: Centos 7
EMQ: v2.0.4

sorry I want to make emqtt_benchmark
but...
[root@ip-xxx-xx-xx-xx emqtt_benchmark]# make
/usr/bin/env: escript: No such file or directory
make: *** [get-deps] Error 127

Do I have to have an env directory?
And then How I make escript??

it can’t work Follow the steps

WARN: Expected /home/congzhou/engyne/test/Server/emqtt_benchmark-master/deps/emqttc to be an app dir (containing ebin/.app), but no .app found.
WARN: Expected /home/congzhou/engyne/test/Server/emqtt_benchmark-master/deps/getopt to be an app dir (containing ebin/
.app), but no .app found.
==> emqtt_benchmark-master (get-deps)
WARN: Expected /home/congzhou/engyne/test/Server/emqtt_benchmark-master/deps/emqttc to be an app dir (containing ebin/.app), but no .app found.
WARN: Expected /home/congzhou/engyne/test/Server/emqtt_benchmark-master/deps/getopt to be an app dir (containing ebin/
.app), but no .app found.
Pulling emqttc from {git,"git://github.com/emqtt/emqttc.git",
{branch,"master"}}
正克隆到 'emqttc'...
Pulling getopt from {git,"https://github.com/jcomellas/getopt.git",
{branch,"master"}}
正克隆到 'getopt'...
WARN: Expected /home/congzhou/engyne/test/Server/emqtt_benchmark-master/deps/gen_logger to be an app dir (containing ebin/.app), but no .app found.
==> getopt (get-deps)
==> emqttc (get-deps)
WARN: Expected /home/congzhou/engyne/test/Server/emqtt_benchmark-master/deps/gen_logger to be an app dir (containing ebin/
.app), but no .app found.
Pulling gen_logger from {git,"https://github.com/emqtt/gen_logger.git",
{branch,"master"}}
正克隆到 'gen_logger'...
WARN: Expected /home/congzhou/engyne/test/Server/emqtt_benchmark-master/deps/lager to be an app dir (containing ebin/.app), but no .app found.
==> gen_logger (get-deps)
WARN: Expected /home/congzhou/engyne/test/Server/emqtt_benchmark-master/deps/lager to be an app dir (containing ebin/
.app), but no .app found.
Pulling lager from {git,"git://github.com/basho/lager.git",{branch,"master"}}
正克隆到 'lager'...
WARN: Expected /home/congzhou/engyne/test/Server/emqtt_benchmark-master/deps/goldrush to be an app dir (containing ebin/.app), but no .app found.
==> lager (get-deps)
WARN: Expected /home/congzhou/engyne/test/Server/emqtt_benchmark-master/deps/goldrush to be an app dir (containing ebin/
.app), but no .app found.
Pulling goldrush from {git,"git://github.com/DeadZen/goldrush.git",
{tag,"0.1.8"}}
正克隆到 'goldrush'...
==> goldrush (get-deps)
==> goldrush (compile)
ERROR: OTP release R17 or later is required, you have: R16B03
ERROR: compile failed while processing /home/congzhou/engyne/test/Server/emqtt_benchmark-master/deps/goldrush: rebar_abort
make: *** [compile] 错误 1

Publishing occasionally stops

Hello,

I'm running benchmarks against a single EMQTT 2.0.5 node, and sometimes the benchmark tool emqtt_bench_pub gives me the following error in its console:

sent(3143000): total=12220299, rate=6(msg/sec)
client 422 EXIT: {shutdown,einval}
sent(3144000): total=12220304, rate=5(msg/sec)
sent(3145000): total=12220309, rate=5(msg/sec)
sent(3146000): total=12220314, rate=5(msg/sec)
client 483 EXIT: {shutdown,einval}
sent(3147000): total=12220318, rate=4(msg/sec)
sent(3148000): total=12220322, rate=4(msg/sec)
client 412 EXIT: {shutdown,einval}
sent(3149000): total=12220326, rate=4(msg/sec)
sent(3150000): total=12220329, rate=3(msg/sec)
sent(3151001): total=12220332, rate=3(msg/sec)
client 420 EXIT: {shutdown,einval}
sent(3152000): total=12220334, rate=2(msg/sec)
sent(3153000): total=12220336, rate=2(msg/sec)
sent(3154000): total=12220338, rate=2(msg/sec)
sent(3155000): total=12220340, rate=2(msg/sec)
sent(3156000): total=12220342, rate=2(msg/sec)
sent(3157000): total=12220344, rate=2(msg/sec)
sent(3158000): total=12220346, rate=2(msg/sec)
sent(3159000): total=12220348, rate=2(msg/sec)
sent(3160000): total=12220350, rate=2(msg/sec)
sent(3161000): total=12220352, rate=2(msg/sec)
sent(3162000): total=12220354, rate=2(msg/sec)
sent(3163000): total=12220356, rate=2(msg/sec)
sent(3164001): total=12220358, rate=2(msg/sec)
sent(3165000): total=12220360, rate=2(msg/sec)
sent(3166001): total=12220362, rate=2(msg/sec)
sent(3167000): total=12220364, rate=2(msg/sec)
sent(3168000): total=12220366, rate=2(msg/sec)
sent(3169000): total=12220368, rate=2(msg/sec)
sent(3170000): total=12220370, rate=2(msg/sec)
sent(3171000): total=12220372, rate=2(msg/sec)
sent(3172000): total=12220374, rate=2(msg/sec)
sent(3173000): total=12220376, rate=2(msg/sec)
sent(3174001): total=12220378, rate=2(msg/sec)
sent(3175000): total=12220380, rate=2(msg/sec)
sent(3176000): total=12220382, rate=2(msg/sec)
sent(3177000): total=12220384, rate=2(msg/sec)
sent(3178000): total=12220386, rate=2(msg/sec)
sent(3179000): total=12220388, rate=2(msg/sec)
sent(3180000): total=12220390, rate=2(msg/sec)
sent(3181000): total=12220392, rate=2(msg/sec)
client 108 EXIT: {shutdown,einval}
sent(3182000): total=12220394, rate=2(msg/sec)
sent(3183000): total=12220395, rate=1(msg/sec)
sent(3184000): total=12220396, rate=1(msg/sec)
sent(3185000): total=12220397, rate=1(msg/sec)
sent(3186000): total=12220398, rate=1(msg/sec)
sent(3187000): total=12220399, rate=1(msg/sec)
client 102 EXIT: {shutdown,einval}

Do you have any idea what could cause the einval error?

Thanks!

publish error - einval

client(71): publish error - einval =ERROR REPORT==== 10-Sep-2019::14:56:20.014672 === ** State machine <0.164.0> terminating ** Last event = {{call,{<0.163.0>,#Ref<0.2879060264.781713413.155584>}}, {publish,{mqtt_msg,0,false,false,undefined,<<"bench/71">>, #{}, <<0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0>>}}} ** When server state = {connected, {state,undefined,<0.163.0>,undefined, "47.*.*.*",1883,[],emqtt_sock,#Port<0.64>, [],60000,false, <<"zhuhuis-MacBook-Pro_bench_pub_71_4191079359">>, true,undefined,undefined,5,<<"MQTT">>,300, #Ref<0.2879060264.781713411.121982>,false, false,false, {mqtt_msg,0,false,false,undefined,undefined, undefined,undefined}, #{'Maximum-Packet-Size' => 1048576, 'Retain-Available' => 1, 'Shared-Subscription-Available' => 1, 'Subscription-Identifier-Available' => 1, 'Topic-Alias-Maximum' => 0, 'Wildcard-Subscription-Available' => 1}, [],#{},infinity,#{},#{},true,30000,undefined, 0,undefined,0,524, {none,#{max_size => 268435455,version => 5}}}} ** Reason for termination = exit:einval ** Callback mode = state_functions ** Stacktrace = ** [{gen_statem,loop_state_callback_result,11, [{file,"gen_statem.erl"},{line,1292}]}, {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}] ** Client <0.163.0> stacktrace ** [{gen,do_call,4,[{file,"gen.erl"},{line,167}]}, {gen_statem,call_dirty,4,[{file,"gen_statem.erl"},{line,611}]}, {emqtt_bench,loop,4, [{file,"/Users/zhuhui/Desktop/emqx/emqtt_benchmark/src/emqtt_bench.erl"}, {line,307}]}]
cn:当我 使用 emqtt_benchmark 做 压测, 10个客户端以每秒100条来发布消息 ,出现这样的错误日志。我不明白为什么会提示这个?
en:When I use emqtt_benchmark to test emqtt service's profile,I got this error log.I want to know why this happen.
image

emqtt MAX concurrent client benchmarking problem

We were trying to benchmarking emqtt broker(mostly interested on getting a number for max concurrent clients it can support). We have followed http://docs.emqtt.com/en/latest/tune.html to tune both the broker and the test clients on AWS. The results we got are far from what we read from emqttd wiki, e.g. for one million concurrent MQTT connections(as well as the only benchmark results for 0.12 release reading from https://github.com/emqtt/emqttd/wiki/benchmark-for-0.12.0-release.) We did not see any error logs on broker, only thing we noticed was that all the test clients started to timeout as shown in the screenshot.
shutdown_timeout

You can see the details of our test setup/configuration, test result from the attached file.
emqttd Benchmarking reports - Sheet1.pdf

My question is, What could be the potential bottle neck in our setup? what kind of hardware we need in order to get close-to-advertised concurrent connections? Thank you.

Unable to connect emqtt_benchmark client to emqtt broker

I try run command (from docker) - ./emqtt_bench pub -h 37.128.111.31 -c 1 -t load/test/ -u dev -P pass -p 8883 -S true, but can't connect to mqtt broker.
The mqtt broker use tls and login, password.
emqtt-bench is latest version 0.4 (maked from master)

Error lLog:

=ERROR REPORT==== 7-Dec-2019::20:27:54.356471 ===
** State machine <0.104.0> terminating
** Last event = {{call,{<0.102.0>,#Ref<0.3470881607.950534145.230614>}},
                 {connect,emqtt_sock}}
** When server state  = {initialized,
                            {state,undefined,<0.102.0>,undefined,
                                "37.128.111.31",8883,[],emqtt_sock,undefined,
                                [{ssl_opts,{ssl,[]}}],
                                60000,false,
                                <<"bf9f0447b6cd_bench_pub_1_2064832430">>,
                                true,<<"dev">>,<<"pass">>,5,<<"MQTT">>,300,
                                undefined,false,false,false,
                                {mqtt_msg,0,false,false,undefined,undefined,
                                    undefined,undefined},
                                #{},[],#{},infinity,#{},#{},true,30000,
                                undefined,0,undefined,undefined,1,
                                {none,#{max_size => 268435455,version => 5}}}}
** Reason for termination = error:function_clause
** Callback mode = state_functions
** Stacktrace =
**  [{proplists,get_value,
                [versions,{ssl,[]},[]],
                [{file,"proplists.erl"},{line,215}]},
     {emqtt_sock,ssl_upgrade,3,
                 [{file,"/opt/emqtt/_build/default/lib/emqtt/src/emqtt_sock.erl"},
                  {line,60}]},
     {emqtt,sock_connect,5,
            [{file,"/opt/emqtt/_build/default/lib/emqtt/src/emqtt.erl"},
             {line,1247}]},
     {emqtt,initialized,3,
            [{file,"/opt/emqtt/_build/default/lib/emqtt/src/emqtt.erl"},
             {line,629}]},
     {gen_statem,loop_state_callback,11,[{file,"gen_statem.erl"},{line,1159}]},
     {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]
** Client <0.102.0> stacktrace
** [{gen,do_call,4,[{file,"gen.erl"},{line,167}]},
    {gen_statem,call_dirty,4,[{file,"gen_statem.erl"},{line,619}]},
    {emqtt_bench,connect,4,
                 [{file,"/opt/emqtt/src/emqtt_bench.erl"},{line,286}]}]

=CRASH REPORT==== 7-Dec-2019::20:27:54.370527 ===
  crasher:
    initial call: emqtt:init/1
    pid: <0.104.0>
    registered_name: []
    exception error: no function clause matching
                     proplists:get_value(versions,{ssl,[]},[]) (proplists.erl, line 215)
      in function  emqtt_sock:ssl_upgrade/3 (/opt/emqtt/_build/default/lib/emqtt/src/emqtt_sock.erl, line 60)
      in call from emqtt:sock_connect/5 (/opt/emqtt/_build/default/lib/emqtt/src/emqtt.erl, line 1247)
      in call from emqtt:initialized/3 (/opt/emqtt/_build/default/lib/emqtt/src/emqtt.erl, line 629)
      in call from gen_statem:loop_state_callback/11 (gen_statem.erl, line 1159)
    ancestors: [<0.102.0>]
    message_queue_len: 0
    messages: []
    links: [<0.102.0>,#Port<0.7>]
    dictionary: []
    trap_exit: true
    status: running
    heap_size: 6772
    stack_size: 27
    reductions: 16631
  neighbours:

shutdown,eaddrnotavail

I am trying to connect to 50000 connections to emqttd. But after 27003 connections i am getting client EXIT: {shutdown,eaddrnotavail}

emqtt_benchamark测试结果数据

测试参数:emqtt_bench_pub -c 20000 -q 2 -I 10,我模拟2万个客户端,发送消息质量为2,每个10ms发送消息,得带的测试结果数据是:sent(15520682): total=19818018,rate=81616(msg/sec),这些结果数据代表什么含义啊?是每一台客户端发送消息81616?还是2万台客户端速率?sent是指发送成功发送消息数量?total是总共发送消息数量?

emqtt benchmark client error

Hi,

We are trying to evaluate the emqtt server with 1node - 4vcpu, 16gb ram, 500K connection limit.

I am receiving this error on the client once it reaches 16k connections.

conneted: 16252
client 33748 EXIT: {shutdown,eaddrnotavail}
Topics: ["/t/b/a/%i"]

I have added the below config on sysctl.conf

net.ipv4.ip_local_port_range = 1024 65535
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_mem = 5242880 5242880 15242880
net.ipv4.tcp_tw_recycle = 1
fs.file-max = 20000000
fs.nr_open = 20000000

ulimit -a

core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 62800
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 500000
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 500000
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited

OS: Ubuntu 16.10

Can you help me to fix this issue, I feel its like something to do with kernel parameters.

emqtt_bench_pub published messages log.

I am using this tool for the load generation on the EMQTT Broker, and I observed that when I stop the tool lets say by 1 hour then total messages shown by the tool in the logs is different than what I receive at the Broker End. So not sure whether the tool is misleading or broker dropping the messages. But Broker is not showing anywhere about the dropped messages. Can you please look into the issue.

Benchmark scripts crashing on launch

=ERROR REPORT==== 10-Jul-2018::10:31:01.496799 ===
** State machine <0.149.0> terminating 
** Last event in was timeout
** When State == connecting
**      Data  == {state,<0.148.0>,"<0.148.0>","10.91.1.127",1883,undefined,
                     undefined,
                     {proto_state,undefined,undefined,4,<<"MQTT">>,
                         <<"85f23a76f701_bench_pub_1_2254550004">>,true,300,
                         false,
                         {mqtt_message,0,false,false,undefined,undefined,
                             undefined},
                         undefined,undefined,1,#{},#{},#{},#{},
                         {gen_logger,console_logger,8}},
                     [],#{},[],[],#{},undefined,false,false,undefined,300,60,
                     4,8,undefined,tcp,undefined,
                     {gen_logger,console_logger,8},
                     [],[]}
** Reason for termination = 
** {badarg,[{erlang,apply,[{gen_logger,console_logger,8},info,[]],[]},
            {emqttc,connect,1,[{file,"src/emqttc.erl"},{line,956}]},
            {gen_fsm,handle_msg,8,[{file,"gen_fsm.erl"},{line,486}]},
            {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]}

client 1 EXIT: {badarg,[{erlang,apply,
                                [{gen_logger,console_logger,8},info,[]],
                                []},
                        {emqttc,connect,1,
                                [{file,"src/emqttc.erl"},{line,956}]},
                        {gen_fsm,handle_msg,8,
                                 [{file,"gen_fsm.erl"},{line,486}]},
                        {proc_lib,init_p_do_apply,3,
                                  [{file,"proc_lib.erl"},{line,249}]}]}
=CRASH REPORT==== 10-Jul-2018::10:31:01.499716 ===
  crasher:
    initial call: emqttc:init/1
    pid: <0.149.0>
    registered_name: []
    exception exit: {badarg,
                        [{erlang,apply,
                             [{gen_logger,console_logger,8},info,[]],
                             []},
                         {emqttc,connect,1,
                             [{file,"src/emqttc.erl"},{line,956}]},
                         {gen_fsm,handle_msg,8,
                             [{file,"gen_fsm.erl"},{line,486}]},
                         {proc_lib,init_p_do_apply,3,
                             [{file,"proc_lib.erl"},{line,249}]}]}
      in function  gen_fsm:terminate/7 (gen_fsm.erl, line 609)
    ancestors: [<0.148.0>]
    message_queue_len: 0
    messages: []
    links: [<0.148.0>]
    dictionary: [{random_seed,{29361,13932,20340}}]
    trap_exit: true
    status: running
    heap_size: 987
    stack_size: 27
    reductions: 40889
  neighbours:

./emqtt_bench_pub -h 10.91.1.127 -c 20 -t log/%i - This command seems to be crashing with the above pasted error.

I don't know much erlang, but from what I could debug it seems like a dependency issue. Any suggestions to fix it?

Thanks

client EXIT: {shutdown, tcp_closed}

If i start the benchmark with 50K subscribers i receive after around thousandth clients the output
client EXIT: {shutdown, tcp_closed}, What is the reason.
My sysctl.conf

For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and

sysctl.conf(5) for more details.

Controls IP packet forwarding

net.ipv4.ip_forward = 0

Controls source route verification

net.ipv4.conf.default.rp_filter = 1

Do not accept source routing

net.ipv4.conf.default.accept_source_route = 0

Controls the System Request debugging functionality of the kernel

kernel.sysrq = 0

Controls whether core dumps will append the PID to the core filename.

Useful for debugging multi-threaded applications.

kernel.core_uses_pid = 1

Controls the use of TCP syncookies

net.ipv4.tcp_syncookies = 1

Disable netfilter on bridges.

net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0

Controls the default maxmimum size of a mesage queue

kernel.msgmnb = 65536

Controls the maximum size of a message, in bytes

kernel.msgmax = 65536

Controls the maximum shared segment size, in bytes

kernel.shmmax = 68719476736

Controls the maximum number of shared memory segments, in pages

kernel.shmall = 4294967296

ipv6 support in the kernel, set to 0 by default

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

net.ipv4.tcp_fin_timeout = 30
fs.file-max = 5097152
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.core.rmem_default = 524288
net.core.wmem_default = 524288
net.core.rmem_max = 67108864
net.core.wmem_max = 67108864
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
net.ipv4.ip_local_port_range = 1024 65535

And here limits.conf

......

  • hard nofile 500000
  • soft nofile 500000
    root hard nofile 500000
    root soft nofile 500000

make error!

After installed erlang,when i make this project.ocurred such error:

Why I use "make" but dont succeed

make

/mqtt_app/emqtt-bench/rebar3 unlock
/usr/bin/env: escript: No such file or directory
make: *** [unlock] Error 127

#ll /usr/bin/env
lrwxrwxrwx 1 root root 13 Mar 26 2019 /usr/bin/env -> ../../bin/env*

specify pub payload

Dear Author:
I know how to use this tool. But i can 't specify pub payload.
May be you can provide a option like other[-c/-I].
I think that it is also useful for other users.
Thank you for your reply.

make wrong

ERROR: OTP release R17 or later is required, you have: R16B02-basho5
ERROR: compile failed while processing /emqtt_benchmark-0.2/deps/goldrush: rebar_abort
make: *** [compile] Error 1

how to do with this reason

Both sub and pub error

The command is ./emqtt_bench sub -h XX.XX.XX.XX -c 1 -t TOPIC.
Then error happened:

client(1): connect error - {{shutdown,tcp_closed},{tcp_closed,#Port<0.6>}}

But the conn is OK.

emqtt_bench sub error

execute /emqtt_bench sub -c 1 -i 10 -t bench/%i -q 2

Report an error

`

2019-07-30 19:36:52.391 [error] 127.0.0.1:46612 [Channel] Parse failed for function_clause

             Stacktrace:[{emqx_frame,parse_packet,
                             [{mqtt_packet_header,4,false,3,true},
                              <<"T /mqtt HTTP/1.1\r\nhost: localhost:1883\r\nconnection: upgrade\r\nupgrade:">>,
                              #{max_size => 1048576,version => 4}],
                             [{file,
                                  "/emqx_temp/emqx_rel/_checkouts/emqx/src/emqx_frame.erl"},
                              {line,147}]},
                         {emqx_frame,parse_frame,4,
                             [{file,
                                  "/emqx_temp/emqx_rel/_checkouts/emqx/src/emqx_frame.erl"},
                              {line,126}]},
                         {emqx_channel,process_incoming,3,
                             [{file,
                                  "/emqx_temp/emqx_rel/_checkouts/emqx/src/emqx_channel.erl"},
                              {line,408}]},
                         {gen_statem,call_state_function,5,
                             [{file,"gen_statem.erl"},{line,1660}]},
                         {gen_statem,loop_event_state_function,6,
                             [{file,"gen_statem.erl"},{line,1023}]},
                         {proc_lib,init_p_do_apply,3,
                             [{file,"proc_lib.erl"},{line,249}]}]

Error data:<<"GET /mqtt HTTP/1.1\r\nhost: localhost:1883\r\nconnection: upgrade\r\nupgrade: websocket\r\nsec-websocket-version: 13\r\nsec-websocket-key: x4/aMGKzxeci3YFfWGuI9w==\r\nsec-websocket-protocol: mqtt\r\ncache-control: no-cache\r\n\r\n">>

Example of multiple topic

Hi, could you elaborate an example of how to use options in topic.
For example:

  • 1000 clients publishes to 10 topics (100 clients to each topic)
  • 100 clients, each client subscribes to 5 topics.

Thanks.

please recompile this module with an R16B03-1 compiler

when I make ,the error come up:
`/root/emqtt_benchmark/rebar3 unlock

=ERROR REPORT==== 11-Sep-2019::11:08:46 ===
beam/beam_load.c(1682): Error loading module rebar_utils:
This BEAM file was compiled for a later version of the run-time system than R16B03-1.
To fix this, please recompile this module with an R16B03-1 compiler.
(Use of opcode 154; this emulator supports only up to 153.)

=ERROR REPORT==== 11-Sep-2019::11:08:46 ===
Loading of /root/emqtt_benchmark/rebar3/rebar/ebin/rebar_utils.beam failed: badfile
Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace or consult rebar3.crashdump
Uncaught error: undef
Stack trace to the error location:
[{rebar_utils,set_httpc_options,[],[]},
{rebar3,init_config,0,
[{file,"/opt/rebar3-3.11.1/src/rebar3.erl"},{line,197}]},
{rebar3,run,1,[{file,"/opt/rebar3-3.11.1/src/rebar3.erl"},{line,100}]},
{rebar3,main,1,[{file,"/opt/rebar3-3.11.1/src/rebar3.erl"},{line,66}]},
{escript,run,2,[{file,"escript.erl"},{line,747}]},
{escript,start,1,[{file,"escript.erl"},{line,277}]},
{init,start_it,1,[]},
{init,start_em,1,[]}]
When submitting a bug report, please include the output of rebar3 report "your command"
make: *** [unlock] Error 1`

My envirment is Centos .

/emqtt_bench sub -c 1 -i 10 -t bench/%i -q 2

The error is as follows
2019-07-30 19:36:52.391 [error] 127.0.0.1:46612 [Channel] Parse failed for function_clause

             Stacktrace:[{emqx_frame,parse_packet,
                             [{mqtt_packet_header,4,false,3,true},
                              <<"T /mqtt HTTP/1.1\r\nhost: localhost:1883\r\nconnection: upgrade\r\nupgrade:">>,
                              #{max_size => 1048576,version => 4}],
                             [{file,
                                  "/emqx_temp/emqx_rel/_checkouts/emqx/src/emqx_frame.erl"},
                              {line,147}]},
                         {emqx_frame,parse_frame,4,
                             [{file,
                                  "/emqx_temp/emqx_rel/_checkouts/emqx/src/emqx_frame.erl"},
                              {line,126}]},
                         {emqx_channel,process_incoming,3,
                             [{file,
                                  "/emqx_temp/emqx_rel/_checkouts/emqx/src/emqx_channel.erl"},
                              {line,408}]},
                         {gen_statem,call_state_function,5,
                             [{file,"gen_statem.erl"},{line,1660}]},
                         {gen_statem,loop_event_state_function,6,
                             [{file,"gen_statem.erl"},{line,1023}]},
                         {proc_lib,init_p_do_apply,3,
                             [{file,"proc_lib.erl"},{line,249}]}]

Error data:<<"GET /mqtt HTTP/1.1\r\nhost: localhost:1883\r\nconnection: upgrade\r\nupgrade: websocket\r\nsec-websocket-version: 13\r\nsec-websocket-key: x4/aMGKzxeci3YFfWGuI9w==\r\nsec-websocket-protocol: mqtt\r\ncache-control: no-cache\r\n\r\n">>

clientId can be duplicated.

The form of clientId use in this benchmark is <YOUR-HOSTNAME>_bench_sub_<COUNT>_1905181425. I'm not sure if 1905181425 has some special meaning, but when I run two or more emqtt_bench_sub on the same machine to emulate concurrent connection, the clientId may duplicate.

How do you select locat IP when starting a client?

My Client machine has multiple IP and I would like to make use of them when connecting to my emqttd broker. This should allow me to have more than 65K connections from one client machine given that my client machine has adequate RAM and CPU.

emqtt_bench_pub or emqtt_bench_sub exception error

escript: exception error: undefined function getopt:parse/2
in function erl_eval:do_apply/6 (erl_eval.erl, line 680)
in call from erl_eval:expr/5 (erl_eval.erl, line 449)
in call from escript:eval_exprs/5 (escript.erl, line 872)
in call from erl_eval:local_func/6 (erl_eval.erl, line 567)
in call from escript:interpret/4 (escript.erl, line 788)
in call from escript:start/1 (escript.erl, line 277)
in call from init:start_em/1

unable to connect emqtt_benchmark client to emqtt broker

Hi,

I am trying to run emqtt_benchmark client to connect to emqtt broker running on my local machine.
while trying to publish using the comment (as mentioned in emqqt document) i am facing below error.
Can anyone suggest what is wrong ?

Command : ./emqtt_bench_pub -h 127.0.0.1 -p 1883 -c 1 -I 10 -t bench/%i -s 256
Command and Error generated:
emqtt_benchmark-master nagpapu$ ./emqtt_bench_pub -h 127.0.0.1 -p 1883 -c 1 -I 10 -t bench/%i -s 256
14:22:30.056 [info] Application lager started on node nonode@nohost
14:22:30.057 [info] Application emqttc started on node nonode@nohost
14:22:30.057 [info] Application emqtt_benchmark started on node nonode@nohost
14:22:30.069 [info] Application crypto started on node nonode@nohost
14:22:30.077 [info] Application asn1 started on node nonode@nohost
14:22:30.077 [info] Application public_key started on node nonode@nohost
14:22:30.085 [info] Application ssl started on node nonode@nohost
conneted: 0
client 1 EXIT: {function_clause,
[{lists,foldl,
[#Fun<emqttc_opts.0.57498288>,[{depth,0}],false],
[{file,"lists.erl"},{line,1262}]},
{emqttc_socket,connect,5,
[{file,"src/emqttc_socket.erl"},{line,97}]},
{emqttc_socket,connect,6,
[{file,"src/emqttc_socket.erl"},{line,76}]},
{emqttc,connect,1,[{file,"src/emqttc.erl"},{line,932}]},
{gen_fsm,handle_msg,7,[{file,"gen_fsm.erl"},{line,451}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,247}]}]}
14:22:30.104 [error] gen_fsm <0.92.0> in state connecting terminated with reason: no function clause matching lists:foldl(#Fun<emqttc_opts.0.57498288>, [{depth,0}], false) line 1262
14:22:30.106 [error] CRASH REPORT Process <0.92.0> with 0 neighbours exited with reason: no function clause matching lists:foldl(#Fun<emqttc_opts.0.57498288>, [{depth,0}], false) line 1262 in gen_fsm:terminate/7 line 559
sent(1001): total=1, rate=1(msg/sec)

After 1003 concurrent connections client 98959 EXIT: {shutdown,emfile} exceptions is coming

I am trying to connect to 100000 connections to emqttd. But after 1003 connections i am getting client 98959 EXIT: {shutdown,emfile} exception but as per configuration it has to handle 1M connections(I have done as per documentation). In jmeter, it is reaching 100000 connections. But if I am trying using emqttd benchmark code it is reaching up to 1003 only.

./emqtt_bench_pub -h 192.168.1.129 -p 1883 -c 100000 -i 100 -I 2000 -t bench/%i -s 256

authentication option -u <username> -P <passwor> does not work

when connect to emqttd with authentication like this:

./emqtt_bench_sub -h 192.168.0.45 -p 1883 -u admin -P admin -c 4000 -i 30 -t bench/%i

Clients are not allow to sub with Error: 'CONNACK_CREDENTIALS'. And the emqttd log says the username is 'undefined'.

But the other benchmark (takanorig/mqtt-bench)[https://github.com/takanorig/mqtt-bench] does the right job.

make fail

WARN: Expected /home/mqtt/emqtt_benchmark/deps/emqttc to be an app dir (containing ebin/.app), but no .app found.
WARN: Expected /home/mqtt/emqtt_benchmark/deps/getopt to be an app dir (containing ebin/
.app), but no .app found.
Uncaught error in rebar_core: {'EXIT',
{{badmatch,{error,enoent}},
[{rebar_utils,otp_release1,1,
[{file,"src/rebar_utils.erl"},{line,391}]},
{rebar_utils,get_arch,0,
[{file,"src/rebar_utils.erl"},{line,92}]},
{rebar_port_compiler,default_env,0,
[{file,"src/rebar_port_compiler.erl"},
{line,574}]},
{rebar_port_compiler,setup_env,2,
[{file,"src/rebar_port_compiler.erl"},
{line,181}]},
{rebar_core,'-setup_envs/2-fun-0-',2,
[{file,"src/rebar_core.erl"},{line,522}]},
{lists,foldl,3,
[{file,"lists.erl"},{line,1262}]},
{rebar_core,maybe_execute,8,
[{file,"src/rebar_core.erl"},{line,293}]},
{rebar_core,process_dir1,7,
[{file,"src/rebar_core.erl"},{line,258}]}]}}
make: *** [get-deps] 错误

Client crashing Badargs error

I used this command to benchmark..
./emqtt_bench_sub -h "MY_BROKER.COM" -p 1885 -u temp_test_user123 -P temp_passw0rd -c 200 -t "test/topic"
On executing this i am getting this error -

=ERROR REPORT==== 28-Jun-2018::10:38:01.756401 ===
** State machine <0.474.0> terminating 
** Last event in was timeout
** When State == connecting
**      Data  == {state,<0.473.0>,"<0.473.0>","MY_BROKER.COM",1885,undefined,
                     undefined,
                     {proto_state,undefined,undefined,4,<<"MQTT">>,
                         <<"Arihants-MacBook-Pro_bench_sub_1_176419070">>,
                         true,300,false,
                         {mqtt_message,0,false,false,undefined,undefined,
                             undefined},
                         <<"temp_test_user123">>,<<"temp_passw0rd">>,1,#{},
                         #{},#{},#{},
                         {gen_logger,console_logger,8}},
                     [],#{},[],[],#{},undefined,false,false,undefined,300,60,
                     4,8,undefined,tcp,undefined,
                     {gen_logger,console_logger,8},
                     [],[]}
** Reason for termination = 
** {badarg,[{erlang,apply,[{gen_logger,console_logger,8},info,[]],[]},
            {emqttc,connect,1,[{file,"src/emqttc.erl"},{line,956}]},
            {gen_fsm,handle_msg,8,[{file,"gen_fsm.erl"},{line,486}]},
            {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]}

client 1 EXIT: {badarg,[{erlang,apply,
                                [{gen_logger,console_logger,8},info,[]],
                                []},
                        {emqttc,connect,1,
                                [{file,"src/emqttc.erl"},{line,956}]},
                        {gen_fsm,handle_msg,8,
                                 [{file,"gen_fsm.erl"},{line,486}]},
                        {proc_lib,init_p_do_apply,3,
                                  [{file,"proc_lib.erl"},{line,249}]}]}
=CRASH REPORT==== 28-Jun-2018::10:38:01.757457 ===
  crasher:
    initial call: emqttc:init/1
    pid: <0.474.0>
    registered_name: []
    exception exit: {badarg,
                        [{erlang,apply,
                             [{gen_logger,console_logger,8},info,[]],
                             []},
                         {emqttc,connect,1,
                             [{file,"src/emqttc.erl"},{line,956}]},
                         {gen_fsm,handle_msg,8,
                             [{file,"gen_fsm.erl"},{line,486}]},
                         {proc_lib,init_p_do_apply,3,
                             [{file,"proc_lib.erl"},{line,249}]}]}
      in function  gen_fsm:terminate/7 (gen_fsm.erl, line 609)
    ancestors: [<0.473.0>]
    message_queue_len: 1
    messages: [{'$gen_event',{subscribe,<0.473.0>,[{<<"test/topic">>,0}]}}]
    links: [<0.473.0>]
    dictionary: [{random_seed,{120,22138,27515}}]
    trap_exit: true
    status: running
    heap_size: 6772
    stack_size: 27
    reductions: 43471
  neighbours:

Can anyone suggest what's wrong here...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.