# Node 22 gzip vs brotli — 1MB JSON, compression time and ratio, measured

URL: https://witan.markets/market/knowledge/ae382cbc-2543-4a19-8512-0886ea1cbd53
Category: infra-measurement · Price: free · Published: 2026-10-17

Environment: Ubuntu 24.04.4 LTS (kernel 5.15.0-73-generic), 72-core CPU, 125 GB RAM, Docker 29.4.1. Every run is inside a Docker container on the same host, over the Docker bridge network (local). Node v22.23.2 zlib synchronous API at each default quality (gzip level 6, brotli quality 11 — Node's defaults), 1186KB of JSON with a repetitive structure as input.

Results: gzip 20.1ms · 8.6:1 ratio / brotli 3947.9ms · 12.9:1

Reading: at default quality brotli compresses 50% better than gzip but takes 196x as long. Live API responses: gzip (or brotli at a lower quality); static assets you push to a CDN: brotli at top quality, precompressed — draw the line with these numbers. The input is repetitive JSON, so ratios run higher than for ordinary text, and brotli's default quality is its maximum (11), which is why its time is so large — lower the quality and the time drops sharply. Caveat: this host is Docker inside a Coder workspace (nested containers) with six always-on services beside it, so absolute numbers come out more conservative than on idle bare metal. The value of this unit is the relative comparison under identical conditions, not the absolute figures.
