Repository navigation
execd: the disk-writer pool is a constant of eight, with no inline mode - #750
Merged
Merged
Conversation
EXECD_DISK_WRITERS sized the off-runtime disk pool, and 0 restored writing job output inline on the event loop — the bug #744 fixed, kept only as a rollback switch. A new sandbox gets the new binary, so no deployment has a use for the old mode. The pool stays as DISK_WRITERS = 8 with the same semaphore and the same Ctx::disk_turn gate; output batches, the ledger, a keyed start's claim and a retention sweep all take a turn, always. The before-state lives on as the test-only mut_tail_write_inline mutation, under which the off-runtime proof test goes red. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
jaredLunde
force-pushed
the
execd/remove-disk-writers-flag
branch
from
November 28, 2026 00:15
bb28ff6 to
52efd23
Compare
…eads The disk-writer pool is the constant DISK_WRITERS; the environment list in ARCHITECTURE.md still offered EXECD_DISK_WRITERS as a knob, which would send a deployment looking for a setting execd no longer has. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
EXECD_DISK_WRITERSsized the off-runtime disk pool, and0restored writing job output inline on the event loop — precisely the bug #744 fixed (a stuck write held the runtime thread and every caller with it). It existed as a rollback switch, and under the no-rollback-flag rule the switch goes: a new sandbox gets the new binary, so no deployment has a use for the old mode and nobody should be able to run it.Rebased onto
mainafter #746-#749 landed (the ledger, the list/read buffer, the kernel child list, the one-file chunk layout); no conflicts, and everything below was re-run at the rebased head.What is gone
config.rs(field, parse,USAGE), out ofOptions(the public field and its default), out ofmain.rs, out of the README table.let threaded = self.ctx.opts.disk_writers > 0and everything it gated.Tailing::flushno longer has an on-runtime path, andTailStep::AgainYielding(the "give the runtime a turn between rounds" state) is gone with it.with_disk_writers_zero_a_stuck_output_write_stalls_every_caller_as_before.What stays
The pool, as
DISK_WRITERS: usize = 8, with the sametokio::sync::Semaphoreand the sameCtx::disk_turngate. Output batches, the ledger write of a life change, a keyed start's claim and the retention sweep all take a turn, always. The constant's doc says what the number bounds and why: it is disk queue depth — how many writes are outstanding against the disk — not CPU, because each writer is a blocking thread that spends its time inwrite. A deeper pool only lengthens the queue on a slow disk; a shallower one makes a job's own tail wait behind unrelated writes. Anything past the pool waits its turn (the spool file holds what it wrote meanwhile), so the bound can delay a write and never drop one.The before-state lives in the mutant, not in production
mut_tail_write_inlineis a test-only Cargo feature that puts the batch back on the runtime, one round at a time, yielding between rounds — the exact path #744 removed. Under it,a_stuck_output_write_does_not_stall_an_unrelated_callergoes red, so the off-runtime property keeps a red run of its own after the flag is gone.Two tests changed shape, and here is why each change makes them stronger rather than weaker:
writer_threads_are_bounded_by_disk_writers_and_the_rest_wait→writer_threads_are_bounded_to_eight_and_the_rest_wait: ten jobs through the pool, eight batches on the stuck disk, two jobs logging that they wait,most== 8. It also runs withEXECD_DISK_WRITERS=2in the environment and requires eight batches anyway, so the test now pins the constant and fails if the variable is ever read again.a_retention_sweep_waits_for_a_disk_writer_turn: it used to hold "the only turn" atEXECD_DISK_WRITERS=1. With a fixed pool of eight it now starts eight jobs so every turn is held, then proves the sweep's decision shows while its ledger write and unlinks wait.Proof
Red runs at this head, none anchor-missing, tree clean afterwards (
handoffs/CAPY-15/red-runs.pyin the captain drive):mut_tail_write_inline(the batch on the runtime)a_stuck_output_write_does_not_stall_an_unrelated_callerleft: None, right: Some(200)—/livezunansweredSemaphore::new(DISK_WRITERS * 1000)writer_threads_are_bounded_to_eight_and_the_rest_waittimed out waiting for eight batches on the disk and two other jobs waitingSemaphore::new(2)(the shape reading a knob would give)a_retention_sweep_waits_for_a_disk_writer_turnGreen at this head on the pinned rust 1.92 (
cargo test -p beyond-execd --locked --no-fail-fast, 396 s, every binary): lib 63, bin 8, auth_matrix 5, baseline 1, binary 3, conformance 2, embed 15, embed_callbacks 2, embed_hooks 5, endpoint 16, faults 15, guard 2, interval 3, job_escape 7, job_model 11, jobmark 7, jobproto 13, jobtable 1, keeper_model 2, ledger 10, oneshot_headers 4, os_model 2, output 7, pack 6, parsers 1, pipe_backlog 2, pty 15, reaper 1, restart 10, retention 15, route_hook 3, security 16, signals 1, startkey 9, timeout 2.clippy -D warnings,cargo fmt --checkanddprint checkclean.differentialis flaky on the development host in both trees (its own thread report has the counts); CI runs it and is green here.The slow disk, measured on the real binary
slowdisk.so(CAPY-8'sLD_PRELOADshim, rebuilt fromslowdisk.c) bills 300 ms per 128 KiB written under the whole state and jobs tree. One job writes 8,488,896 bytes (seq 1 1200000); another connection asksGET /livezevery ~2 ms while the output drains; then the whole output is read back and compared byte for byte. This head againstmain(e6a69b7):/livezp50maine6a69b7maine6a69b7maine6a69b7Every run:
complete: true, 8,488,896 bytes, in order. So a job whose output takes 39.8 seconds to reach the disk costs an unrelated/livez0.25 ms at p50 and 0.37 ms at p95 — the same numbers to within noise on both binaries, which is the point: the shipped behaviour is the shipped behaviour. The fast-run p95 spread (9.3 vs 29.1 ms over 23 and 33 probes) is one scheduler hiccup in a 200 ms burst, not a shape difference; the 16,000-probe rows are the ones that mean anything.Not in this PR
Nothing else:
tail.rsandmise.tomlnever named the knob, and neither do the drive's slow-disk shims (checked).ARCHITECTURE.mdis updated in the same commit — the configuration list, the one-gate paragraph, and the tests list.