perf: page faults on fresh decode buffers cost as much CPU as decoding large columns

Aperta
#10,529 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
performance

Direzione di ricerca

Start from LanceBuffer allocation and the decode path that builds Arrow output buffers per batch; reproduce the scan benchmark from the issue and profile page faults. Compare reusing decode output buffers across batches against backing large allocations with madvise(MADV_HUGEPAGE), using #10524 for the environment-variable context. Done means the scan shows the reported CPU/page-fault reduction without requiring users to set allocator tunables.

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

Descrizione

performance

Observation

Decoding writes every batch into freshly allocated buffers, and for large columns the first-touch page faults cost as much CPU as the decode itself. Scan of two fragments (50k rows, 11 GB of Arrow output) of 180 KB JSON strings, 64-core Zen 4, page cache warm, glibc malloc (pylance uses the system allocator):

wall CPU page faults perf
2.2 per-value zstd, default 7.1 s 23 s 5.4 M 40% ZSTD_decompressSequences, ~45% kernel (clear_highpages, handle_mm_fault, _copy_to_iter)
same with GLIBC_TUNABLES=glibc.malloc.hugetlb=1 2.0 s 13.6 s 0.59 M
2.0 uncompressed, default 6.9 s 16 s
same with hugetlb=1 2.4 s 6.4 s

5.4 M faults x 4 KiB is 22 GB for 11 GB of output, i.e. every output byte is faulted about twice (decode buffer, then the Arrow array built from it). MALLOC_MMAP_THRESHOLD_ / MALLOC_TRIM_THRESHOLD_ do not change it; THP does (#10524 documents the env var).

Suggestion

Either back large LanceBuffer allocations with madvise(MADV_HUGEPAGE) (or an allocator that does), or reuse decode output buffers across batches so pages are faulted once per scan instead of once per batch. Both would give the 2-3.5x above without asking users to set allocator tunables.

Lingua principale
Rust
Stelle
7.3k
Fork
929
Merge medio
2g 22h
PR unite (30g)
572

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 lance-format/lance

Tutte le issue di lance-format/lance

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.