Skip to content

feat(io): report peak bytes in flight and over-budget admissions - #9738

Closed
amunra wants to merge 1 commit into
lance-format:mainfrom
rerun-io:upstream/scheduler-backpressure-stats
Closed

amunra wants to merge 1 commit into
lance-format:mainfrom
rerun-io:upstream/scheduler-backpressure-stats

Conversation

@amunra

@amunra amunra commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Both schedulers track a byte budget but expose nothing about it. The only
available measurement is whole-process RSS, which cannot separate scheduler
prefetch from decode buffers from a caller's own working set.

ScanScheduler::backpressure_stats() reports, alongside the existing stats():

  • max_bytes_in_flight — high-water mark of bytes reserved and not yet released.
  • bytes_in_flight — the same quantity now.
  • over_budget_admissions — chunks admitted although the budget did not cover
    them, because nothing of lower priority was in flight or the chunk belonged to
    a request already in flight. This is where the budget is soft rather than hard,
    and the only evidence it happens at all was a debug log.

Both the standard and the lite scheduler report these, so the numbers mean the
same thing whichever is in use. Reads from a bypass_backpressure file
scheduler are never debited and stay outside every field, as does everything
under io_buffer_size == 0, which disables byte accounting; the struct doc
states both.

Additive: one new public struct and one accessor, no behaviour change.

Tracking: Ported from rerun-io#63.

Both schedulers track a byte budget but expose nothing about it, so its actual
behaviour is unobservable: the only available measurement is whole-process RSS,
which cannot separate scheduler prefetch from decode buffers from a caller's own
working set.

Adds a high-water mark of bytes reserved and not yet released, the current value
of the same quantity, and a count of chunks admitted although the budget did not
cover them -- because nothing of lower priority was in flight, or because the
chunk belonged to a request already in flight. That last number is where the
budget is soft rather than hard, and the only evidence it happens at all was a
debug log. It counts post-coalescing chunks, so one caller request may
contribute several.

Surfaced through `ScanScheduler::backpressure_stats()` alongside the existing
`stats()`. Both the standard and the lite scheduler report it, so the numbers
mean the same thing whichever is in use; reporting zeroes for one of them would
be indistinguishable from a budget that was never approached.

Two quantities stay deliberately outside these counters, and the struct doc says
so: reads from a `bypass_backpressure` file scheduler, which are never debited
and bounded by nothing, and everything under `io_buffer_size == 0`, which
disables byte accounting altogether.

Covered by extending four existing tests: `test_backpressure` for the peak and
the over-budget count, `test_lite_scheduler_submits_eagerly` for the lite path,
`test_file_scheduler_bypass_backpressure` for the bypass exemption, and
`test_zero_buffer_size_no_backpressure` to pin that a disabled budget reports
nothing rather than a measured zero.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@github-actions github-actions Bot added A-encoding Encoding, IO, file reader/writer enhancement New feature or request labels Oct 6, 2026
@amunra amunra closed this Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-encoding Encoding, IO, file reader/writer enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants