Start with the decision#
Express cost in workload units - requests, stored bytes, transferred bytes, retained history, and provisioned headroom - then optimize the dominant driver without violating reliability targets.
Mechanism and state flow#
- Estimate steady and peak demand with growth and retention.
- Map each request to compute, storage operations, replication, and network transfer.
- Separate fixed baseline cost from demand-shaped variable cost.
- Measure cost per useful product unit and attribute it to owners.
- Use caching, batching, lifecycle policy, tiering, or autoscaling only where the model predicts material savings.
Concrete example#
Image delivery
Ten million daily image views average 100 KB. Origin egress dominates if every view misses, so the design models cache hit rate, regional transfer, transformation compute, and retained variants rather than merely counting servers.
Architecture consequence: A CDN and bounded rendition set target the dominant bytes while origin headroom and failure behavior remain explicit.
Trade-offs#
| Option | Choose when | Cost or limit |
|---|---|---|
| Precompute | Many reads reuse the same expensive result. | Storage, invalidation, and unused work. |
| Compute on demand | Requests are sparse or highly personalized. | Latency and burst capacity. |
| Managed service | Operational leverage outweighs unit premium. | Provider pricing dimensions and portability. |
Failure diagnosis#
- Failure
- Autoscaling reacts after a burst while minimum capacity is too small.
- Impact
- Latency and errors rise even though the steady-state cost model looks efficient.
- Detection
- Queue age, throttling, cold-start latency, saturation, and cost per completed request.
- Mitigation
- Model provisioning time, buffer or throttle demand, keep justified headroom, and load-test the scaling control loop.
- Trade-off
- Headroom costs money; insufficient headroom spends the error budget.
Design checkpoint#
Work the scenario before revealing the checklist
- Choose the useful unit: request, active user, processed GB, or completed job.
- Estimate peak compute, retained bytes, operations, and egress.
- Identify the largest and fastest-growing driver.
- State which reliability target prevents further cost reduction.
Use these prompts to extend the design. The useful answer is a reasoned change, not a memorized sentence.
- When does a cache increase total cost?
- How does cross-region replication change the model?
- What metric detects expensive work that produces no user value?
Related practice problems
Use the manifest-backed prompts below to apply this lesson in a complete design.
- Manage demand and supply resourcesAWS Well-Architected
- Well-Architected Framework: cost optimizationGoogle Cloud
Sources reviewed 2026-09-04. Validate product limits, legal obligations, and operational assumptions for the system you are designing.