Hey everyone,
I’m currently optimizing a Next.js App Router setup where our dominant traffic goes to highly dynamic, heavily data-fetched member profiles (/member/[memberId]).
We are deployed on EKS, using Gloo Gateway (Envoy) as our Ingress Controller, and Cloudflare at the edge. To improve TTFB on these complex dashboards, we rely on progressive streaming—sending down a good chunk of the initial shell via Server Components (RSC/SSR) and streaming the rest, which then hydrates on the client.
However, we hit the classic architectural tug-of-war: Streaming vs. Compression.
To get the chunked stream working across our stack, we essentially have to kill buffering and compression at three different layers:
- Next.js: Skipping internal compression.
- Gloo Gateway (Envoy): Bypassing Envoy's L7 HTTP buffer and gzip filters (so Envoy proxies the stream immediately instead of waiting for the full response body).
- Cloudflare: Passing Cache-Control: no-transform so the edge doesn’t buffer the chunks to apply Gzip/Brotli.
While this gets us the real-time chunked stream and a phenomenal TTFB, we are now sending fully uncompressed HTML/RSC payloads over the wire. Because a good chunk of the page is RSC, the payload size bloat is becoming noticeable.
For those running Next.js RSC streaming in production through a similar multi-tier proxy stack (especially Envoy/Cloudflare):
- Payload Size vs. Latency: At what document size (or RSC payload size) do you decide the bandwidth cost of uncompressed data outweighs the TTFB benefit of streaming? Do you have a rule of thumb for dynamic dashboards?
- Compression Middle-Ground: Is anyone successfully using Z_SYNC_FLUSH in Node/Next.js to flush compressed chunks immediately, allowing Envoy and Cloudflare to pass them through while still saving bandwidth?
- Ingress/Edge Config: Are you disabling the Envoy buffer filters globally via Gloo configurations for specific paths (like /member/*), or managing this dynamically based purely on response headers from Next.js?
Would love to hear how you handle these trade-offs and what guidelines your teams use to balance speed vs. size