In system design, few concepts are as misunderstood as latency and throughput. While they sound similar, optimizing for one often hurts the other—and getting the balance wrong can lead to systems that are slow for individual users or collapse under heavy load.
What is Latency? Latency is the time it takes for a single request to travel from source to destination and back. Think of it as the delay a user experiences when clicking a button—it's the time to first response.
What is Throughput? Throughput measures how many requests a system can handle in a given time period. It's the overall capacity—like the number of pizzas a shop can produce per hour.
The Trade-off If you optimize for low latency, you might process each request individually and quickly. But that can reduce throughput because you're serializing work. Conversely, batching requests improves throughput (more done per unit time), but each request may wait longer in a queue before being processed.
Queueing Delay: The Hidden Culprit As utilization approaches 100%, latency skyrockets due to queueing. This is the famous “knee of the curve”—beyond about 70% utilization, small increases in load cause exponential increases in latency. That's why senior engineers intentionally leave headroom.
Real-World Examples
- Databases: A query that returns one row quickly has low latency, but batching many inserts improves throughput.
- Kafka: Producers can send messages one at a time (low latency) or batch them (higher throughput).
- Pizza Shop: One oven baking a single pizza is fast. But to serve a crowd, you need multiple ovens—or you batch pizzas, which makes each customer wait longer.
Why This Matters Understanding the latency-throughput trade-off is critical for designing scalable systems. Over-optimizing for throughput can ruin user experience; over-optimizing for latency can starve capacity. The best systems know when to prioritize each.
This concept appears everywhere—from load balancers and caching layers to microservices and machine learning pipelines. Mastering it is essential for any backend engineer or system design interview candidate.