24

Golang community provide a HTTP/2 demo website to compare the performance between HTTP 1.1 and HTTP/2.

We can choose different latency, e.g. 0s latency, 30 ms latency, 200ms latency.

  1. Is latency a terminology of computer science?
  2. What does that mean?
  3. What's the difference between latency and Round Trip Time?

enter image description here

1

4 Answers 4

33

Network latency is how long it takes for something sent from a source host to reach a destination host. There are many components to latency, and the latency can actually be different A to B and B to A.

The round trip time is how long it takes for a request sent from a source to a destination, and for the response to get back to the original source. Basically, the latency in each direction, plus the processing time.

11

"Latency" can mean different things. Generally, it's a delay of some sort - application latency is the reaction time of an application (from input to output), network latency the delay for getting a packet from point A to B and so on.

"Round-trip time" is more or less well defined as the network delay from point A to B and back . This is the sum of all encoding, queueing, processing, decoding, and propagation delays in both directions. Essentially, it's the delay when A may be expecting an answer from B for a request that requires very little processing.

Very often, round-trip time is compared to the ping time between A and B. The ping time may provide a good value for the effective RTT but it might also be something else, due to potential routing and processing differences between the ICMP packets used by ping and those for the actually used protocol packets.

In your case "latency" means an artificial delay within the HTTP server that gets added on top of the already present delays. So, if you've got an effective round-trip time of 50 ms to the server and select "200 ms latency" you can expect a reply to a request within 250 ms (plus the processing overhead on the server).

6

Round-trip time (RTT) is the time it takes for a packet to go from the sending endpoint to the receiving endpoint and back. There are many factors that affect RTT, including propagation delay, processing delay, queuing delay, and encoding delay. These factors are generally constant for a given pair of communicating endpoints. In addition, network congestion can add a dynamic component to RTT.

Are RTT and ping the Same?

Round-trip time and ping time are often considered synonymous. While ping time may provide a good RTT estimate, it differs in that most ping tests are executed within the transport protocol using ICMP packets. In contrast, RTT is measured at the application layer and includes the additional processing delay produced by higher level protocols and applications (e.g. HTTPS).

What About RTT and Network Latency?

Network latency is closely related, but different than RTT. Latency is the time it takes for a packet to go from the sending endpoint to the receiving endpoint. Many factors may affect the latency of a service. Latency is not explicitly equal to half of RTT, because delay may be asymmetrical between any two given endpoints. RTT includes processing delay at the echoing endpoint.

Take a look at this blog post on RTT for more info.

4

To add a little bit of background to the other answers, one has to remember that network latency can vary significantly, and can impact a user's experience.

One of the most obvious sources of network latency is distance: the signals that carry your data travel at more or less the speed of light, so the longer the distance travelled from client to server, the higher the latency. Communication between two computers linked by an Ethernet cable will take a few milliseconds. Communication with a server across an ocean will take dozens or hundreds of milliseconds. Communication that goes through a geostationary satellite will take hundreds of milliseconds.

This is clearly visible when doing a ping, which measures the round-trip time, which in this case is very close to the sum of the latency in both directions.

A few other things that have an influence on latency:

  • the number of links/hops: in most cases, a packet needs to be fully received before it can be sent on the next link. That adds a bit of latency on each hop;
  • the throughput of those links: the slower the link, the longer it takes for the full packet to go through, and thus to be forwarded on the next link;
  • the load of those links: if a link is full, the packet may have to be queued until it can be sent;
  • for links with local retransmission, the error rate on the link: the higher the error rate, the higher the chances the packet may need to be resent.

Latency can have a strong effect on the user experience (or not):

  • the best known case is the latency affecting players of MMORPGs and other online games.
  • anything interactive where the interaction is controlled on the other side is affected by latency. Telnet/ssh, remote desktop, are all affected by latency.
  • voice communication is affected by latency, and with high latency you end up with people interrupting each other all the time.
  • older file transfer protocols also suffered from latency as they did not implement sliding windows, and the sender had to wait for the packet to arrive at the destination, and the acknowledgement to come back, before sending the next one.

Even with non-interactive cases, latency can have an effect (which is illustrated in the OP's example): when there are lots of small files to download, latency can result in a higher total load time if the protocol has to wait for one file to be completely downloaded before starting the download of the next one, compared to a protocol which would allow multiple requests to be sent at once, and the responses being sent with no interruption between successive files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.