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

[Feature Request] Add "one node per shard" routing mode to support distributed query processing #734

Open
joehu888 opened this issue Dec 4, 2022 · 2 comments

Comments

@joehu888
Copy link

joehu888 commented Dec 4, 2022

Current request routing supports AllNodes/AllMasters routing. What's missing is "one node per shard" routing. The use case is distributed transaction processing. e.g., I have a module command called M.QUERY, which performs per-shard query. I'd do Map/Reduce like distributed query:

  1. Route the command M.QUERY to "one node per shard" (ie., either master or replica node of each shard).
  2. Aggregate results from each shard and send the consolidated result back to the client.

Using the current AllNodes/AllMasters routing, the command is only executed on all master. Replicas are not utilized for query, which makes it not scale well. (BTW, it seems to me that AllNodes is same as AllMasters. Can someone confirm? I thought AllNodes is supposed to include all replicas?)

So, I'm proposing to add a "one node per shard" routing. Does the current code base have the infrastructure to support routing a ReadOnly command to a replica? How much work will be involved to implement the feature?

@joehu888 joehu888 changed the title [Feature Request] Add "one node per shard" routing rule to support distributed query processing [Feature Request] Add "one node per shard" routing mode to support distributed query processing Dec 4, 2022
@doyshinda
Copy link
Contributor

Does the current code base have the infrastructure to support routing a ReadOnly command to a replica?

Yes, use the read_from_replicas flag when building a connection.

With this flag set, AllNodes becomes "1 replica from each shard" (see code here ).

Once #732 is implemented, I believe this feature could be accomplished by creating the connection with read_from_replicas and the setting the custom routing to RoutingInfo::AllNodes.

@joehu888
Copy link
Author

joehu888 commented Dec 4, 2022

@doyshinda Superb! The routing feature is well designed.

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

2 participants