Skip to content

Add streaming response optimization spec#562

Open
aram356 wants to merge 7 commits intomainfrom
specs/streaming-response-optimization
Open

Add streaming response optimization spec#562
aram356 wants to merge 7 commits intomainfrom
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 #565

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

aram356 added 3 commits March 25, 2026 08:20
Move spec-like documents from root and docs/internal into a structured
layout under docs/superpowers with timestamped filenames:

- specs/: active design documents (SSC PRD, technical spec, EdgeZero
  migration, auction orchestration flow, production readiness report)
- archive/: completed or historical specs (optimization, sequence,
  publisher IDs audit)
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.
aram356 added 3 commits March 25, 2026 10:57
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.
Base automatically changed from docs/organize-specs-and-archive to main March 26, 2026 15:57
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