TTFB or Time to First Byte is the hardest thing to optimize in WordPress. This guide will help you with implementing some easy steps to improve TTFB.
Table of Contents
- What is TTFB?
- How to Measure TTFB?
- How to Reduce TTFB in WordPress?
What is TTFB?
Time to First Byte. As the name suggests, it’s the time required to receive the first byte from the server, or inessential how fast your receive data when requesting a webpage.
TTFB vs Loading Time
Sometimes TTFB is confused with the loading time of a website. However, they’re not the same. Loading time refers to the total time of a request which includes sending, TTFB, downloading, parsing, etc.
How to Measure TTFB?
There are several tools to measure the TTFB. My favourite one is https://tools.keycdn.com/performance because it will do the test from 14 locations.
What is Good TTFB?
Google recommends having a TTFB of a maximum of 200ms. Even 200-400ms is ok. Anything beyond 500ms is considered slow. It will clearly affect the whole speed of the website and user experience.
How to Reduce TTFB in WordPress?
Use Cloudflare DNS
DNS has a vital role in page speed and TTFB. It is how your browser finds your server and connects to it. The faster your browser connects to the server, the faster TTFB!
Here is a comparison of the response time of Cloudflare DNS with popular services:
|Provider||ProvResponse Time (lower is better)|
|Route 53 (AWS)||49 ms|
|Google Cloud||59 ms|
Use a Cache Plugin
For every new request to a page, WordPress has to execute PHP and MySQL queries. But 90% of the time you don’t need it. You can generate HTML files and serve them directly. It’s very fast when compared to generating it from PHP.
There are several plugins that help you to enable cache in WordPress.
FlyingPress is an all in one optimization plugin with caching (built by myself).
Use a VPS server or High Performance Managed Hosting
Unlike shared hosting, VPS servers and a few managed hosting providers don’t share resources across other sites. What this means for you is a faster website.
Here are a few that I recommend:
Use PHP v8.0 (or the latest version)
If caching or a static website isn’t a good solution (especially for e-commerce, forums) then speeding up processing is the only way. It’s not just about increasing CPU and RAM.
Even though it’s a smaller upgrade in the number, the performance is notably different!
Use TLS 1.3
TLS is the successor of SSL. It’s a protocol to provide end-to-end encryption (HTTPS). TLS 1.3 is the latest version. Version 1.3 reduces the number of round trips and provide a significant improvement in TTFB.
It requires only a few changes in the server, but you could reduce up to 250ms just by upgrading to TLS 1.3.
Choose Server Location Wisely
If your audience is in India and your server is in the US, that will add an extra 200-300 ms network latency.
Select your server location wisely. Choose the server that is very close to your audience location. Most of the cloud hosting providers like Cloudways, Kinsta has locations all around the world.
Use OpenLiteSpeed or LiteSpeed Server
LiteSpeed is a web server similar to Nginx and Apache which provides much better performance, especially in terms of TTFB. OpenLiteSpeed is the open-source version of LiteSpeed enterprise.
Cache HTML Pages on CDN
An HTML page is the first piece your browser asks when a user visits your website. Due to several factors, Cloudflare by default won’t cache HTML/JSON. However, you can write custom rules to cache HTML pages in their CDN servers. This will decrease the TTFB by 10x or even more!
Use Cloudflare Argo
Argo detect real-time congestion and route web traffic across the fastest and most reliable network pathsCloudflare
Cloudflare powers 10% of the internet! They know which is the fasted path to deliver. With Cloudflare Argo, you can speed up the TTFB by 35%.
Argo isn’t free, unlike the above services. It costs $5.00/month + $0.10 per additional gigabyte.
The first impression is the best impression. TTFB is more important than your total website load time. I hope the above steps will help you to decrease the TTFB.
Comment below if you’ve any queries or feedback. I read and reply to each of them within 8 hours!