review: watermark rate sampling, egress door connection cap, Python bulk-frame cases - #180
Merged
Merged
Conversation
The watermark folded 1/dt of every consecutive pair into its EWMA, so two claims a millisecond apart read as 300 per second and pinned the target at warm_max for minutes. Arrivals now accumulate in a bin that closes on the first claim after a second and folds arrivals per second; the decay over silence is unchanged, and sustained demand still reaches warm_max within a few seconds.
Both doors accepted without bound, so a guest could hold host goroutines and descriptors for every connection it opened on a host it shares with other tenants. The listeners are wrapped at arm time, so the pre-bind probe still sees the raw listener and close ends a blocked accept; a dial past the cap waits in the backlog.
The fast slicer's rejection set matched the Go decoder's only in three of nine malformed shapes; the other six and the tag-after-other-keys frame now run on the Python side too.
A bin that closed after a long silence folded its near-zero sample against the rate stored at the last close, so two claims after ten quiet minutes brought the target most of the way back to warm_max. The stored rate is decayed over the bin's span before the fold; effectiveTarget's read-time decay is unchanged.
The door cap bounds guest-side descriptors, but the upstream transport kept eight idle connections per host with no total, so a guest walking many allowed hosts parked a descriptor per host for ninety seconds; sixty-four idle upstream connections per sandbox is the ceiling now.
Under the race detector the server accepts more slowly than the test dials, so a dial past the listen backlog is refused instead of queued; the test now retries a refused dial.
CMGS
force-pushed
the
review/whole-repo-0915-followup
branch
from
September 14, 2026 16:06
857113b to
8d032f6
Compare
This was referenced Sep 14, 2026
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.
Follow-up to #179 (rebased onto
mainafter #179 merged as 58a4c86). The three items the review round classified as fix-now, each in its own commit with a test that fails on the base.Changes
1/dtof every consecutive claim pair into its rate EWMA, so two claims a millisecond apart read as 300/s and pinned the warm target atwarm_maxfor minutes (rateDecayTau60 s)TestEffectiveTargetIgnoresATwoClaimBurst(fails on the base: target 20),TestEffectiveTargetTracksDemandnow drives 10/s for 6 s and still reacheswarm_maxLimitListenerof 256 at arm time (the pre-bind probe still sees the raw listener; close ends a blocked accept); a dial past the cap waits in the socket backlog.TestEgressDoorCapsConcurrentConnections(fails on the base: the 257th request is served). One sentence in docs/egress.mdwarm_maxTestEffectiveTargetForgetsRateAcrossSilence(fails on the undecayed fold: target 5)MaxIdleConns64 per sandbox; the doc sentence says what each cap boundsBehavior change worth reading: the watermark now needs about a second of arrivals before it moves, and a burst that ends within that second never raises the target. Sustained demand (10/s with a 0.5 s lead) reaches
warm_maxin 3–5 s instead of after the third claim; the ~60 s decay is unchanged.Hot-path cost:
noteArrivaldoes one comparison and an increment per claim and a division once per second, in place of a division per claim; the door cap adds one semaphore acquire per accepted connection, not per byte.Hardware
Isolated kit on the bare-metal testbed (pinned cocoon binary, sqlite meta, its own root/run/log dirs), guest images
from #179's last silkd build (this branch changes no guest code). Arms:
sandboxd-base= #179 head ef9a3f6,sandboxd= this branch (built from 857113b, content-identical to the rebased head 8d032f6). Both checks readGET /v1/info's pool row or the daemon's/proc/<pid>/fdcount.Watermark (pool
warm: 2, warm_max: 8; two back-to-back claims, then four loops of claim+release for six seconds, then silence) and door cap (a guarded none-lane pool; sandbox A holds 300 idle connections to its HTTP door for 30 s while B fetches through its own door and A tries a 301st request):The base pins the target at
warm_maxfrom two claims and spins up six VMs for them; the branch holds the floor, follows sustained demand, and returns to the floor as the rate decays. On the base the flood lands 300 accepted connections on the daemon and the 301st request is served; on the branch the daemon holds 256, B's fetch is unaffected, A's 301st waits unserved until the flood ends, and the descriptor count returns to its baseline either way.An earlier pass at 3bfc0dd (before the fold-decay and idle-pool commits) gave the same door numbers and the same two-claim result; its sustained phase drove only ~3 claims/s from one sequential loop, which is why the loop was parallelised:
Full E2E on the branch binary (seven legs, same kit):
Codex
One round on 3bfc0dd, ac0aad4 after the rebase (the thread continued from #179): three MINOR, no MAJOR, and the closing sentence verbatim: "No blockers remain for the follow-up branch." All three are applied above: the stale stored rate across a silence (5df4e01), the door sentence's wording and the unbounded upstream idle pool (54f57d2).
Gates
Not in this PR (issues): the langchain absolute deadline through the Python client's redirect walk, s3 generation GC on re-publish, a Reconcile sweep for a removed pool's golden,
warmpresence in the config file.