This article is going to explain what TTFB is, how it affects your WordPress Page load times and how to reduce it. When troubleshooting a slow website, TTFB (time to first byte) is one of the metrics all site benchmarking performance tools use to determine how fast your website starts loading from a specific location or setting.
Firstly, you must understand that TTFB (time to first byte) is not measuring your website speed. TTFB is a measurement of responsiveness.
What is TTFB?
Time to first byte (TTFB) measures the duration of time browser has to wait before receiving its first byte of data. A common misconception is that this is calculated post DNS lookup, however, the calculation of TTFB always includes network latency.
A lower TTFB means fewer dynamic calculations being performed by the server most often due to caching. A very low TTFB is observed with static HTML page, while larger TTFB is often seen with dynamic data requests being pulled from a database.
When a visitor views your website an HTTP request is sent from the browser to the server. There are various factors that can cause delays during this process. Slow DNS lookup times can contribute to increased time for the request. If your site’s geographical location is far away, this can increase latency due to the distance the data must travel.
Once the server receives the request, it has to process and generate a response. If your website uses a content management system (CMS) such as WordPress, the server has to do all the necessary computations needed to display the site content. PHP loads the MySQL database and fetches the content to display the appropriate output for the browser.
There can be various delays during this process such as slow database queries, too many WordPress plugins, not caching, using an older PHP version, poorly optimized code or WordPress theme. This could result in a poor TTFB value like 1-4 seconds or higher, which does not always mean your hosting server is slow or experiencing problems.
If you are seeing slow TTFB with a static HTML page, then you may want to start investigating from the server as there could be no other factors affecting the performance of your site.
How to reduce TTFB for your WordPress site
1. Utilize WordPress Cache
One of the easiest ways to lower your TTFB is utilizing cache on your WordPress site. You may think that caching only helps decrease your load times, but in fact, it can also help lower TTFB as it reduces the server processing time.
Our servers utilize LiteSpeed Cache for WordPress, which is built-in page cache to dramatically reduce page load times and lower TTFB.
Simply enable the plugin from your cPanel control panel under LiteSpeed Web Cache Manager.
If you have cache enabled and still notice high TTFB, you must check for two things.
- Make sure you are measuring a cached result, you can do this by performing your test more than once. A slower first result is normal and should be faster with consecutive tests. Run multiple tests to verify you’re measuring cached results.
- Are you testing from a close geographical location? If you are testing from a farther geographical location it is normal to have higher than average TTFB due to network latency. If you want your site to be fast from various locations, consider implementing a CDN.
You cannot fully cache all pages such as Checkout pages and shopping carts. You can still make sure you are using PHP 7.2 or latest with opcache enabled from cPanel control panel under Select PHP version.
You can also utilize Memcached service to further improve the time WordPress takes to pull data from the MySQL database.
2. Check WordPress Plugins
Check all the WordPress plugins you are using. How many total plugins are installed and how many are active? Are the plugins high quality and regularly updated? How much load do they add to your page rendering process?
3. Implement a CDN
Another easy way to lower TTFB is to utilize a Content Delivery Network (CDN). If your website is serving visitors from different parts of the country or around the globe, CDN can help drastically lower your TTFB.