Description
From the 2026-07-05 performance & architecture review (P0 finding 1 — the highest-priority item in the repo).
Origin body is fully buffered before any byte reaches the client. platform.rs:394 (take_body_bytes()) materializes the whole origin body (10 MiB cap) in the wasm heap before headers commit; the "streaming" pipeline then runs over an in-memory cursor (publisher.rs:61-63, acknowledged as interim at publisher.rs:342-346). TTFB and FCP therefore track full origin transfer, not origin first byte — a 2 MB article on a slow origin delays first paint by the entire transfer, contradicting the design doc's t=10ms TTFB claim.
The EdgeZero path is worse: app.rs:796-804 buffers the entire assembled response and awaits auction collection before sending anything, putting the auction inside TTFB on the migration-target path. Responses over 10 MiB become 5xx instead of streaming.
Fix
- Finish the
with_stream_response() work for the publisher origin fetch.
- Make the pipeline consume the stream variant with a cumulative cap.
- Port the streaming finalize to EdgeZero before any cutover.
Effort / expected effect
- Effort: Large
- Expected effect: TTFB/FCP track origin first byte; unblocks the headline claims. The FCP story depends on this.
Sequencing item 3 of 10.
Description
From the 2026-07-05 performance & architecture review (P0 finding 1 — the highest-priority item in the repo).
Origin body is fully buffered before any byte reaches the client.
platform.rs:394(take_body_bytes()) materializes the whole origin body (10 MiB cap) in the wasm heap before headers commit; the "streaming" pipeline then runs over an in-memory cursor (publisher.rs:61-63, acknowledged as interim atpublisher.rs:342-346). TTFB and FCP therefore track full origin transfer, not origin first byte — a 2 MB article on a slow origin delays first paint by the entire transfer, contradicting the design doc's t=10ms TTFB claim.The EdgeZero path is worse:
app.rs:796-804buffers the entire assembled response and awaits auction collection before sending anything, putting the auction inside TTFB on the migration-target path. Responses over 10 MiB become 5xx instead of streaming.Fix
with_stream_response()work for the publisher origin fetch.Effort / expected effect
Sequencing item 3 of 10.