Skip to content

Improve locality of data distribution for parallel replicas #57772

Closed

Description

@nickitat

We already have a scheme in place that assigns parts to replicas based on consistent hash.
Currently it has the following problems:

  • we assign parts as a whole, not taking part size (e.g. in marks) into account. because of that (let's omit hash function uniformity) distribution might be not really even
Example
consistent_hash=0, assigned_parts[consistent_hash]=7, assigned_blocks[consistent_hash]=10248
consistent_hash=1, assigned_parts[consistent_hash]=4, assigned_blocks[consistent_hash]=5615
consistent_hash=2, assigned_parts[consistent_hash]=4, assigned_blocks[consistent_hash]=193
consistent_hash=3, assigned_parts[consistent_hash]=6, assigned_blocks[consistent_hash]=12355
consistent_hash=4, assigned_parts[consistent_hash]=6, assigned_blocks[consistent_hash]=13862
consistent_hash=5, assigned_parts[consistent_hash]=4, assigned_blocks[consistent_hash]=11261
consistent_hash=6, assigned_parts[consistent_hash]=5, assigned_blocks[consistent_hash]=6091
consistent_hash=7, assigned_parts[consistent_hash]=2, assigned_blocks[consistent_hash]=9810
consistent_hash=8, assigned_parts[consistent_hash]=2, assigned_blocks[consistent_hash]=1018	
consistent_hash=9, assigned_parts[consistent_hash]=4, assigned_blocks[consistent_hash]=10711
consistent_hash=10, assigned_parts[consistent_hash]=5, assigned_blocks[consistent_hash]=6034
consistent_hash=11, assigned_parts[consistent_hash]=2, assigned_blocks[consistent_hash]=5024
consistent_hash=12, assigned_parts[consistent_hash]=3, assigned_blocks[consistent_hash]=6235
consistent_hash=13, assigned_parts[consistent_hash]=2, assigned_blocks[consistent_hash]=5572
consistent_hash=14, assigned_parts[consistent_hash]=7, assigned_blocks[consistent_hash]=16289
consistent_hash=15, assigned_parts[consistent_hash]=4, assigned_blocks[consistent_hash]=5396
  • each query consists of two stages: receiving announcements from all the replicas and then the main phase when all parts were assigned taking into account unavailable nodes. if the first stage takes a long time some replicas will already exhaust their assignments and start to read from other replica's parts taking whatever came to their hands (without consistent hashing)
  • make sure replicas numbers are consistent across cluster Set replica number to its position in cluster definition #57800

would be good to have a more accurate distribution. would be even better if will provide a decent cache hit for queries with different filters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions