Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to put/set multiple retained messages in the RetainedMessageStore #518

Open
basimons opened this issue Aug 9, 2024 · 0 comments

Comments

@basimons
Copy link

basimons commented Aug 9, 2024

Problem or use case

On the startup of our application, a lot of data needs to be loaded and retained, so that when a customer/client connects, it will see the state of the certain things that it has access too. This can vary from time to time, but the total amount of messages is about 50k, but in the future this can easily increase to 500k.

Currently we just loop over all the data and publish all the messages one for one, via the PublishService#publish with a PublishMessage which has the flag retain set. This all works fine, but takes a long time, taking a long time before our pod is open for connection.

I tried moving to the retainedMessageStore#addOrReplace on startup (while clients are connected you cannot use this of course), expecting this to be a lot faster. Too my surprise this turned out to be slower (roughly 2x as slow) then just doing PublishService#publish, which I find weird as the retainedMessageStore#addOrReplace has to do less.

Preferred solution or suggestions

A method which would be greatly appreciated (if optimized), would be something like retainedMessageStore#addAll, which would take Collection of type RetainedPublish. Or maybe a method like retainedMessageStore#initialize, which you can only use once. I assume with the prior knowledge you should be able to greatly optimize the storing of this data. Making startups in cases like this a lot faster.

I understand that this is a lot to ask, and feel free to shut it down. Its just an idea I wanted to share :)!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant