Skip to content

perf(onlion): the fold runs after the response - #132

Merged
wefio merged 1 commit into
mainfrom
perf/fold-after-response
Oct 30, 2026
Merged

wefio merged 1 commit into
mainfrom
perf/fold-after-response

Conversation

@wefio

@wefio wefio commented Oct 30, 2026

Copy link
Copy Markdown
Owner

What

  • Doc owner: `docs/decisions/implemented/2026-10-30-fold-runs-after-the-response.{md,zh-CN.md,terms.yaml}` — the round the fold moved out of the accept response path. Measured at 14:09-14:15 concurrency-16 burst: 5 requests killed at 120 s, every stack in `foldPending`; Adds 11-25 s / tail 100.7 s. Root cause: folds awaited inline before the response; the 20 s budget only gates the start.
  • Accept returns first, the scheduled fold runs via `waitUntil` (production: the Makers EventContext supplies it; the entry now passes it, which also turns the opt-in shared failure history on). No waitUntil → budgeted inline fold, unchanged; `NMG_FOLD_INLINE=1` pins it for tests.
  • Corrects the prior record: `2026-10-29-accept-without-cas` claimed the entry never receives an execution context — false on the platform (both models carry `waitUntil`); superseded, with what the original rejection still got right (read path free of document embedding).

Not verified

Not verified against the deployed build yet (local 37 PASS). No burst has been repeated post-deploy. The provider 19-24 s document calls under burst are intentionally out of scope (documented in the record).

Measured against the deployed build in a concurrency-16 Add burst
(2026-10-30 14:09-14:15): five requests died at the 120 s ceiling and every
one of them was in foldPending; ordinary Adds ran 11-25 s with a 40-100 s
tail, all waiting for folds riding inside the accept. The 60 s slow-reports
showed running:1/waiting:0 - the isolate was not congested; the fold was.

The response now comes first. The scheduled trigger and the 20 s budget stay;
with an execution that can wait (the Makers Functions EventContext supplies
waitUntil - the entry simply never passed it before) the fold starts after
the response and the client is gone. A fold killed mid-flight loses one
backfill, not a scored attempt: the entry is durable before any fold work and
`/admin/fold` still drains what remains. Callers without waitUntil keep the
budgeted inline fold; NMG_FOLD_INLINE=1 pins it for determinism.

Also corrected this round: the accept-without-cas record claimed the entry
never receives an execution context. Both documented EdgeOne function models
carry waitUntil (the Edge Functions FetchEvent, and the Makers handler
EventContext); the entry never destructured it, which also left the opt-in
shared failure history permanently off. That claim is superseded here.

Recorded in docs/decisions/implemented/2026-10-30-fold-runs-after-the-response.*
@wefio
wefio merged commit 0b50251 into main Oct 30, 2026
8 checks passed
@wefio
wefio deleted the perf/fold-after-response branch October 30, 2026 06:39
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