Introduction to network latency: why it matters and how to measure it

1. What is delay?

Latency is actually the time difference between when we click on the request and when the server returns the result to us when we browse the web or use an application. Just like when you are on the phone with a friend, after you finish speaking, the time difference between the friend hearing and responding to what you said is the same.

Our ultimate goal is to create a system that makes this time difference as short as possible, which means zero latency. But in the real world, there are various problems that can cause delays in the system. If the system's latency is low, then the time it takes for our requests to be responded to will be very short. Every time you enter a URL in the browser or click a link, the browser will send a request signal to the server, and then the server needs to process the request, obtain the required information, and finally return the information to your browser. There will be some time difference in the whole process, which is the delay. Therefore, we must continue to work hard to reduce latency and improve system response speed.
Insert image description here

2. What’s the reason for the delay?

Latency is actually the time you have to wait after requesting it, like waiting for a courier to be delivered to your door. Let's look at an example to make it easier to understand how it works.

Imagine you are interacting with an e-commerce website (such as Taobao). You like an item and add it to your shopping cart. Now, when you click the "Add to Cart" button, the following things will happen:

  1. When you click the "Add to Cart" button, it's like you started a timer and the browser starts making requests to the server.
  2. The server receives the request and starts processing it, just like your express order arriving at the delivery center.
  3. After the server completes processing, it responds to your request, the information reaches your browser, and the product is successfully added to the shopping cart, just like your bag

Guess you like

Origin blog.csdn.net/stone1290/article/details/132783822