Cost vs Performance
2 min read
Performance optimizations have costs. Make the tradeoff explicit — "this costs $X to save Y ms" — or you'll over-engineer.
Performance optimizations have costs. Make the tradeoff explicit — "this costs $X to save Y ms" — or you'll over-engineer.
How It Works
Most performance techniques (caching, CDNs, provisioned capacity, read replicas, edge compute) trade infrastructure cost for latency or throughput. The discipline: for each optimization, state both sides of the tradeoff. "Adding Redis saves 50ms per request but costs $800/month at this scale." "Pre-warming a second region saves 5 minutes of failover time but doubles baseline cost." The question is never "is this optimization worth it?" — it's "is it worth it at OUR scale for OUR latency target?" In interviews, name the dollar cost alongside the performance benefit of any caching, replication, or CDN choice. Candidates who only name the benefit look like they're pattern-matching; candidates who name both look like they've operated systems.
Real-World Example
Airbnb's search page once had a 500ms p99 latency problem. The instinct was to add more caching and CDN tiers. The actual fix: they noticed the backend was making 80 sequential Elasticsearch queries per search request — they parallelized the 80 queries and dropped the added caching plan entirely. The team saved about $3M/year in infrastructure that would have gone to caching. The lesson: optimize the algorithm before buying more machines. "Throw caching at it" is the expensive default; understanding the actual bottleneck is the cheap fix.
Test Yourself
Scenario: Your team proposes adding a Redis cache in front of the database to improve read latency. Sketch the cost-benefit for a service with 1M DAU, ~10 reads/user/day, currently at 150ms p99 read latency.
Get notified when we launch
One email when the full practice product is live. No spam.