The EMQ (Erlang MQTT Broker) is a "distributed, massively scalable, highly extensible MQTT message broker" with a reported "1.3 million concurrent MQTT connections" - so it potentially allows a large number of clients to publish and subscribe to it. It seems likely that some clients may be disconnected at any given time.

As this question What happens if Mosquitto runs out of memory to store QoS 1/2 messages? asks about Mosquitto:

In MQTT, messages with QoS 1 or 2 must be delivered at least once (QoS 2 messages must be delivered exactly once). If the client is not connected, the broker must store the message until the client is ready to receive it.

So how does EMQ persist QoS 1/2 messages until delivery, i.e. a reboot of the broker or with respect to memory limits?


1 Answer 1


So how does EMQ persist QoS 1/2 messages until delivery, i.e. a reboot of the broker or with respect to memory limits?

The answer seems to be: it doesn't. This issue on their bug tracker says:

I am facing the issue to store persistent client sessions after broker restart. Does this feature currently not present in the broker or I missing some configuration?

The broker will not persist sessions.

Also, after digging through a couple more issues, I found this report:

Initially I have set the max clients to 1000K in emqttd.config. Our machine has 8 GB memory with 4 core, I am able to connect 120K concurrent connection easily but when it exceeds 8 GB memory emqttd terminates itself. What I thought is set a max client per machine would be far better.

Essentially, as of v2.0.5:

  • Messages do not seem to be persisted to a file.
  • Once the broker runs out of memory, it will simply crash.

Not exactly ideal, but that seems to be the current behaviour, so if persisting messages is critical to your use-case, use a different broker.

  • 1
    Seems to be odd (to say the least) for a massively scalable mqtt broker.
    – Ghanima
    Commented Jan 15, 2017 at 20:07
  • If you're looking for a distributed MQTT broker that do persist QoS1/2 messages to disk (using LevelDB), then maybe take a look at VerneMQ (vernemq.com). Commented Jan 18, 2017 at 11:21
  • Mmmh while emqtt does not store the message all by itself, it can be connected to a number of databases, so I am assuming that's what it does. Have you checked that? Commented Dec 24, 2017 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.