Skip to content

feat: add adaptive fill admission before I/O timeouts - #59

Merged
leiysky merged 5 commits into
mainfrom
dev/adaptive-fill-admission
Sep 20, 2026
Merged

leiysky merged 5 commits into
mainfrom
dev/adaptive-fill-admission

Conversation

@leiysky

@leiysky leiysky commented Sep 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Slow background work previously continued accepting cache fills until staging saturated or the normal I/O deadline expired. Add optional pre-timeout fill control: Observe reports pressure and hypothetical rejections, while Adaptive limits new fills by encoded bytes and record count, pauses on stalled work, and resumes gradually after validation. The default remains disabled.

Reads, deletes, accepted writes, and essential reclaim retain their existing paths. Pressure is separate from terminal health. Snapshots expose request age, approximate drain time, phase durations, and admission counters; enabled snapshots take a short controller lock. Configuration, architecture, errors, and benchmark controls document the final contract.

Design Notes

A 100 ms monitor observes a fixed table of worker-owned background requests through admission, result consumption, and validation/publication. Request age and lack of validated progress can pause admission before the original timeout, including when no completion arrives. Configured byte/record budgets use bounded atomic reservations without foreground allocation, clock reads, or controller locks. Enabled modes account for one monitoring stack and their fixed observations. Accepted I/O is never resubmitted, and pressure suppresses optional reinsertion.

These are conservative workload-pressure signals, not a diagnosis of device failure or CPU throttling. Linux device/cgroup and io_uring qualification remains necessary.

Validation: cargo x check, cargo x test, and cargo x lint passed on macOS, including real blocked-backend pre-timeout detection, validation-gated recovery, continued reads/deletes, concurrent admission, and extended recovery tests. Fifteen alternating buffered benchmark runs passed; substantial host variability prevents a credible overhead percentage. A separate rate-limited run completed all writes and reads with expected admission rejections.

@leiysky
leiysky force-pushed the dev/adaptive-fill-admission branch from a77b5b4 to 5ea2918 Compare September 20, 2026 14:56
A full observation table must not fail cache I/O, and the 100 ms monitor
must not be reset by each submit. Observe would_reject now tracks pause
and budget policy only. Shared rate ceilings are FillLimits rather than
AdaptiveFillOptions.
Keep put competing only for staging. Workers checkpoint old I/O and
pace non-essential flush so Adaptive can pause without a monitor thread.
Raise the record ceiling to the packed-credit limit, preserve refill
time across sub-tick wakes, and refund only consumed burst. Document
that FillLimits are instance-wide.
#57 collapsed BackendIoEngine; the Adaptive pause test now uses
IoEngine::for_test.
@leiysky
leiysky force-pushed the dev/adaptive-fill-admission branch from 19626bc to 69ccbeb Compare September 20, 2026 16:02
@leiysky
leiysky enabled auto-merge (squash) September 20, 2026 16:03
@leiysky
leiysky merged commit 13a2dc6 into main Sep 20, 2026
8 checks passed
@leiysky
leiysky deleted the dev/adaptive-fill-admission branch September 20, 2026 16:08
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