Topic 14.8
Cost Optimization
In one line
The question every senior interviewer actually asks: what does this architecture cost, and what can we remove?
Think of it like this
Turning off lights and unused appliances in rooms nobody's in. Systems cost real money to run every hour, and a lot of savings come from simply not paying for capacity nobody is using.
Key ideas
- 01
Cost accounting per service: compute (instances × time), storage (provisioned vs used), bandwidth (esp. egress), managed services.
- 02
The three questions to run: what does this cost?, what can be removed?, what should be managed vs self-hosted?
- 03
Removal candidates: unused shards, duplicate caches, over-provisioned replicas, dead code paths still running jobs.
- 04
Managed vs self-hosted: managed wins on ops time + reliability; self-host wins at huge scale + tight budgets — the crossover is the analysis.
- 05
Reserved vs on-demand vs spot: baseline reserved, burst on-demand, batch spot — the capacity price ladder.
- 06
Interview: 'gateway fleet cost ~$X/mo; I'd cut it to 2 nodes + autoscale, and move telemetry to sampling to halve the bill'.
- 07
Connect it back: cost is the trade-off axis for 70% of your earlier HLD decisions (CDN vs origin, Redis vs DB).
Explain without notes
Walk the cost of the 'full blueprint' architecture: which three line items are 80% and what removes them?
Practice
Price a 100k-rps read API: LB+gateway, app nodes, Redis, DB, CDN — annual budget, then two cuts.
Trade-offs
- ↔
Cost optimization trades redundancy and headroom — never optimize a discount past the SLO it bought.
Run it in production
You've designed it. Now build, operate, and break the same idea hands-on in the DevOps courses:
Completion checklist
I can produce a rough budget and defend what gets cut.