vernemq / vmq_mzbench

An MQTT loadtest and usage scenario tool for VerneMQ and other MQTT systems.
Apache License 2.0
42 stars 44 forks source link

Not able to run scenarios on mzbench tool #36

Closed jayjamba closed 4 years ago

jayjamba commented 4 years ago

Hi I was trying to load test vernemq broker, by following instruction on

I got mzbench installed successfully. Then, i was trying to execute the same scenario of 2 pools as mentioned in the above link, but I am getting below exceptions, can you please help me what exactly am I missing here ?

11:22:20.402 [error] [ API ] <0.746.0> [ REMOTE EXEC ] Command execution failed: Cmd: bash -c -l "export PATH='/sbin:/bin:/usr/sbin:/usr/bin'; mkdir -p /tmp/bench_mzbench_api_test7_1574_940138_35584 && cd /tmp/bench_mzbench_api_test7_1574_940138_35584 && git clone https://github.com/erlio/vmq_mzbench.git deployment_code && cd deployment_code && git checkout master && cd ./. && make generate_tgz && mv *.tgz /tmp/bench_mzbench_api_test7_1574_940138_35558.tgz " Exit code: 2 Output: Cloning into 'deployment_code'... Already on 'master' /tmp/bench_mzbench_api_test7_1574_940138_35584/deployment_code/rebar get-deps /usr/bin/env: escript: No such file or directory make: *** [get-deps] Error 127

11:22:20.544 [error] [ API ] <0.732.0> Stage 'pipeline - provisioning': failed Command returned 2: bash -c -l "export PATH='/sbin:/bin:/usr/sbin:/usr/bin'; mkdir -p /tmp/bench_mzbench_api_test7_1574_940138_35584 && cd /tmp/bench_mzbench_api_test7_1574_940138_35584 && git clone https://github.com/erlio/vmq_mzbench.git deployment_code && cd deployment_code && git checkout master && cd ./. && make generate_tgz && mv *.tgz /tmp/bench_mzbench_api_test7_1574_940138_35558.tgz " Command output: Cloning into 'deployment_code'... Already on 'master' /tmp/bench_mzbench_api_test7_1574_940138_35584/deployment_code/rebar get-deps /usr/bin/env: escript: No such file or directory make: *** [get-deps] Error 127

larshesel commented 4 years ago

The part escript: No such file or directory seems to indicate that you do not have the escript executable in your path. This is normally a part of Erlang, so perhaps Erlang isn't (correctly) installed?

Hope this helps.

jayjamba commented 4 years ago

When I installed vernemq of version 1.9.2, I believe it came with inbuilt erlang in it. $ pwd /usr/lib64/vernemq $ ls -ltr total 16 drwxr-xr-x 7 root root 4096 Nov 5 17:16 erts-10.2.3 drwxr-xr-x 68 root root 4096 Nov 5 17:16 lib drwxr-xr-x 3 root root 4096 Nov 5 17:16 releases drwxr-xr-x 2 root root 4096 Nov 5 17:16 bin

Do I need to separately install erlang for this ?

larshesel commented 4 years ago

VerneMQ has it's own Erlang runtime system included, but this version of Erlang is specifically tailored to the needs of VerneMQ and if mzbench needs erlang you have to install that separately.

jayjamba commented 4 years ago

Thanks Iarshesel for your instant support. I got erlang installed, but now I am facing this error :

11:54:56.189 [error] [Undefined] <0.36.0> Loading of /root/.local/share/mzbench_workers/mqtt_worker/ebin/mqtt_worker.beam failed: badfile 11:54:56.189 [error] [Undefined] emulator beam/beam_load.c(1277): Error loading module mqtt_worker: mandatory chunk of type 'Atom' not found

11:54:56.190 [error] [Undefined] <0.36.0> Loading of /root/.local/share/mzbench_workers/mqtt_worker/ebin/mqtt_worker.beam failed: badfile 11:54:56.190 [error] [Undefined] emulator beam/beam_load.c(1277): Error loading module mqtt_worker: mandatory chunk of type 'Atom' not found

11:54:56.192 [error] [Undefined] <0.243.0> gen_server <0.243.0> terminated with reason: no try clause matching {{error,{noproc,{gen_server,call,[mzb_metrics,get_metrics]}}}} in mzb_management_tcp_protocol:dispatch/2 line 33 11:54:56.193 [error] [Undefined] <0.243.0> CRASH REPORT Process <0.243.0> with 0 neighbours exited with reason: no try clause matching {{error,{noproc,{gen_server,call,[mzb_metrics,get_metrics]}}}} in mzb_management_tcp_protocol:dispatch/2 line 33 in gen_server:terminate/7 line 812 11:54:56.193 [error] [Undefined] <0.243.0> Ranch listener management_tcp_server terminated with reason: no try clause matching {{error,{noproc,{gen_server,call,[mzb_metrics,get_metrics]}}}} in mzb_management_tcp_protocol:dispatch/2 line 33

Not sure if it has got some problem with scenario that is mentioned in https://vernemq.com/blog/2016/08/26/loadtesting-mqtt-brokers.html, coz its the same scenario that I am trying to execute.

larshesel commented 4 years ago

The problem is incompatible erlang versions. Some part of your system was compiled with a version of Erlang which is too new for the runtime which you're trying to run it on.

jayjamba commented 4 years ago

Well, I spent whole day behind this. I got erlang installed of version 10.2.3. $ erl Erlang/OTP 21 [erts-10.2.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe] Eshell V10.2.3 (abort with ^G)

And under vernemq I can see below: $ pwd /usr/lib64/vernemq

$ ls -ltr total 16 drwxr-xr-x 7 root root 4096 Nov 5 17:16 erts-10.2.3 drwxr-xr-x 68 root root 4096 Nov 5 17:16 lib drwxr-xr-x 3 root root 4096 Nov 5 17:16 releases drwxr-xr-x 2 root root 4096 Nov 5 17:16 bin

Now I am getting this exception :

18:34:49.327 [warning] [Undefined] <0.30.0> lager_error_logger_h dropped 7 messages in the last second that exceeded the limit of 50 messages/sec 18:34:49.327 [error] [Undefined] <0.36.0> Loading of /root/.local/share/mzbench_workers/mqtt_worker/ebin/mqtt_worker.beam failed: badfile 18:34:49.327 [error] [Undefined] emulator beam/beam_load.c(1277): Error loading module mqtt_worker: mandatory chunk of type 'Atom' not found

18:34:49.329 [error] [Undefined] <0.36.0> Loading of /root/.local/share/mzbench_workers/mqtt_worker/ebin/mqtt_worker.beam failed: badfile 18:34:49.329 [error] [Undefined] emulator beam/beam_load.c(1277): Error loading module mqtt_worker: mandatory chunk of type 'Atom' not found

18:34:49.330 [error] [Undefined] <0.243.0> gen_server <0.243.0> terminated with reason: no try clause matching {{error,{noproc,{gen_server,call,[mzb_metrics,get_metrics]}}}} in mzb_management_tcp_protocol:dispatch/2 line 33 18:34:49.332 [error] [Undefined] <0.243.0> CRASH REPORT Process <0.243.0> with 0 neighbours exited with reason: no try clause matching {{error,{noproc,{gen_server,call,[mzb_metrics,get_metrics]}}}} in mzb_management_tcp_protocol:dispatch/2 line 33 in gen_server:terminate/7 line 812 18:34:49.332 [error] [Undefined] <0.243.0> Ranch listener management_tcp_server terminated with reason: no try clause matching {{error,{noproc,{gen_server,call,[mzb_metrics,get_metrics]}}}} in mzb_management_tcp_protocol:dispatch/2 line 33

can you please guide what exactly am i missing or doing wrong. Also do we need to make sure that erlang which is installed independently, should be used by vernemq and not the one which comes with it. If yes, then how can we do that ?

ioolkos commented 4 years ago

@jayjamba apologies for the frictions you encounter. MZBench setup is currently not very comfortable, dues to the reason that it doesn't compile with all Erlang/OTP versions. This means that you have to activate an Erlang version that works, before compiling MZBench. This is all completely independent of the Erlang version you run VerneMQ on.

I'm using the 'kerl' tool to activate, deactivate and manage different Erlang versions on my system. I can't give an introduction to this here.

git clone git://github.com/mzbench/mzbench
cd mzbench
virtualenv -p python2 venv
source venv/bin/activate
pip install -r requirements.txt

. /home/afa/.kerl/erlangs/20.1/activate
./bin/mzbench start_server

After that you will have a started version of MZBench, and you can start the web interface, and you can paste the script you mention into the scenario pane. (note: use

make_install(git = "https://github.com/vernemq/vmq_mzbench.git",
             branch = "master")

at the beginning of the script to use the correct repository.