What is the difference between latency and response time?

15,140

Solution 1

One way of looking at this is to say that transport latency + processing time = response time.

Transport latency is the time it takes for a request/response to be transmitted to/from the processing component. Then you need to add the time it takes to process the request.

As an example, say that 5 people try to print a single sheet of paper at the same time, and the printer takes 10 seconds to process (print) each sheet.

The person whose print request is processed first sees a latency of 0 seconds and a processing time of 10 seconds - so a response time of 10 seconds.

Whereas the person whose print request is processed last sees a latency of 40 seconds (the 4 people before him) and a processing time of 10 seconds - so a response time of 50 seconds.

Solution 2

As Martin Kleppman says in his book Designing Data Intensive Applications:

Latency is the duration that a request is waiting to be handled - during which it is latent, awaiting service. Used for diagnostic purposes ex: Latency spikes

Response time is the time between a client sending a request and receiving a response. It is the sum of round trip latency and service time. It is used to describe the performance of application.

Solution 3

This article is a good read on the difference, and is best summarized with this simple equation,

Latency + Processing Time = Response Time

where

  • Latency = the time the message is in transit between two points (e.g. on the network, passing through gateways, etc.)
  • Processing time = the time it takes for the message to be processed (e.g. translation between formats, enriched, or whatever)
  • Response time = the sum of these.

If processing time is reasonably short, which in well designed systems is the case, then for practical purposes response time and latency could be the same in terms of perceived passage of time. That said, to be precise, use the defined terms and don't confuse or conflate the two.

Solution 4

I differentiate this using below example,

A package has been sent from A-B-C where A-B took 10 sec, B (processing) took 5 sec, B-C took 10 sec

Latency = (10 + 10) sec = 20 sec

Response time = (10 + 5 + 10) sec = 25 sec

Solution 5

Latency The time from the source sending a packet to the destination receiving it

Latency is the time it takes for a message, or a packet, to travel from its point of origin to the point of destination. That is a simple and useful definition, but it often hides a lot of useful information — every system contains multiple sources, or components, contributing to the overall time it takes for a message to be delivered, and it is important to understand what these components are and what dictates their performance.

Let’s take a closer look at some common contributing components for a typical router on the Internet, which is responsible for relaying a message between the client and the server:

Propagation delay

Amount of time required for a message to travel from the sender to receiver, which is a function of distance over speed with which the signal propagates.

Transmission delay

Amount of time required to push all the packet’s bits into the link, which is a function of the packet’s length and data rate of the link.

Processing delay

Amount of time required to process the packet header, check for bit-level errors, and determine the packet’s destination.

Queuing delay

Amount of time the packet is waiting in the queue until it can be processed.

The total latency between the client and the server is the sum of all the delays just listed Response Time Total time taken between the packet to send and receive the packet from the receiver

Share:
15,140
gstackoverflow
Author by

gstackoverflow

Updated on June 14, 2022

Comments

  • gstackoverflow
    gstackoverflow about 2 years

    I started to read famous Martin Fowler book (Patterns of Enterprise Application Architecture)

    I have to mention that I am reading the book translated into my native language so it might be a reason of my misunderstanding.

    I found their definitions (back translation into English):

    Response time - amount of time to process some external request
    Latency - minimal amount of time before getting any response.

    For me it is the same. Could you please highlight the difference?