Skip to content

Report warmup downloads per field and segment component - #6886

Draft
PSeitz wants to merge 1 commit into
quickwit-oss:mainfrom
PSeitz:field_download_stats
Draft

PSeitz wants to merge 1 commit into
quickwit-oss:mainfrom
PSeitz:field_download_stats

Conversation

@PSeitz

@PSeitz PSeitz commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

Description

Reports warmup reads per field and segment component in SplitResourceStats.field_download_stats (returned in SearchResponse.resource_stats).

  • count_reads_for_field(field_name, fut) sets the field in a tokio task-local while fut is polled. Leaf warmup wraps each per-field future (term dict, postings, positions, fast fields, fieldnorms) with it.
  • CountingStorage counts reads with a field set per (field_name, component), in addition to its existing totals. The component is the extension of the tantivy segment file read by the outermost CountingStorage (term, idx, pos, fast, fieldnorm). It is propagated to the inner CountingStorage, which only sees the .split file.
  • Two counting layers per split:
    • requested_*: reads that missed the ephemeral cache (new layer above the fast field cache in open_index_with_caches).
    • download_*: reads that reached object storage (existing layer).
  • Stats are summed by (field_name, component) when merging split/leaf stats.

Limitations:

  • Footer and hotcache reads are not attributed to a field, so the sum of download_num_bytes over fields is at most SplitResourceStats.download_num_bytes.
  • Reads issued from tasks spawned inside the wrapped future are not attributed.
  • SplitResourceStats and LeafResourceStats are no longer Copy (repeated field).

How was this PR tested?

  • test_counting_storage_counts_reads_per_field_component: nested counting storages, concurrently joined futures, unattributed read.
  • test_leaf_search_reports_field_download_stats: leaf search reports body/term, body/idx, ts/fast with requested bytes > 0 and field download bytes < split download bytes.
  • test_add_split_stats_sums_every_field covers merging by (field_name, component).

Reads issued within count_reads_for_field are counted per (field, component)
by CountingStorage. The component is the extension of the tantivy segment file
read by the outermost CountingStorage (term, idx, pos, fast, fieldnorm) and is
propagated to inner ones, which only see the .split file.

Two counting layers in leaf search: reads missing the ephemeral cache
(requested) and reads reaching object storage (download). The breakdown is
returned in SplitResourceStats.field_download_stats and summed by
(field_name, component).

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant