quickwit-oss / quickwit-oss/quickwit
Improve the split-> leaf node assignment algorithm
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 11.7k
- Forks
- 597
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 37
Description
Right now the root assigns the splits to the different leaf node by using some affinitiy defined using rendez vous hashing.
The point of using that affinity is to make sure that a given split is most of the time processed on the same given node.
It improves our cache hit rate.
The current algorithm is very suboptimal.
Each split has different size, so we have a cost estimate for each split. Right now it is set to 1 for all split.
First I think we can have a cost linear with num_docs.
- Change the weight to make it linear with num docs.
Then the current algorithm goes through the split sorted in decreasing order.
For each splits, it considers the two nodes with the highest affinity and picks the one that has the least work (defined as the sum of cost of splits assigned to it) scheduled so far.
We can be way more aggressive in assigning splits to the node with the best affinity.
For instance (algorithm suggested by Francois)
Compute the overall cost.
Compute a target cost per node. It could be something like ceil(overall_cost / number of node) * (1 + margin).
For each split, sorted in decreasing order, assign the split with the highest affinity as long as its load (sum of the cost of splits assigned to it) does not exceed the target cost. If it exceeds the target cost, assigned to the next node in term of affinity.
- Fix split->node assignement strategy.
Googling "power of two choices" gives interesting literature about this problem.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the root's split-to-leaf assignment logic, including rendezvous affinity, split cost, and node load calculation. Review how split sizes and num_docs are currently represented, then compare the existing strategy with the proposed target-cost approach. Done means a decided assignment algorithm, updated cost weighting, and tests showing balanced assignments while preserving affinity.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- distributed-systems
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100