[Draft] Rework routing to be node based rather than shard based#6117
Draft
nadav-govari wants to merge 3 commits intomainfrom
Draft
[Draft] Rework routing to be node based rather than shard based#6117nadav-govari wants to merge 3 commits intomainfrom
nadav-govari wants to merge 3 commits intomainfrom
Conversation
…, pending the workbench changes
nadav-govari
commented
Jan 23, 2026
Comment on lines
+556
to
+558
| let shard_id = match split_queue_id(&queue_id) { | ||
| Some((_, _, shard_id)) => Some(shard_id), | ||
| None => None, |
Collaborator
Author
There was a problem hiding this comment.
todo: helper for queue_id for this
nadav-govari
commented
Jan 23, 2026
| index_uid: subrequest.index_uid, | ||
| source_id: subrequest.source_id, | ||
| shard_id: subrequest.shard_id, | ||
| shard_ids: vec![shard_id.unwrap()], |
Collaborator
Author
There was a problem hiding this comment.
same helper for queue_id as above should take care of this
nadav-govari
commented
Jan 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Today, a specific shard on a specific node is targeted for persisting a request. This is suboptimal; we can pick a node that we know has at least one shard on it and delegate the shard selection logic to it.
In order to do that, the routing table needs to be aware of per-node level shards, not just local/remote shards. This reworks the routing table to maintain a single map of <Node, Vec>. A preference is given to the node with the most open shards. TODO: make it psuedorandom, but weigh nodes with more open shards higher.
As a result, some other shapes changes. I tried to be minimally intrusive when making the changes, but there's a lot that can go wrong here (shard updates, etc)
I'm not sure yet as to what the effects will be on retries and things of that nature. So that's also something to keep in mind.