0

I have a Spring Boot application where we use Hazelcast to handle pub/sub messaging for WebSockets. However, our current approach has scalability issues:

  1. Every STOMP message is sent to every WebSocket instance, even if that instance doesn't have any active WebSocket connections that care about the event.

  2. Hazelcast does not natively track which instance is subscribed to which topic, leading to unnecessary message broadcasting.

Essentially, we want to track which instance cares about what topic so it only gets events concerning that topic.

Steps Tried:
Using Redis to track which WebSocket instances are subscribed to which topics dynamically.
Querying Redis before sending messages via Hazelcast to only relevant instances.
Automatically removing stale subscriptions when instances shut down.
However, the issue with this approach is that

  1. If a WebSocket instance terminates, it loses all its subscriptions, and there is no easy way to reassign them to a new instance.

Any ideas on how to solve this would be appreciated.

1
  • > Hazelcast does not natively track which instance is subscribed to which topic>> Hazelcast should be tracking subscribers. Why do you think otherwise ? There will be periodic housekeeping message sent to every client, if you are monitoring network traffic you should see these. Commented Apr 14 at 5:31

0

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.