How to reduce Time to First Byte (TTFB)?
For anyone, a fast website makes a noticeable difference. Even search engines like Google and Bing appreciate faster websites compared to the slower ones. But when it comes to rankings, yes a fast website makes a small difference.
Note that engaging content is still a ranking factor, just fast site speed will never going to help you rank unless the keyword is very very easy to rank.
In technical terms, Time to First Byte, in short TTFB is a measurement used as an indication of the responsiveness of the web servers and network resources.
TTFB is a duration from the user making an HTTP request to the first byte of a page being received by the user’s browser. Short time means a fast loading website while more time will result in multiplying slowing effects.
Look at the image, I have loaded my subscribe page while using the DevTools.
In the image, we can see the subscribe document started receiving its content in 47 ms, while most of the visible content (images, styles, scripts, etc.) loaded in 132 ms. Some deferred and non-visible resources loaded just after some milliseconds – 337 ms. This shows how fast is a website.
Note that each and every millisecond matter here, because initial load time will decide how fast the rest of the content will load.
Can we reduce the TTFB?
Yes, there are few ways we can make it super fast, but that will come with the cost of using some extra tech. But the best thing is a few of them can be achieved for free while some of them are affordable these days.
- Use the fastest domain name system service. Cloudflare is the fastest one.
- Switch to a faster host. Avoid shared and cheaper servers.
- Make use of fast and latest web server applications. PHP7 and Nginx.
- Make use of caching wherever needed. FastCGI is the most reliable one.
- Take advantage of CDN efficiently for global delivery.
1. Use the fastest DNS service.
The domain name system resolver resolved the domain name and IP address. Every server has at least one IP address like 192.168.0.1 which is not fancy at all and only useful to machines. So we use the domain names which are easy to remember and to resolve it we need a domain name system service.
Many domain registrars offer a domain management dashboard. It helps to manage the domains to propagate, resolves, and handle all the modifications in the records. But they could be slow and frequent changes will take you to a long route because they are slow and not utilizing modern routing techniques.
There are many Free and Paid DNS services like Amazon Route 53, GoDaddy Premium DNS, Google Cloud DNS, and Cloudflare.
We suggest Cloudflare DNS over any slow one because it is free and the fastest one in the industry. Look at the worldwide availability of their presence, they are almost everywhere and they are increasing their availability all the way.
To use Cloudflare DNS services all you need to do is, point the name servers to Cloudflare and add all the DNS entries and DO NOT ENABLE the cloud icon. Allow the changes to propagate. Once everything is running on Cloudflare DNS you will see a slight improvement in DNS.
According to DNSPerf, these are the list of all well known DNS service.
2. Switch to a faster host.
You may never know but your web hosting server may slow your website down to a larger extent. If you are using a shared hosting service to host a busy site then chances are high that you are already in the slowest bullock cart.
Usually, shared servers suffer from a high latency because of busy neighbors and usages of heavy software like cPanel and WHM to control the users.
Shared servers that use cPanel is already using outdated software because of which you’ll never experience the advantages of the latest software.
For an instance take PHP 7, it was launched on 15th December 2015, which was known for its tremendous improvements in performance and stability, but it took over 3 years for the shared hosting companies to adopt it.
I blame cPanel and WHM for this because they do not update packages unless they feel their customers are going to switch to other alternatives.
Similarly, the Apache webserver is still the first choice for shared and managed servers which are known for the OHKAY-Ohkay performance in the industry.
Nginx and OpenLiteSpeed are the newer and fastest ones. I personally do not use Apache because that will be like using an abacus instead of a calculator.
Hardware-wise cheap hosting companies do not use SSD or NVMe drives to enhance the system responsiveness. If you are planning to host a blog, eCommerce site, forum, or massive website use an SSD drive at least.
3. Make use of fast and new web server.
Once you decide to buy a decent web hosting server, make sure you use it with all the latest apps. If you can manage your server yourself, better avoid the installation of cPanel or similar dashboard based software.
You can take advantage of the Nginx server with FastCGI cache to eliminate any concurrent load on the server. Nginx can handle static content very well.
Similarly, you can make use of the latest PHP 7.4 version.
PHP 7 came with many noticeable improvements and now it has been upgraded to 7.4 which took everything to the fastest performance we can achieve in the same hardware resources. Look at the image to understand the difference.
Before installing the latest PHP version make sure your site is compatible with it.
WordPress in its official documentation said that they are supporting the latest version of PHP and in the coming days they will drop the support for outdated versions. So just make sure the theme and plugins are upgraded recently.
4. Make use of caching wherever needed.
WordPress is a dynamic CMS we all know that, if you are using it as a blog or website then caching will eliminate the need of generating static versions of the same web page again and again. Cached contents can be served faster because it is already available in memory or cache to download.
Available caching options with WordPress:
- FastCGI Cache, a server-level cache (Nginx) [Recommended]
- WP Super Cache, easiest one (WP Plugin) [Recommended]
- W3 Total Cache, not recommended to smaller sites (WP Plugin)
- Cloudflare, only for 100% static websites (Full Page Proxy Cache)
From the above options, you can use anyone based on your setup. If you are using Nginx better use FastCGI cache which will eliminate the need for a cache plugin. Since it is a server-side cache it is the fastest and more efficient one.
You can serve the cache directly from the server memory, which means the network will be the next limit.
If you want to use a plugin-based caching option then use WP Super Cache or W3 Total Cache is always there, I’ll recommend only WP Super Cache here.
Cloudflare can be used as page caching using full page cache, but only recommended when a website is purely static and the content will never change.
The limitation is you need to manually purge the cache from Cloudflare if you made any minor changes in WordPress.
Note that Cloudflare’s full page cache won’t work well with blogs and forums, it is only useful when you have a static website. Let’s say you made a website with WordPress and nothing is going to change, use full page cache offered by Cloudflare. It will be the fastest setup anyone can achieve.
5. Take advantage of CDN for global content delivery.
Now we come to a different case where we want to serve the website to the world. Here we can use CDN (Content Delivery Network) to deliver the static contents very quickly by delivering the static resources to the user from his nearest available PoP (Point of Presence) CDN servers.
It is a really challenging job to sustain TTFB for web pages, but we can improve the loading speed of static resources by hosting them close to users.
This is where CDN comes in. A CDN service can have as many as PoP (Point of Presence) possible. But more presence means addition in the monthly fees. So choose wisely.
I recommend starting with BunnyCDN (referral link), as they’ve decent availability in the world by placing their network presence in the most strategic places while maintaining the lowest cost which makes it an affordable to use CDN service.
This is all, as of now we have the above technology to improve our website’s TTFB. In the coming days, we will see HTTP/3 and QUIC which is about making a certificate secured connection (HTTPS connection) faster.
Please raise a comment if you are confused, have any query, or feedback for us.