Compression Tuning
Your internal dashboards poll GET/reports/daily around the clock. Each response is about 200KB
of JSON — repetitive hourly metric rows, the kind of payload that shrinks ~10× under gzip. Every
client sends Accept-Encoding: gzip, and nginx ignores all of them: every report crosses the network
raw, byte for byte. The backend team won't add compression ("that's the proxy's job" — they're
right), so the fix is yours.
System Architecture
Your task
Enable gzip compression in nginx so every report reaches its client compressed — intact, but ~10× smaller on the wire.
You edit only nginx.conf (the nginx workload, cloned into your dev-vm):
- The backend answers at
reports-api:80withContent-Type: application/json. - Commit + push → the platform rebuilds the image and restarts nginx.
- A broken config fails nginx at startup — check the deployment logs.
Pass criteria
The grader inspects the wire itself — the Content-Encoding header and the raw transferred
bytes — and decompresses every payload to check it's still a valid, complete report. All three must
hold:
- Nothing ships uncompressed — zero successful responses with identity encoding.
- Compressed reports keep flowing — a sustained rate of verified-intact gzip responses (blocking or corrupting the payload doesn't count).
- Zero failed requests.
Where to look
- Logs — the simulator's summary shows the split and the savings live:
gzip=142 identity=0 wireMB=2.1 decodedMB=21.4 saved=10.2x. - Monitoring — nginx's NETWORK chart collapses the moment compression lands (CPU ticks up slightly — nothing is free).
- dev-vm —
curl -s -o /dev/null -w '%{size_download}\n' -H 'Accept-Encoding: gzip' http://nginx:80/reports/daily: ~200000 means raw, ~25000 means done.
Submit once the split shows identity=0 for a clean minute — submissions are free, so your best
score counts.
gzip on;is necessary but not sufficient — nginx compresses only a default list of MIME types. Check what's on it, and what this backend sends (gzip_types).gzip_vary,gzip_min_length, andgzip_comp_levelare the supporting cast worth reading about.- Compression applies where the response leaves nginx — proxied responses need no special config.