Question
Why is my queue growing?
Answer
Generally, queues grow when the client is not consuming the messages at a rate equal to or greater than they are arriving for their subscriptions.
This can be caused by too slow or offline clients (the offline clients that created persistent sessions). Queues can only act as temporary buffers if the incoming message stream continues, as the broker has finite resources.
The setting max-queue-size will limit the queue sizes of individual clients for QoS 1 and QoS 2 messages to a size of 1000
by default. This means once the queue for an individual client reaches this size, the broker will drop a message this client has queued. Whether it will drop the newest or the oldest message, depends on the setting strategy
. The behavior is described in more detail in our documentation.
What this means is that increasing the queue size in the configuration will not prevent messages from getting dropped indefinitely, since at some point the disk would be full.
The first thing to do in situations when the queue is growing and messages are being dropped is to identify which client subscriptions are responsible for dropping messages and then
ensuring the subscribed clients are connected
ensuring the clients' capabilities are sufficient to handle inflowing messages
alternatively spread the load on the client side, by using shared subscriptions