Network Optimizations
Website speed is a crucial factor in its perceived quality! Let's study how to maximize speed in this lesson by optimizing our network settings.
Reduce time to first byte
In addition to the amount of time it takes for your page to fully load, you’ll also want to take a look at the amount of time it takes to start loading.
Time to first byte, or TTFB, is the amount of time a browser has to wait before getting its first byte of data from the server. Google recommends a TTFB of less than 200 ms.
Here’s a snapshot of the ‘timings’ tab that gets shown when a response file on the network tab of devtools is clicked. It shows a website that has an excessive TTFB.
In general, most issues with slow TTFB are caused by network issues, dynamic content creation, DNS lookup time, or traffic. We have control over two of these factors: dynamic content creation and DNS lookup time.
Speed up DNS resolution
The IP address is resolved from a DNS server. The DNS server is usually with your ISP. You can check what yours is with the following command on Linux based systems:
cat /etc/resolv.conf
At the end of the output, it should say something like nameserver 127.0.0.53
. The IP address is that of the nameserver you’re using.
The amount of time DNS resolution takes depends on how fast your DNS provider is. If your DNS server is slow, it may be time to switch to a faster DNS provider.
Take a look at these DNS server speeds ...