Latency : The Silent Speed Killer

No talk about your Site's speed can realistically happen without talking about latency. We all are glad to live in an era of always improving bandwidths (3G, 4G, 5G and so on). But latency can make your site crawl even on these networks. To understand why, let us first try to understand latency minus any technology jargon. While talking about Pizzas!

Pizza Delivery : An analogy for latency and bandwidth

Let's say you order a Pizza for delivery from a nearby restaurant. In this analogy, latency is the distance between the restaurant and you. It determines how long the delivery boy will take to deliver you the Pizza. And bandwidth is the number of Pizzas the delivery boy can deliver to you in a single trip. Now, hold on to this analogy for a second as we derive two important traits:

  • Increasing the Pizza delivery van capacity will not reduce the time to deliver you your single Pizza. Because this time is affected by distance and not capacity.

  • Increasing the capacity shall only benefit the orders where number of ordered pizzas exceeds the van capacity.

Above traits tell us that the improving bandwidth of networks around the world will not fix the Site slowness issues that exist due to high latency. Latency is born out of distance between your Website Server and your Visitor's device. And the time your content requires to travel a given distance cannot be reduced. It is governed by the laws of physics.

In a Pizza world, Latency is the distance between the Pizza restaurant and you. And Bandwidth is the humber of Pizzas the delivery van can deliver to you in a single trip.

Latency has second important trait that makes it the Silent Speed killer: Increasing latency has a multiplying effect on the over-all increase in time.

Let's return to our Pizza world to understand what that means. But with a few additional conditions added to our analogy. Let's assume our Pizza restaurant doesn't offer delivery service. And let's assume the Pizza is for your wife who's feeling too lazy to venture out herself. This means you'll have to make two round-trips to the restaurant to get the Pizza. First trip to get the menu to decide what to order and second to actually get the Pizza.

  • So, if your original in-transit time was 5 minutes, your total in-transit time with two round trips will be 20 minutes.

  • Now, if you had to do the same two round-trips ordeal from a different restaurant that is 20 minutes away. Your total in-transit time would be 80 minutes. Notice the multiplying effect of distance on total in-transit time. A restaurant that is 15 minutes farther increases your total in-transit time by 60 minutes.

When you access a web-page on the Internet, it is very similar to first getting the menu (HTML file) delivered and then getting the Pizzas (the image, CSS, JS, font and other files) delivered. Some of these second-trip files request further files causing a third-trip. And so on. When your web-pages require a lot of round-trips to load, even a small increase in latency balloons into noticable increase in total time.

When your web-pages require a lot of round-trips, even a small increase in latency balloons into noticable increase in total time.

As a result, when you try to understand how fast your website appears to your visitors, it is important to answer:

  • What is the latency between your website and it's visitors?
  • Do your webpages require a lot of round trips causing the effect of latency to multiply?

Answering the above questions will help you determine if latency is killing your Site speed. And if it is, you can evaluate one or more of the below choices to improve your Site speed:

  • Move your static content closer to your visitors by leveraging CDNs.
  • Move your server closer to majority of your visitors.
  • Reduce the number of round-trips required to access any web page as much as possible.

Given very little cost and effort involved in using a CDN, you should definitely leverage it. But the other two options may require a lot of planning and effort. As a result, you should measure and analyze the impact of latency for your site to make a data-driven choice.

Latency is critical to website speed