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
Propagate sharded pubsub data via replication link #307
base: unstable
Are you sure you want to change the base?
Conversation
Signed-off-by: Harkrishn Patro <harkrisp@amazon.com>
#76 would have been helpful here as well. |
There is another important point here, which is if we moved to cluster V2 we would no longer need to maintain cluster links for pubsub. Some context, this was approved by the previous Redis core team, but was never finished because of the license change. @valkey-io/core-team Messaging folks here for approval. Please 👍 or 👎 with your opinion if you have one. |
We'd still need to support cluster bus for unsharded pubsub right? I fail to see the difficulty in sending data like this on a cluster v2 bus. Just maybe multiple jumps in worst case. (We could even look at real message brokers like rabbitmq for how they do this.) Let's open up some issue about cluster v2, what we need from it and discuss different approaches. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, btw, why didn’t we choose replication stream for shard pub/sub at the beginning?
I think compatibility with the way the cluster worked was the main reasoning. Since you could send a message to a replica and read it on the primary. I don't recall why that seemed important at the time though, and all usage that I have seen of it hasn't cared about that property. |
For cluster bus, we will probably need to continue supporting it. Cluster v2 will be an opt-in feature, and I think we should consider dropping support for it.
This is true, we could still do it. My observation about usage is that it's not really used and when it is used it's caused a lot of problems. |
This is one of the major points I don't like. I think the cluster shall do this version negotiation by itself. Two parallel solutions is very bad, compared to gradually transforming the current solution. Btw, I don't see any problem to propagate or broadcast any data (like pubsub) in a future V2 cluster, although it may require multiple hops to reach all nodes, if not all nodes are connected to all other nodes. |
I'm ok with it, and it is a breaking change. |
|
Alternative solution, we could maybe alias |
If we start returning MOVED for these, it's a breaking change in itself. Also consider a cluster with mixed version of nodes. I think it would be fairly easy to introduce a new message in the "legacy" cluster bus to send pubsub messages without the full Ping packet (slot bitmap, etc.). We just need a flag bit in MEET to indicate that a node supports this feature. It's low hanging fruit for better cluster performance IMO. |
Issue: redis/redis#12196
Ref: redis/redis#12929
Sharded pubsub uses the cluster link for message propagation across the nodes. Cluster link has a high payload overhead and is particularly expensive if the message to be propagated is comparatively small.
As the sharded pubsub message needs to be propagated only within a shard, if the message from client is received on a primary, replication link can be used for propagation as compared to cluster link. There are two benefits we can yield from it.
This will be inline with how message propagation is performed in cluster disabled mode.
Notes:
SPUBLISH
is marked as write command and can only be sent on a primary. The command will fail and client will receive aMOVED
response if published on a replica.Benchmark:
Setup:
Scenario 1: Message(s) published on primary:
Request:
Summary:
Scenario 2: Message(s) published via cluster link (prior to this change):
Request:
Summary:
Gain: 43% on using replication link over cluster link.