Latency vs Throughput

In system design, performance is primarily evaluated using two key metrics:

Understanding the relationship between these two is critical for designing systems that meet SLAs (Service Level Agreements) and user expectations.


Latency

Latency is the time taken to process a single request from start to finish.

It includes:


Characteristics


Types of Latency

Network Latency

Processing Latency

Disk I/O Latency

Queueing Latency


Percentile Latency (Very Important in Interviews)

Instead of averages, we use percentiles:

Real systems optimize for P95/P99, not averages.


Throughput

Throughput is the number of requests a system can process per unit time.


Characteristics


What Affects Throughput?


Throughput Formula (Little’s Law - Simplified Insight)

A useful mental model:

Throughput ≈ Concurrency / Latency


The Relationship (Pipeline Analogy)

Think of a system as a pipe:

graph LR
    A[Request Start] -->|Latency (Time)| B[Response End]

    subgraph "Throughput (Parallel Requests)"
        R1[Req 1]
        R2[Req 2]
        R3[Req 3]
        R4[Req 4]
    end