FlashMQ version 1.8.4 contains improvements when dealing with large amounts of retained messages:
- Traversal of the retained messages tree and delivering the messages (on subscription) is given a maximum amount of CPU time at which time it’s deferred to a next iteration. This repeats until done. This fixes blocking the event loop (while holding a lock) when retained messages are being delivered.
- Despite the new algorithm, clients placing broad subscriptions can still cause more CPU load than desired, so there is the option
retained_messages_node_limit
to limit the impact such clients can have. For example, you can use this in cases where it’s abnormal behavior that clients ask for all retained messages. - Saving retained messages is given a similar approach to delivery on subscription.