Skip to content

True origin streaming + EdgeZero streaming port #849

Description

@aram356

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions