Optimize S3 Bandwidth Usage via Two-Phase Progressive Leaf Search for Heavy Queries

オープン
#6,210 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
45/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
rust

調査の方向性

leaf.rs の single_doc_mapping_leaf_search から始めて run_local_search_tasks を追跡し、その後 SearcherConfig、optimize_split_order、CanSplitDoBetter、simplify_search_request を読んでください。大きな split セットが設定可能な優先バッチを使用し、0 で現在の動作が維持され、小さいクエリが引き続き並行実行され、CountAll/count-only の動作が正しい状態になれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Description of the Problem
When executing a search query that hits a massive number of splits (e.g., in a 50PB log scale deployment with a broad time range and weak filters), Quickwit exhibits extremely heavy continuous reads from S3. This pattern can saturate the network ingress bandwidth on the search nodes.

Upon analyzing the S3 access pattern (s3_compatible_storage.rs, bundle_storage.rs, and SplitCache), it's clear that Quickwit is already highly optimized (utilizing HTTP Range Requests efficiently). The problem stems from the concurrency logic in the leaf.rs module.

Currently, in single_doc_mapping_leaf_search, all matched uncached splits are scheduled and dispatched concurrently via run_local_search_tasks.
While Quickwit has a great CanSplitDoBetter pruning mechanism, it has limited effectiveness in this extreme scenario. Because hundreds or thousands of splits are spawned and enter their warmup phase (triggering S3 I/O) almost simultaneously, the pruning state (worst_hit_found) doesn't get populated fast enough to prevent unnecessary splits from aggressively downloading their fast_fields and dictionary terms.

As a result, an enormous amount of unnecessary S3 Range Request bandwidth is wasted on splits that would have been pruned anyway if they were processed slightly later.

Proposed Solution: Progressive Two-Phase Search
To maximize the power of the existing CanSplitDoBetter mechanism without impacting normal query latency (where split_count is reasonable), we propose modifying single_doc_mapping_leaf_search to implement a "Two-Phase" or "Progressive" execution path when the split count is large.

Logic implementation:

  1. New Configuration: Introduce progressive_search_batch_size: usize in SearcherConfig (defaulting to 20 or similar). If set to 0, it falls back to the current behavior.
  2. Phase 1 (Priority Batch): In leaf.rs, we take the first batch_size splits (which are already sorted by optimize_split_order, meaning they are highly relevant) and execute them. We tokio::join! them and wait for completion.
  3. Data Population: Upon Phase 1 completion, the CanSplitDoBetter structure (which holds the incremental_merge_collector) is filled with concrete worst_hit scores from the most relevant splits.
  4. Phase 2 (Remaining Splits): We then dispatch the remaining splits. Because CanSplitDoBetter is now populated with a strong baseline, the simplify_search_request function can aggressively convert unnecessary splits into count-only queries or completely skip them (if count is not needed), preventing them from making any heavy S3 I/O requests.

Impact & Safety:

  • Paginating (count accuracy) remains unaffected. simplify_search_request correctly respects CountAll and safely converts splits to count-only (bypassing expensive field data downloads) instead of dropping them.
  • This effectively bounds the peak S3 GET request burst length to exactly what is needed for the Top-K.
  • It degrades seamlessly back to the original concurrency behavior if the query matches fewer than progressive_search_batch_size splits.

Environment details:

  • OS: Linux / Kubernetes
  • Quickwit Version: Latest main
主要言語
Rust
スター
11.8k
フォーク
628
平均マージ
2日 22時間
マージ済み PR(30日)
50

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

quickwit-oss/quickwit のほかの issue

quickwit-oss/quickwit の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。