GUIDE

What is low latency, and how to improve it | Networking

While it might seem instant to the human eye, it takes time for data to pass from one place to another. This delay—between when a data packet is sent and when it is published—is known as latency, also known as lag or ping. So, to answer the question of “do you want high or low latency?” Lower latency is always ideal, and it is critical for a good web user experience.

What is low latency (ping)?

Low latency is one of the most important features of any website, program or application on a network. Customers are used to real-time results, and they expect feedback instantly when they perform an action. Time delays are one of the top reasons customers will quit using an application, and issues with high latency can cause them to disengage and switch to other services.

How do you measure latency?

Latency is measured in milliseconds, and the closer to zero it can reach, the better. Ideally, there would be NO latency. This is not technically possible in a real-world application, but it is still necessary to reduce latency as much as possible for the best user experience.

In the world of real-time technology and quick results, achieving the lowest latency possible determines which apps will be successful and continue to grow in the long run.

In the following guide, we will discuss latency and other measurements of network performance, how to reduce latency, and the benefits to your application when latency is optimized. 

Why is low latency important?

What causes latency? Data on the internet travels at the speed of light. However, due to external circumstances like physical distance, internet connection, and infrastructure, there will always be a delay in the amount of time it takes to travel. This delay is known as latency. 

Causes of network latency

Network latency specifically refers to any delay of data transmission over the internet on a network. Propagation delay is the amount of time it takes for a client to send a message to a server, also known as a ping. Round-trip time measures the amount of time it takes for the entire process—from the client sending a request to when the client receives the response from the server. Latency refers to the round-trip time.

Internet traffic management uses algorithms to decrease latency, where they measure the amount of data traveling through a network, then route accordingly and allocate sufficient bandwidth to prevent delays, like traffic bottlenecks.  

Examples of latency, bandwidth, and throughput

When discussing how to improve latency, it is common to also consider the bandwidth and throughput of a network connection. These measurements of network performance go hand-in-hand in providing a good user experience on the web.

What is bandwidth? 

Bandwidth is the maximum capacity of a network connection. Higher bandwidth, or more capacity, equates to lower latency.

What is throughput?

Throughput measures how much data a system can process at any given time. While latency measures the amount of time, throughput measures the amount of data that can be sent.

The relationship of low latency, bandwidth, and throughput

Bandwidth, throughput, and latency have a cause-and-effect relationship, where the capacity of one affects the other. For example, lower bandwidth will increase the latency by not letting as much data travel as quickly across a network.  

What causes high latency?

Distance can increase latency

The main cause of latency is distance. When a server is located across the world from a client’s device, it increases the amount of milliseconds that it takes for the data packets to travel across the network. While an increase of 30-40ms may seem invisible to our naked eye, the delays are compounded because the data will usually have to travel through multiple network connection points. This is why satellite internet is slower than cable internet, because the signal has to travel wirelessly all the way to orbit and back.

Network congestion can cause high latency

Congestion occurs when a network takes on more traffic than it can support. Usually this is when too many clients have joined a network that doesn’t have enough bandwidth to support them. This can cause delays or loss of data in messages traveling across the network.

Physical barriers are also barriers to low latency

A user’s internet connection can affect the latency of your application on their system. Connection type, internet service provider, and the amount of speed and bandwidth they have purchased all play a role in any latency they experience. Or for example, Ethernet is usually faster than Wi-fi, or an old router may not have sufficient bandwidth to support streaming.

How to lower latency?

Users are the first step to reducing latency

Users can take the first steps to reducing latency by preparing themselves with the best possible physical internet connection. Fiber optic cables are the most ideal form of internet connection, while other options like general cable or satellite internet will generally have higher latency. Choosing a service provider with higher internet speed and bandwidth, at least 100 mbps, will allow for faster streaming or more devices to use the network. Users can also make their routers have sufficient bandwidth when placed in a good location to provide clear Wi-Fi signals.

Businesses can create low latency

As a business, the simplest solution to reducing latency for your users is to invest in networking solutions like clouds or data stream networks. They work by connecting the user to the closest source of information, decreasing the distance that data packets have to travel. 

Content delivery networks (CDNs) are an industry of geographically distributed servers and data centers that increase speed by providing users with more (and closer) locations of stored data at any given time. CDNs work alongside internet service providers and are commonly used for services like video streaming, loading webpages, and downloading software. The amount of data centers and their spatially distributed locations help to decrease load times and high bandwidth across networks, greatly improving quality of service on the Internet.

Real-time networks build off of CDNs and establish persistent connections between clients and servers, which allow messages to flow freely and almost instantaneously. For example, PubNub’s real-time data stream network uses multiple forms of TCP connections, like WebSockets, MQTT, and HTTP long polling APIs, to provide persistent connections and quick data transmission. This optimizes the network for extremely high speeds and low latency.

Developers can optimize for latency

Web developers can also optimize and code minify to reduce loading times on a site. Code minification reduces the size of CSS and JavaScript files. It also helps to minimize the number of render-blocking resources (for example, load JS last), set the most important assets to load first, and optimize images and file sizes. 

 

Low latency benefits and real-time use cases

Low latency is more important in some industries than others, but it improves user experience and satisfaction across the board. Customers often become frustrated if they expect technology to be instant but then experience delays. Think of how you may feel when you want to watch Netflix but the video won’t load and continues to buffer. No one enjoys a delay like that in any environment.

In some industries, low latency is not only a convenience but absolutely mandatory. In the gaming industry, lags can cause a player to lose. In cryptocurrency and finance tracking, users rely on instant updates to make decisions. And in emergency management, a delay in receiving data could cost someone their life.

Poor latency is one of the main reasons that users will abandon a service. To put it bluntly, high latency can lead to untold numbers of lost profits and a shrinking user base. Eliminating latency is one of the most important factors in the success of your application.

Why low latency is essential in real-time applications

Latency is the delay from when a client sends a request to a server until when it receives a response. Low latency is imperative because customers expect to interact with technology in real-time with no delays. Issues with high latency and time delays can cause users to quit engaging on a platform and move to another application permanently. 

Latency can be affected by many physical barriers like internet service, internet speed, or specific IP networks. Companies and IT professionals have continuously innovated and introduced ways to improve network speeds and the general user experience. This has usually come in the form of distributing data, increasing the amount of data storage available across the globe, and improving network connections.  

PubNub provides a real-time data stream network that allows developers to build real-time applications with almost no latency and unlimited concurrent users. With five global data centers, latency of less than 100 milliseconds worldwide, and 99.999% uptime service level agreements, you can be confident that your application will reliably run in real time and scale to fit your needs. If you are interested in building your real-time application with PubNub, contact sales today.

Resources