Software → System Design
Latency
The time delay between a request or event and the corresponding response or observable effect.
Where it fits
Latency is the time between starting an operation and receiving its result. It affects APIs, databases, networks, user experience, and system design.
Mental model
Latency is waiting time. Users feel it directly, and distributed systems amplify it through network calls, queues, locks, and slow dependencies.
Example
An API request may spend time in DNS, TCP/TLS setup, load balancing, application logic, database queries, and response transfer.
Common mistakes
- Optimizing averages while ignoring tail latency.
- Measuring only server time instead of end-to-end time.
- Adding remote calls without considering cumulative latency.
Related concepts
Network, cache, CDN, performance, observability.