Performance Budgets
Per-page budgets.
Overview
Performance budgets allocate explicit, enforceable limits on size, latency, and resource use per page or per API. Without them, performance degrades one PR at a time and nobody notices until users complain. With them, regressions get caught at the build that introduced them. The discipline is automation, not aspiration; budgets that live only in a wiki page do not constrain anything.
- Per-page budgets. JS bundle size, image weight, LCP, INP. The user-experience metrics that matter for the medium.
- Per-API budgets. p99 latency targets, payload size, CPU time. The service-tier metrics that matter for downstream consumers.
- CI gates. Build fails when budget is exceeded. Enforcement is automated; nobody has to remember to check.
- Tier-based budgets plus trend tracking. Different tiers carry different budgets; trends over time reveal degradation before it becomes user-visible.
The approach
Three habits make performance budgets work in practice: set them deliberately based on user-experience data, automate enforcement in CI, and track trends so budgets evolve with the product instead of becoming paper.
- Per-page budgets set deliberately. JS bundle weight, image weight, LCP, INP. Numbers tied to user-experience research, not vibes.
- CI integration that blocks merge. Build fails when budget exceeds. The only enforcement that survives a busy week.
- Real-user-monitoring confirms. Production data confirms or refutes synthetic measurements. RUM is the source of truth.
- Quarterly review plus documented policy. Budgets evolve based on data; per-tier the budget and rationale lives in the runbook.
Why this compounds
Each enforced budget locks in current performance and prevents quiet erosion. Engineers start asking about performance impact at PR review time; the engineering culture shifts from “ship and measure” to “measure before merge”.
- User experience stays sharp. Budgeted pages stay fast across hundreds of PRs. Death-by-a-thousand-cuts is the failure mode budgets prevent.
- Cost efficiency. Smaller pages and APIs cost less to serve. CDN bills shrink alongside latency.
- Performance enters the PR review. Engineers cite budget impact in PR descriptions. Performance becomes a first-class concern.
- Year-one investment, year-two habit. First budget is heavy lift. By year two, every new page ships with a budget on day one.