Skip to content

Add streaming response optimization spec#562

Open
aram356 wants to merge 2 commits intodocs/organize-specs-and-archivefrom
specs/streaming-response-optimization
Open

Add streaming response optimization spec#562
aram356 wants to merge 2 commits intodocs/organize-specs-and-archivefrom
specs/streaming-response-optimization

Conversation

@aram356
Copy link
Collaborator

@aram356 aram356 commented Mar 25, 2026

Summary

  • Design spec for streaming HTTP responses through the publisher proxy when Next.js is disabled
  • Targets both TTFB/TTLB improvement and peak memory reduction (from ~4x response size to constant)
  • Two implementation steps: (1) make pipeline chunk-emitting, (2) wire up Fastly StreamingBody
  • Streaming gate: only activates when html_post_processors() is empty (Next.js disabled)
  • Verified against Fastly SDK 0.11.12 API (stream_to_client, StreamingBody, Request::from_client)

Stacked on #560 (docs reorganization).
Closes #563

Test plan

  • Spec reviewed for technical accuracy against codebase
  • Fastly SDK assumptions verified (no fastly::init, StreamingBody implements Write, abort-on-drop)
  • All compression paths covered (gzip, deflate, brotli — both keep and strip)
  • Error handling covers pre-stream and mid-stream failure modes

Design spec for streaming HTTP responses through the publisher proxy
when Next.js is disabled. Covers two implementation steps:

1. Make the streaming pipeline chunk-emitting (HtmlRewriterAdapter,
   gzip, encoder finalization)
2. Wire up Fastly StreamingBody via stream_to_client() with entry
   point migration from #[fastly::main] to undecorated main()

Includes streaming gate logic, error handling, rollback strategy,
and testing plan. Verified against Fastly SDK 0.11.12 API.
Add before/after measurement protocol using Chrome DevTools MCP tools:
network timing capture, Lighthouse audits, performance traces, memory
snapshots, and automated body hash comparison for correctness.
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.

Implement streaming response optimization for non-Next.js publisher proxy

1 participant