Capacity and Cost Engineering
Enough capacity to meet the SLA, not a euro more
Capacity engineering rightsizes clusters, budgets concurrency and plans for growth; cost engineering makes the bill predictable — from auto-scaling policy to warehouse sizing to per-query cost visibility.
What you will learn
- Size and auto-tune compute capacity against utilization-SLA targets
- Attribute cost to workloads and set budgets with alert tiers
- Plan growth: project next-quarter capacity from trend, not panic
What is this?
Capacity engineering ensures the platform can meet its load-based SLOs (query waits, throughput) without over-provisioning: right-sized clusters, auto-scaling policies that react to backlog, and reserved vs on-demand mix. Cost engineering makes that spend visible, attributable and capped: workload tags, budgets, burn alerts and layout/compute optimizations. Together they keep 'scaling' a deliberate economic act, not an accident measured in the monthly bill.
Why do you need it?
- Idle 64-node warehouses and 28k tiny files both cost money while delivering nothing.
- Auto-scaling without a budget lets one backfill bill the whole month.
- Capacity under-sizing breaks SLOs (query waits, stream lag) that consumers feel as outages.
- Predictable cost keeps the platform funded: finance trusts it, teams optimize it.
Mental model
An airline sizing fleet vs buying empty planes
Capacity and cost engineering
The airline buys capacity for peak travel days, leases for bursts, and retires planes that fly empty — every seat is a cost. Data capacity is the same: shape compute to the load curve, charge the intense days, cut the idle engines.
How it works
- Utilization-to-SLO mapping: define what utilization% keeps query-wait SLIs green.
- Right-size: start with workload history; resize warehouses near the kneecap of utilization vs cost.
- Auto-scaling policy: scale on backlog/target utilization, cap at a budgeted max, suspend at idle.
- Reserved vs on-demand: continuous base load on reserved capacity; bursts on-demand.
- Attribution: tag warehouses/jobs/tables by workload and team; produce daily cost-by-tag.
- Budget stop: hard caps + burn alerts; oversized runs are blocked or warned before they bill.
Load curve, provisioned capacity and the underspend/breach gap.
In production
- A retail company autoscales its ETL warehouse on queue depth: 200 nodes at monthly-refresh peaks, 4 at 3am — the utilization SLO stays green and the bill reflects the curve.
- A fintech reserves steady-node capacity for its 24/7 streaming consumers and uses on-demand for the ad-hoc BI surge, cutting blended cost 30%.
- A startup tags every job by team; the ML team's backfill shows up as 60% of spend and gets budgeted, alerted and optimized.
Best practices
- Size against the load curve and SLIs, not against the worst month of the year by feel.
- Cap autoscaling and suspend idle — two cheap policies that control the bill's tail.
- Publish per-warehouse/per-tag cost so optimization targets the biggest lines first.
- Set an annual growth model: trend capacity ~ volume; budget next quarter from that, reviewed monthly.
Common mistakes
- Auto-scaling unbounded 'to be safe' — the bill becomes a surprise tax.
- Sizing for peak and paying for idle instead of matching the curve.
- No attribution, so nobody can say why spend doubled — and nobody fixes it.
- Forecasting capacity by gut during growth spurts, then hitting an SLO wall mid-quarter.
Debugging tips
- SLO breach + high utilization → under-provisioned; raise the cap or reserve more — but check it's load, not a bad query.
- Bill spike → cost-by-tag report across hours; overnight backfills and ad-hoc giants are the usual lines.
- Idle spend → list warehouses by utilization; anything <40% idle-cut or auto-suspend.
- Growth surprise → compare capacity forecast vs actual volume monthly; divergence means the model is wrong, fix it early.
Interview checkpoint
Hands-on lab
- Simulate a load curve and autoscaling policy
- Compute the right-size vs utilization-SLO tradeoff
- Set a budget with cap + burn alerts
Model Autoscale, Right-Sizing and Budgets
30 min · advanced
Quick quiz
The best way to control 'idle spend' is:
Autoscaling with no cap or budget is effectively unlimited spend.