Skip to content

Improve shard collocation when scheduling #5808

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

rdettai
Copy link
Collaborator

@rdettai rdettai commented Jun 19, 2025

Description

When placing new shards for an existing source, when affinity is not defined (e.g Kafka source), we currently have no affinity for nodes where we have existing indexing pipelines. This can create a fragmented distribution of shards.

This solution is not perfect, ideally we should split the assignation in two steps (just as we do for the shard affinity):

  • first assign shards to nodes that already have shards for all the source
  • second for sources where we still have shards to assign, assign them to new nodes

How was this PR tested?

Added unit test

Base automatically changed from test-solution-stability to main June 27, 2025 13:10
* Add limit of three pipelines per node

* Small code simplification
ordering => return Some(ordering.reverse()),
}
// If tie, pick the node with shards already assigned first
match self.current_num_shards.cmp(&other.current_num_shards) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think what matters here is whether current_num_shards is non null, no?

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

Successfully merging this pull request may close these issues.

2 participants