Repository navigation
8.8.2 (2026-11-30)
Performance Improvements
Fast streaming Brotli for SSR documents
No API change. Under load, streaming br for SSR documents is now faster than a plain node:http server with the compression package (Brotli quality 4).
What changed
- On the Node transport, a body the kit encoded is piped straight from the zlib stream into the socket with Node backpressure. It no longer goes back through a Web stream. A body that a later layer rewrapped (for example with
pipeThrough) still goes through the Web reader. - The encoder still flushes once per event-loop turn, so the shell leaves early.
- Brotli uses a 512 KiB window (
BROTLI_PARAM_LGWIN19) instead of the 4 MiB default. Each encoder holds far less native memory, which avoids the full garbage collections the 4 MiB window forced under concurrent load. Documents up to 512 KiB compress to the same size within a few bytes. Larger bodies come out about 1% bigger.
Correction to 8.8.0
The 8.8.0 notes claimed p99 parity for streaming br documents. That was wrong. An app's production bench (Docker --cpus=2 --memory=1g, autocannon -c 50 -d 30) measured the 8.8.0 document br p99 at about 3x the compression package's. 8.8.2 closes that gap.
Benchmark
Method:
- autocannon
-c 50 -d 30,Accept-Encoding: gzip, deflate, br, zstd - 3 rounds, with the cases alternating inside each round
- server pinned to 2 CPUs (
taskset),NODE_ENV=production, heap cap 768 MB, Node 22.23.2 - synthetic React streaming SSR document, about 11.5 KB compressed
Cases:
main:node:http+compression(br q4)8.8.0: the 8.8.0compressionoption8.8.2: this release
Medians of 3 rounds:
| case | rps | p99 ms | bytes/req | TTFB ms | CPU ms/req | peak RSS MB |
|---|---|---|---|---|---|---|
| main br | 173.87 | 430 | 11553 | 2.26 | 9.11 | 518.4 |
| 8.8.0 br | 153.64 | 386 | 11727 | 2.53 | 10.30 | 521.9 |
| 8.8.0 gzip | 195.04 | 289 | 11660 | 1.61 | 7.05 | 117.2 |
| 8.8.2 br | 193.77 | 315 | 11720 | 2.51 | 7.34 | 225.9 |
| 8.8.2 gzip | 203.94 | 286 | 11652 | 1.55 | 6.77 | 115.2 |
Raw p99 per round (ms): main 430 / 480 / 364, 8.8.2 br 303 / 315 / 333, 8.8.0 br 556 / 386 / 382.
Raw rps per round: main 173.87 / 177.44 / 172.10, 8.8.2 br 195.90 / 193.77 / 191.57.
Compared with main's br, 8.8.2 br has p99 -27%, rps +11%, CPU per request -19% and peak RSS -56%. Compared with 8.8.0 br it has p99 -18% and rps +26%.
A hand-written Node pipe (renderToPipeableStream → createBrotliCompress → res) measured in the same run is within noise of 8.8.2, so this is close to the floor for Node streaming Brotli.
Limits of this bench:
- It ran on a shared host without Docker. The CPU limit is
tasksetand the memory limit is a V8 heap cap, not a cgroup. - The app is synthetic. Compare cases only within one run.
Not improved:
- Bytes per response are 1.4% above main, because the kit flushes once per turn so the shell streams early.
- TTFB with br is about 1 ms above gzip. That is the Brotli encoder's setup cost.
- Peak RSS with br is about twice gzip's. Use
format: 'gzip'when memory matters most.
Fixes
- A renderer chunk that is not bytes now fails the response and cancels the renderer. Before, the response hung.
- ArrayBuffers from other realms are accepted.
- The renderer is cancelled with the socket error that failed the pipe.
- The response keeps an error listener until it closed, also when ending it throws, so a late socket error cannot crash the process.
- Every response listener is released once the response closed.