PubNub provides global latency of 100 milliseconds or less worldwide, with a goal of delivering an average edge to edge time for messages under 15 milliseconds. For PubNub, low latency is critical for our platform and our clients' superior experience. To understand latency better, let's explore what latency is and why latency matters. This how-to will help troubleshoot latency issues and slow load times in apps and web pages.

Latency is Delay

Latency is the amount of time between initiating an action (publishing a message) and the effect of that action (receiving a message). Latency is usually measured in milliseconds (ms). You may see latency referred to as the ping rate in an Internet speed test. Network latency is different from network speed (measured in Mbps). In a network connection, latency is introduced in the processing and transmission of data. Latency is significant to consider in any real-time app or game.

What is the definition of network latency?

Network latency refers to any time delay in data transmission in a network. PubNub is optimized to reduce latency introduced in the processing and replication of messages sent on the PubNub Data Stream Network. This optimization gives PubNub's clients a low latency edge when they rely on our network for global real-time transmission of their messages. PubNub's core Data Stream Network is extremely fast. Routing a message through the PubNub network takes as little as 4-9 milliseconds, often resulting in an end-to-end transmission of 30-40ms for clients on a broadband connection. Most of any latency experienced will be from the client transmission of messages to and from a PubNub PoP (point-of-presence, A.K.A a data center). Three factors will affect your messages between your clients and our PoPs: connection type, distance, and congestion.

Connection Type

How your clients are connected to the Internet will affect your latency to our PoPs. Satellite internet is usually the worst type of Internet connection to use with latency-sensitive applications. Data has to be sent wirelessly to an orbiting geostationary satellite 22,300 miles above Earth's equator and then back again, sometimes multiple times, before reaching one of our PoPs. While happening at the speed of light, the transmission still takes a lot of time because of the distance and atmospheric noise. Latency/ping on a satellite connection can be 500ms or more - a recipe for application performance issues. Latency issues in real-time apps can be noticeable in only a few hundred milliseconds. The best type of connection for latency-sensitive applications is fiber optic, which can have a latency as low as 1-2ms. Most home cable connections advertise a latency of 10-100ms.

The final transmission medium or connection type, such as wi-fi or wired connection (using an ethernet cable), can also cause latency issues. Wi-fi and other wireless connection methods experience increased packet loss resulting in more latency than a wired or fiber internet connection.

Distance

Latency will increase the further your clients are from a PubNub PoP. We offer 15 PoPs strategically deployed across Western and Eastern Europe, North and South America, and Asia to eliminate as much distance between your clients and PubNub as possible.

Congestion

Congestion is when a network carries more data than it can handle. If a network throughput is overloaded, it doesn't matter how fast the data travels because it will either be delayed or lost entirely when it reaches the congestion. Webpages and end-user experience will suffer. You'll see network congestion when too many end users share a network that doesn't have enough capacity, like a highway with too many cars; there is a bottleneck.

Why Does Latency Matter and Why Should You Care About Latency?

Reduced high latency usually translates to a more efficient application and a better user experience. Even in applications that don't need to be real-time, users will become frustrated if something isn't fast enough to be considered instant. In the gaming industry, latency isn't just annoying; it drastically impacts user experience and the perceived quality of a game. In the on-demand economy, most of the user experience relies on quick updates and confirmations. Simply put, users will abandon your application if they have to wait for it.** Eliminating latency in your application can be worth millions of dollars in gained or lost profits.**

Need more help with building real-time apps with PubNub? Get in touch with our sales team and discuss all the possibilities.