Mosquitto broker takes a long time to start and has a high cpu usage

0

I am running a mosquitto broker on a Debian stretch ARM devices(similar to Raspberry Pi).

But the mqtt broker takes about 2mins to start(ready to be connected), and it occupies 100% CPU when it starts.

This is the link of a screenshot of 100% CPU usage

I also notice that if I start the mqtt broker without -c /etc/mosquitto/mosquitto.conf, the broker starts immediately with low cpu usage.

This is my mqtt config file:

~$ cat /etc/mosquitto/conf.d/mosquitto.conf bind_address 0.0.0.0 port 1883 protocol mqtt

And my mqtt broker version is 1.5.5:

sudo mosquitto --help mosquitto version 1.5.5 mosquitto is an MQTT v3.1.1 broker.

Why my broker takes such a long time to start? Any answer will be appreciated!

JerryYip

Posted 2018-12-20T07:32:04.343

Reputation: 11

1I have tried the version 1.4.10 (install from apt) before, and that doesn't work. I have checked my system that port 1883 isn't occupied. – JerryYip – 2018-12-20T07:35:11.237

Answers

1

I found the answer finally. The reason is that /var/lib/mosquitto/mosquitto.db is too large(12MB). It takes a long time to load that database. So I just removed it and set persistence false in the config file.

JerryYip

Posted 2018-12-20T07:32:04.343

Reputation: 11