- The National Council on Public Polls (NCPP) is saddened to learn of the death of longtime pollster and colleague, Harry O’Neill. O’Neill died at his home in New Jersey on 09/11/
Network and DNS latency play a huge part in determining just how fast your website or application loads. The further the content has to travel, the greater the latency. So first off, what exactly do we mean when we talk about network latency? Network latency , or website latency, can be defined by the time is takes measured in milliseconds for a request to travel from the sender to the receiver and for the receiver to process that request.
In other words, the round trip time from the browser to the server. This is greatly affected by how far away the user is from the server and quality of the network. Other things that contribute to latency include transmission mediums, propagation, routers and storage delays. In one study, median desktop latency ranged from milliseconds. Ars Technica wrote a great article about the inside story of how the internet works on a global scale. You can see an example of this global network below.
So as you can imagine, when data is traveling this far, there will be delays. Even fiber optics are limited by more than just the speed of light, as the cable and the repeaters or amplifiers also introduce additional delays. Ilya Grigorik, a web performance engineer at Google described it this way:. What is remarkable is that we are already within a small constant factor of the theoretical limit.
You can measure latency in a few different ways. Three of the most common methods are ping, traceroute, and MTR.
Ping is a utility used to send out ICMP packets to an address to see how fast the response is and if one even exists. Ping corresponds with the delay time in milliseconds for how long it takes the data to travel across the internet , to its destination, and then back to you.
A faster ping means a more responsive connection. You can use command prompt or terminal to test ping times against a website. KeyCDN also has a ping test tool you can use which allows you to ping simultaneously from 14 locations.
Traceroute, also called tracert, is another utility you can use to test latency. Similarly to ping, it also uses ICMP packets to record the route through the internet from one computer to another.
The difference with traceroute is that it calculates the time taken for each hop as the packet is routed to the destination. You can once again use command prompt or terminal to run a traceroute.
KeyCDN also has a traceroute tool in which you can test the connectivity or routing issues from 14 test locations in parallel. MTR is essentially a combination of both traceroute and ping which allows a user to generate a report that will list each hop in a network that was required for a packet to travel from point A to point B. Read our more in-depth post on MTR and Traceroute.
You can never get rid of latency, but the great news is that there are latency optimization techniques which you can apply to negate some of the delays that occur. These include both network latency and DNS latency. The reason we chose a CDN as the first way to decrease your latency is because it will be the one technique that will have the greatest affect. Especially if you have visitors from around the globe.
And depending upon the platform you use, could be one of the easiest to implement. We did a case study a while back where we specifically tested the latency ping times on a site with a CDN running and then without. And here are the results between the two.
As you can see the results are pretty astounding! This is because the content is now serving from cache on edge servers located much closer to the visitor. This is one way you can get around the laws of physics when it comes to beating the distance.
Simply move the content closer to them! It is very important to always keep external HTTP requests to a minimum. Each of these requests has its own latency involved and this can add up very fast.
A lot of these services have their own CDNs, but it is important to ensure that whenever you link to third party resources that they are on a fast infrastructure. Make sure to check out our in-depth posts on HTTP cache headers and cache-control.
DNS prefetching allows the browser to perform DNS lookups on a page in the background while the user is browsing. This minimizes latency as the DNS lookup has already taken place once the user clicks on a link. By speculatively prefetching DNS results, latency can be reduced significantly at certain times, such as when the user clicks the link.
In some cases, latency can be reduced by a second.
Preconnect allows the browser to setup early connections before an HTTP request is actually sent to the server. This in turn, eliminates roundtrip latency and saves time for users.
As you can see there are lots of different latency optimization techniques you can use to ensure your websites load fast no matter where they are located. With the modern hardware, protocols, and directives everyone has access to today, latency no longer has to be a website speed killer! Are there any other good latency optimizations that we might have missed?
If so, feel free to share them below in the comments. Today we are going to explore current resource hints and directives which can be another great way…. Website performance optimization is always something that should be top priority, especially when….
Published on October 20, Tags webperf. Get started.