ingest v2: WAL truncation blocks persist/init_shards, causing ingest timeouts under load

Aperta
#6,598 8 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

  • #6599 di @aanufriev-celonis — chiusa senza merge

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
rust

Direzione di ricerca

Inizia da EventSubscriber::handle_event e segui lock_fully, persist e init_shards, quindi riproduci la contesa durante un’ingestione sostenuta con aggiornamenti frequenti delle posizioni degli shard. La correzione è completata quando la pulizia del WAL cede il lock dell’ingester tra piccole unità di lavoro e persist/init_shards non va più in timeout durante il troncamento; verifica con i test pertinenti di ingestione e concorrenza.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area:ingest area:performance bug

Describe the bug

In ingest v2, the ingester's shard-positions gossip handler holds the ingester's global lock across an entire WAL-truncation pass, which blocks ingestion on that node while the pass runs.

EventSubscriber<ShardPositionsUpdate>::handle_event acquires the full ingester lock once (lock_fully) and holds it while it truncates/deletes every shard in the update.

persist and init_shards take that same lock. So the truncation pass is effectively a stop-the-world for that ingester, each truncate/delete performs WAL disk I/O, so on a node with many shards and/or a WAL on slower storage it can hold the lock for tens of seconds.

During that window:

  • incoming persist requests queue behind the lock and (our case) exceed client ingest timeouts;

  • a concurrent init_shards, auto-scale-up triggered by the same traffic surge, also blocks and times out, so the source cannot add capacity exactly when it needs to.

Steps to reproduce (if applicable)

This is a contention/timing issue, so it reproduces under load. Conditions that trigger it:

  1. Run an ingester (ingest v2) that leads many shards, ideally with the WAL on slower storage.
  2. Drive a sustained ingestion surge into a source so the control plane attempts to scale the source up while shard positions are actively gossiped (frequent ShardPositionsUpdate truncations).
  3. Observe on that ingester: WAL lock-acquire warnings, ShardPositionsUpdate handler-budget warnings, failed to init shards ... request timed out.

Expected behavior

Background WAL cleanup driven by gossiped shard positions must not block ingestion for the duration of the whole pass. Ingest latency (and init_shards) should not spike to seconds/tens-of-seconds (up to 50 in our case) because a truncation pass is in progress. The cleanup should yield the ingester lock frequently enough that queued persist/init_shards calls can interleave, performing small units of work rather than the entire update.

Configuration:

quickwit:d33dd237f8250899c223bb2cd7997f005ed616fe

Lingua principale
Rust
Stelle
11.8k
Fork
628
Merge medio
2g 22h
PR unite (30g)
50

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di quickwit-oss/quickwit

Tutte le issue di quickwit-oss/quickwit

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.