# Streaming SSR & Progressive Flushing vs Resumability vs Hydration

- **Canonical URL:** https://frontend.rocks/vs/streaming-ssr-flushing-vs-resumability-vs-hydration/
- **Relation:** Contrasts With
- **Last Verified:** 2026-11-15
- **Verdict:** Streaming SSR still hydrates streamed HTML on the client, whereas resumability serializes listener boundaries to skip eager hydration.

## Comparison Matrix

| Dimension | Streaming SSR & Progressive Flushing | Resumability vs Hydration |
| :--- | :--- | :--- |
| **Maturity** | Baseline · Widely | Experimental |
| **Domain** | Network & Performance | State & Architecture |
| **Mental Model** | Streams the HTML <head> and shell immediately over HTTP/2+ while slow backend queries run, then flushes deferred <template> chunks for out-of-order DOM replacement. | Contrasts eager SSR hydration—which replays component trees on the client to attach listeners—with resumability, which serializes state in HTML and loads handlers lazily. |
| **Prerequisites** | Preload Scanner and fetchpriority Attribute (Flushing <head> early lets the preload scanner fetch CSS and JS while the server awaits DB queries.); HTTP/2 & HTTP/3 Multiplexing (Chunked DATA frames stream progressively over a single multiplexed connection.); Streams API and Backpressure Mechanics (Streaming SSR writes HTML chunks through a ReadableStream that respects socket backpressure.) | Streaming SSR & Progressive Flushing (Both hydration and resumability boot on top of server-rendered HTML streamed to the browser.) |
| **When Not to Use** | When not to use Streaming SSR: On static or edge-cached pages that render in under 15 ms, full-response caching with s-maxage is simpler and avoids open long-lived connections; if client hydration cost dominates, compare against Resumability vs Hydration. | When not to use Resumability: In dense, always-interactive single-page tools (Figma-like canvases, IDE editors) where 95% of UI handlers are needed within the first second anyway. |

## Streaming SSR & Progressive Flushing — Under the Hood
Classic buffered SSR holds the entire HTTP response hostage until the slowest microservice replies, starving both the [Preload Scanner](/concepts/preload-scanner-hints) and the user's screen. Streaming SSR works like a sushi conveyor belt: plates leave the kitchen as soon as they're ready over [HTTP/2 & HTTP/3](/concepts/http2-http3-multiplexing).

1. The server commits `200 OK` and flushes `<!doctype html><head>...` plus fallback placeholders immediately, dropping TTFB to ~20 ms.
2. The HTML parser builds the DOM incrementally without waiting for `</html>`, starting CSS/JS fetches and painting the shell.
3. When an async boundary resolves, the server appends a hidden `<template id="B:1">` and a 2-line inline `<script>` that swaps it into the placeholder.

```js
const stream = new ReadableStream({
  async start(controller) {
    controller.enqueue(encode('<!doctype html><html><head><link rel="stylesheet" href="/app.css"></head><body><div id="slot">Loading...</div>'));
    const data = await fetchSlowRecommendations();
    controller.enqueue(encode(`<template id="t1">${renderList(data)}</template><script>slot.replaceWith(t1.content)</script></body></html>`));
    controller.close();
  },
});
```

## Resumability vs Hydration — Under the Hood
Hydration is like shipping a pre-assembled bicycle, then disassembling and reassembling every bolt in the driveway just to test the brakes. While that replay runs after [Streaming SSR](/concepts/streaming-ssr-flushing), users hit the "uncanny valley", stalling [Core Web Vitals](/concepts/core-web-vitals-mechanics) INP.

1. **Hydration**: Downloads component JS, reconstructs the VDOM tree in memory, diffs it against existing DOM nodes, and binds `addEventListener` per node.
2. **Partial / Islands Hydration**: Hydrates only interactive islands (`<CartWidget />`), leaving static prose as zero-JS HTML.
3. **Resumability**: Serializes state (`<script type="qwik/json">`) and handler URLs (`on:click="./chunk.js#fn"`) into HTML, relying on [DOM Event Propagation](/concepts/dom-event-propagation) at `document` to lazy-load code on demand.

```html
<!-- Resumable boundary: zero JS executed until the user clicks -->
<button on:click="./cart-chunk.js#increment" data-state-id="4">
  Qty: <span>1</span>
</button>
<script type="application/json" id="state-4">{"qty":1}</script>
```

## Interactive Labs & Dissections
- [Streaming SSR & Progressive Flushing Lab](https://frontend.rocks/concepts/streaming-ssr-flushing/#lab) ([Markdown](https://frontend.rocks/concepts/streaming-ssr-flushing.md))
- [Resumability vs Hydration Lab](https://frontend.rocks/concepts/resumability-vs-hydration/#lab) ([Markdown](https://frontend.rocks/concepts/resumability-vs-hydration.md))

## Related Architecture Autopsies
- [Autopsy #06: Anatomy of a Hydration Mismatch & Full Subtree Bailout](https://frontend.rocks/autopsies/hydration-flicker-and-bailout/) ([Markdown](https://frontend.rocks/autopsies/hydration-flicker-and-bailout.md)): SSR page paints instantly, flickers violently when JS boots, and wipes user input in form fields.

## Primary Sources
- https://developer.mozilla.org/en-US/docs/Web/API/Streams_API
- https://html.spec.whatwg.org/multipage/parsing.html
- https://web.dev/articles/rendering-on-the-web
- https://qwik.dev/docs/concepts/resumable/
- https://developer.mozilla.org/en-US/docs/Glossary/Hydration
