Latency is the time delay between a request and the response. It tells you how long it takes for data to travel through the system.

Key Points:

  • Measured in: milliseconds (ms)
  • Lower latency = faster response
  • Common in networking, databases, APIs, etc.

Types of Latency:

TypeMeaning
Network LatencyTime taken for data to travel over the network (client ↔ server)
Disk LatencyTime to read/write data from/to disk
Application LatencyTime taken by server logic to process a request
End-to-End LatencyTotal time from user action → system response

Example:

You click “Buy” on an e-commerce site → 500 ms later, the confirmation appears → Latency = 500 ms

How to Reduce Latency:

  • Use CDN (for static assets)
  • Optimize DB queries
  • Add Caching layers
  • Use faster network protocols
  • Deploy closer to users (edge computing)