Latency and What You Can Do About It

Avi Meir
Cloud NativeEdge Computing
22 Apr 2023

What does sending hand-written letters through snail mail and exchanging WhatsApp instant messages have in common?

In both cases, the speed of a response heavily influences the “user experience”: If the letter or text is delivered speedily, you’re happy. But if it’s not, you become frustrated.

Whether you’re waiting for a reply in the mail or a response from a server, the request-to-response time should be as quick as possible. In computing terms, this time duration is called “latency”. It’s a critical element in the user experience quality of an application or a network. Slow, “high-latency” websites can cause users to lose patience.

Now that you have a rough idea of what is meant by latency, let’s dive into the details.

 

What Is Network Latency?

 

Network Latency Definition #1: One-way Latency

For simple, one-way data transmission, latency is the time it takes to receive a data packet after you have sent it.

Examples of One-way Latency:

  • Send an email. It will be converted into packets, routed from the server, sent across the network, and passed through several devices before reaching the destination. The duration of this journey is what we call latency.
  • ping request that gives 200 ping status (HTTP OK success)! (It implies that your request was successful in reaching the destination.)

 

Network Latency Definition #2: Two-way Latency

For user requests that include both a request and response, latency is the time it takes to send the user request to a server and receive the response.

Examples of Two-way Latency

There are a number of ways that we can use to measure two-way latency:

  • The time it takes to open a page in your browser after clicking a search result in a search engine.
  • The lag between giving a command in your favorite online game and it executing.

There are two components that we add together to calculate two-way latency — Client Latency and Server Latency.

  1. Client latency means the delay in communication is due to the end-user. This could be caused by a slow connection, an old device, a complex query/request, etc.
  2. Server latency, meaning the delay in communication is caused by the server.

In both cases, latency is measured in milliseconds.
Nobody likes to wait. It’s important to know what affects latency in order to reduce its impact on your application.

 

How Does Latency Work?

Now that we know what latency is and have explained its two types, let’s discuss how it works and how it impacts an end-user.

Consider a simple use case in which you want to log in to a website. You enter the username and password. And then, you click “Login” to enter the site’s dashboard.

What happens next is:

  1. The browser responds to the click and sends your username and password to the server.
  2. The server acknowledges the request after receiving data packets. [Here, the one-way trip completes. So, if it were one-way latency or data latency, we would calculate latency right here.]
  3. The server compares the input credentials to the data in the database and accepts or rejects your login request depending on correctness.
  4. The browser receives the server’s response.
  5. Based on the response, your browser will either take you to the site’s dashboard or give an error/warning, completing the round-trip for latency cycle.

Any lag or delay in this request/response process creates latency for the user.

 

What Are the Causes of Network Latency?

Latency occurs due to four main factors in the request/reply cycle:

Propagation

Distance between nodes is a huge factor in latency. Requests and responses must travel the physical distance between the requesting device and the server. (Low-latency edge computing achieves faster response times than regular cloud or on-premises servers because this technology locates distributed servers in proximity with users.)

 

Transmission Medium

Depending upon the data transmission medium, your network’s latency will be high or low. For example, copper cables transmit data slower than fiber optics. Therefore, latency in networks using fiber optics will be lower than those using copper cables.

 

Routers

Different routers have different capabilities, and the data or request transmission speed will also vary. To lower the latency effect on the data processing, you should use more powerful routers in the network.

 

Storage delays

Uploading and downloading data takes more time than a simple, quick ping. Latency increases with operations related to storing, searching, and fetching data. Heavy or unoptimized web pages will also cause high latency.

 

What Is a Good Latency?

nomral network vs network with high latency diagram

Source

What is a good ping speed or latency? The answer differs for applications depending on their utility.

100 ms is a good ping speed for VoIP, broadband, and streaming services, but applications such as gaming require extremely low latency, in the vicinity of 20-30ms. For applications that are not time-critical, a good ping speed can be up to 150ms.

It also differs from technology to technology. For 4G networks, 30ms to 100ms is a good latency. But on the other hand, acceptable latency for 5G networks is between 5s and 20s.

Think of a database of profiles and a real-time HD game. Which one do you think should have lower latency in a network latency test?

The gaming app, obviously! Keep reading for more on latency in gaming.

 

How to Calculate or Check Network Latency

You can calculate latency using two metrics: Round Trip Time (RTT) or Time to First Byte (TTFB). RTT is the sum of client request time and server response time, while TTFB indicates the difference in HTTP request timestamp and the timestamp when the server sent the first byte in response.

 

Three simple ways to check your network latency:

  1. Use the ping command.
ping lateny
  1. Use the Tracert command.
tracert latency
  1. Use a network monitoring or latency calculation tool like this popular performance test tool to find latency.
latency tool

Best Practices for Monitoring and Improving Networks

Latency can affect your business. Users expect websites and applications to respond quickly. If your site is slow, your customers will stop using it.

Here are the best practices for maintaining low latency networks.

Monitoring or Testing

Use the commands and tools listed above to monitor latency in your network.

Alternatively, you may also configure networking monitoring tools like Datadog, Zabbix, and SolarWinds or hire network professionals to constantly keep track of latency issues and resolve them in time.

 

Does Location Affect Latency?

Definitely. The greater the distance the data needs to travel, the longer it takes. And some regions have a better internet connection than others. The good news is that today there are solutions to counter these kinds of problems.

To learn more, see this article on location in cloud computing.

Cloud Gaming and Latency

Think of an online gaming application that you own. If it takes a full second for your game to respond to players’ requests or commands, how many users would play it?

No one will, even if your game is unique and exciting.

Games are time-critical applications — every millisecond counts. Players will be present in countries all over the world, so serving them from just a few locations is not a feasible or scalable solution. Gamers won’t enjoy a laggy game experience. Fully-managed cloud-native services allow you to set up city-level deployments and be omnipresent globally. Read more about that in this article on what is cloud gaming.

 

Network Latency, Bandwidth, and Throughput

We have already answered, “what is latency in networking?” However, to improve your knowledge of network latency, here is a quick overview of three interrelated terms:

  • Latency is the lag or delay in receiving requested information or acknowledgment from the server after a user action or request.
  • Bandwidth is the width of the path on which the data packets travel in your network. Bandwidth and latency are co-related because the data transfer path width will affect the communication speed and delay.
  • Throughput: The amount of data transferred in a given period.

 

Ridge’s Distributed Cloud Improves Latency

For businesses, reducing latency is the way to improve the user experience. By reducing the latency or delay, you can improve the site experience for the users. But how?

Ridge accomplishes this with a massive network of data centers running in local cloud environments distributed all over the world. Through this network it provides a full cloud experience across all dedicated and shared environments, basically on any infrastructure in any location. It thus supports the delivery of cloud-native services in proximity to end-users. Among other benefits, this reduces application latency and resolves throughput limitations.

Book a demo with Ridge and see what Ridge’s edge cloud solution and distributed PoPs can do to slash your latency and impress your users.

 

Frequently Asked Questions

 

Is high latency positive or negative?

A network with high latency means slow response times and creates a negative user experience. For example, 200 ping (in milliseconds) is high latency and bad for time-critical applications. 20-30ms (or up to 50ms) is low latency, so it is considered good. The average latency range for most sites is between 50 and 150 ms.

Are ping and latency the same?

One-way latency means the delay in data transmission and its receipt on the destination. Ping is the signal (a tiny data packet) sent to another computer, generally to check the reachability of the destination computer. One-way latency and ping are the same.

However, two-way latency requires sending a request to the server and receiving a response. This is different from ping.

How do you get a zero ping?

Zero Ping (0 Ping) implies that the recipient computer/server receives the sender’s request the millisecond it is sent. However, zero ping is not physically possible due to the distance between devices, network traffic, and other reasons. So instead, you can use edge computing to achieve hyper-low latency, meaning very fast response times, in cloud computing.

Does distance affect latency?

Yes. The farther the distance between the requesting device and the server, the higher the latency will be. For example, a server 20 miles away from you will respond faster than a server  2,400 miles away.

Devices in the path, physical factors, faulty network components, traffic (congestion), and signal strength are a few factors that cause this delay.


Author:
Avi Meir, |