-
Notifications
You must be signed in to change notification settings - Fork 737
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
[NEW] Light-weight cluster bus pubsub message #557
Comments
I agree with the overall direction of this proposal. I think the lighter clusterMsg can be used for scenarios beyond sharded pubsub, such as shard-id and forgotten nodes broadcasting as well. |
We discussed this in the last core team meeting and agreed on the details. |
Hi, I am currently implementing a new header struct whici looks something like this,
Trying to figure the changes in |
I don't think Same with AFAICT, the only place we need to hook in our check for type is in int clusterProcessPacket(clusterLink *link) {
/* Validate that the packet is well-formed */
if (!clusterIsValidPacket(link)) return 1;
clusterMsg *hdr = (clusterMsg *)link->rcvbuf;
uint16_t type = ntohs(hdr->type);
if (type == CLUSTER_PUBSUB_LIGHT) {
clusterPubsubLight *light_hdr = (clusterPubsubLight *)hdr;
return clusterProcessPubsubLight(...);
}
...
} Btw, we don't need to include /* Use only when you know this is not the first message on the link. */
static clusterNode *getNodeFromLink(clusterLink *link) {
assert(link->node && !nodeInHandshake(link->node));
return link->node;
} |
Thats makes sense! Thanks you so much! Also I think we will have to make changes in the
Where our new min |
Adds light-weight cluster bus header for pubsub message. Closes #557. This also supports sending to and receiving non-light messages from older versions of the engine. The light-weight cluster bus message supports multiple pubsub messages (payloads) for one pubsub channel. Receiving messages with multiple payloads is supported but we're not yet sending such multi-payload messages to other nodes. --------- Signed-off-by: Roshan Khatri <rvkhatri@amazon.com>
The problem/use-case that the feature addresses
In cluster mode, propagating a pubsub message between cluster nodes over the cluster bus has a large overhead, since every cluster bus message includes a lot of node information, such as a slot bitmap (2KB).
Description of the feature
Introduce a new cluster bus message type that shares the first elements of
clusterMsg
, soclusterReadHandler()
andclusterIsValidPacket()
can still be called on it, before branching by type. These are called on all incoming cluster bus messages. (port
is not checked here, but it's squeezed in beforetype
.)In
clusterProcessPacket()
, just after callingclusterIsValidPacket()
, we add a check fortype
and branch out for the new lightweight pubsub message, if thetype
field indicates our new message type. We should update thesender->data_received
timestamp though.I hope we can avoid including the sender node ID too (40B). If it's the first message after reconnecting, the receiving node needs to validate that the message is from a known node in the cluster, but if we can require that it's never the first message after (re)connecting, we can skip the node id too.
Edit: It appears we can rely on PING or MEET always being sent after connect. I found this in clusterLinkConnectHandler:
The payload should allow multiple messages for the same channel without repeating the channel name (for #525 but possibly also for batching in other ways). For messages in multiple channels, it may be OK to send a separate cluster bus message for each channel since the overhead is low (can be discussed).
Feature check: We should use a bit in clusterMsg, e.g. a cluster node flag, to indicate support for lightweight pubsub messages. A node only sends it to another node which is known to support it.
Alternatives you've considered
Additional information
This doesn't exclude the possibility of also doing #307 for sharded pubsub. The benefit of using the replication stream is to prevent the cluster bus from being overloaded by pubsub traffic.
The text was updated successfully, but these errors were encountered: