Skip to content

timely-util,compute-types: pool configuration and metrics behind dyncfgs#37719

Merged
DAlperin merged 1 commit into
mainfrom
dov/pool-config
Jul 23, 2026
Merged

timely-util,compute-types: pool configuration and metrics behind dyncfgs#37719
DAlperin merged 1 commit into
mainfrom
dov/pool-config

Conversation

@DAlperin

@DAlperin DAlperin commented Jul 17, 2026

Copy link
Copy Markdown
Member

Motivation

Wires the mz_ore::pool buffer manager (#37718) to configuration and
observability. The pool stays consumer-less after this PR; chunk batchers adopt it
in later PRs of the stack. The design is #37717.

The top merge risk is behavior change under default configs, so the central
property is that a stock process behaves exactly as before: the pool is never
constructed and the legacy pager stays fully operational.

Description

  • Installation is gated. apply_pool_config runs only when a spill gate
    (enable_column_paged_batcher_spill or enable_upsert_paged_spill, both default
    false) is on. A process that never enables spilling never constructs the pool:
    no address-space reservation, no spill threads. The first config tick with a gate
    on installs the pool; installation is one-way (documented), later ticks retune in
    place.
  • Budgets derive from physical RAM (cgroup-clamped), never from the announced
    memory limit, which includes swap on swap-provisioned nodes.
  • Metrics. 24 mz_column_pool_* computed gauges registered with literal names
    and help strings the metrics-catalog generator reads. doc/user/data/metrics.yml
    is regenerated.
  • The legacy pager is untouched. Its tiered config still applies, its dyncfgs
    stay registered and stay in the Python test-flag lists, and its metrics stay in
    the catalog. It is deleted at the end of the migration, not here.

Verification

cargo check across the touched crates. bin/lint-test-flags and the
metrics-catalog lint both pass (reproduced locally). The regenerated metrics.yml
is byte-identical to generator output. No behavior change under default configs:
the pool is never installed and the legacy pager path is unchanged.

@DAlperin
DAlperin force-pushed the dov/pool-config branch 2 times, most recently from de60200 to 92bfe1e Compare July 20, 2026 21:53
@DAlperin
DAlperin force-pushed the dov/ore-pool branch 2 times, most recently from 57e61a7 to ba44852 Compare July 21, 2026 20:21
Base automatically changed from dov/ore-pool to main July 22, 2026 20:21
DAlperin added a commit that referenced this pull request Jul 22, 2026
…37718)

### Motivation

Implements Layers 1 and 2 of the buffer-managed-state design (#37717) as
a new
`mz_ore::pool` module: the swap-backed, size-classed buffer manager that
replaces
the pager's blob spilling.

The pool is dead code in this PR. Nothing constructs it; the wiring
arrives in the
next PR of the stack (#37719) and consumers land later. There is zero
behavior
change, and every commit builds `--locked`.

### Description

Five commits, each buildable and tested on its own:

1. **The pool.** Size-classed anonymous regions, residency-scoped slots,
copy-out
reads under a per-chunk state lock, second-chance eviction banded by
depth,
spill threads for off-worker eviction I/O, warm slot reuse, budget
enforcement.
2. **Observed pageout.** `MADV_PAGEOUT` is advisory, so the ledger
trusts an
observation of the mapping rather than the advice's return value, with a
   per-extent retry budget.
3. **Hot-chunk re-admission.** `read_into_admit` returns an evicted
probe target
to a slot from free-budget headroom or by stealing a clean backed
victim's slot
   in place. Deadlock-free by try-lock discipline on the victim.
4. **Extent arena.** Extents move off the global allocator into
pool-owned
`MADV_NOHUGEPAGE` regions (jemalloc recycling of paged-out ranges caused
major-fault storms and swap-slot churn). Retry-capped extents leave the
enforcement queue onto an unreclaimable gauge so a kernel that declines
reclaim
cannot put a queue walk on every insert. Ledger fixes: budget enforced
against
evictable bytes, warm-slot trims and cooling, `MADV_DONTDUMP`, THP
opt-out on
   sub-hugepage regions, cgroup v1 / nested-v2 memory detection.
5. **Page-table observation and budget-charged steals.** The pageout
observation
reads `/proc/self/pagemap` present bits rather than `mincore`, which
counts the
clean swap-cache copies of successfully reclaimed pages as resident and
would
retry-cap every extent on healthy async swap. A slot steal settles the
ledger
with the payload difference and a growing steal is charged against the
budget
   like any other admission.

### Verification

68 unit and concurrency tests, all of which also run under Miri
(data-race and
provenance checking, including the spill-thread and admission-steal
races). 6 Kani
proof harnesses over the arithmetic the unsafe blocks rest on
(size-class
selection, slot-offset bounds, extent-ladder coverage, allocator
disjointness).
Linux-target cross-checks of the madvise, pagemap, and cgroup paths. The
verification footprint is roughly one line per line of pool logic.
@DAlperin
DAlperin requested a review from antiguru July 23, 2026 15:29
@DAlperin
DAlperin marked this pull request as ready for review July 23, 2026 15:29
@DAlperin
DAlperin requested review from a team as code owners July 23, 2026 15:29

@antiguru antiguru left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

/// no effect beyond re-enabling, and lowering it to zero falls back to
/// inline eviction while spawned threads idle.
pub const COLUMN_PAGED_BATCHER_SPILL_WORKER_COUNT: Config<usize> = Config::new(
"column_paged_batcher_spill_worker_count",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering if this should be a fraction of the size, but then I remembered that we can use replica-targeting to configure it!

@DAlperin
DAlperin merged commit 93dcb0e into main Jul 23, 2026
129 checks passed
@DAlperin
DAlperin deleted the dov/pool-config branch July 23, 2026 20:18
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.

2 participants