Most WordPress users who are trying to increase the speed of their site tend to focus mostly at the page level. While the website and it’s page are very important when it comes to site speed, one of the factors that many tend to overlook is the delay between when user enters your site and the moment your website actually starts loading, otherwise called Time to First Byte or TTFB.
What is TTFB?
TTFB is the time between a browser making a request and receiving a response.
The moment someone first enters your site, their browser will make a request to your server so it can begin to render the contents of your website on the browser. However, this doesn’t happen instantaneously.
The user’s browser must send the request, the server must receive and process the request, and the response has to be received by the browser. The time it takes for this to happen is measured as Time to First Byte or TTFB.
This is a commonly overlooked performance factor but it is an important factor in your site speed, and we all know why site speed is important.
How to Check TTFB
If you have had your website for any length of time, you have probably done a webpage speed test before using an online tool like WebPagetest. WebPagetest is a particularly neat one because it shows you how your website’s TTFB stacks up against the rest of the web.
In the above example, this website’s TTFB was 1.67 seconds (or 1670 milliseconds), way higher than Google’s recommendation of keeping it around 200 milliseconds.
And by testing your site with any such tool, you were also probably presented with a waterfall chart of all of the items that load in sequence on your page. The first line on that chart shows your TTFB. Here is an example of such a waterfall chart using a different website as another example:
The website above is has a TTFB of 5205 milliseconds, which is more than 5 seconds! You do not want your waterfall chart to look like this.
KeyCDN’s Web Performance Test is another great online tool like WebPagetest and is one you should definitely bookmark. Unlike others, they allow you to test from 14 different locations at the same time and display a column in the results that show the TTFB recorded from each location.
Causes of Slow TTFB
Here are four of the most common reasons that contribute to a high Time to First Byte on WordPress websites:
As a website owner, you’ll have varying degrees of control over each of these things.
Latency is an expression of how much time it takes for a packet of data to physically get from one point to another. Various factors may affect latency but the implications of it are quite simple. The further the distance is between the user and your server hosting the website, the greater the latency.
The natural solution to this is to decrease the distance between your server and your users.
And this is why many hosts give you the option of choosing your server location when signing up for a web hosting plan. You want to make sure your server is located close to your target audience.
But if your content is meant for a worldwide audience or your target market has a wide geographic distribution, the users that are located farther away from your server will suffer from slower response times. This would seem like a huge problem but the solution to this is actually quite simple.
You can use a Content Delivery Network, commonly referred to as a CDN.
A CDN is a global cluster of caches that act as local servers for users distributed throughout a wide geographic area. Think of it as having multiple server locations.
In the WordPress community, there is a lot of general advice that involves editing or adding some function to your .htaccess file. Unfortunately, your .htaccess file is loaded every time a document is requested by a browser.
We have seen countless WordPress websites with bulky .htaccess files that have an unnecessary amount of functions. Some are left behind by old plugins and others are loaded with mod_rewrite rules that no one can explain.
Ideally, you should not use a .htaccess file at all or have it present on your website. But if you do have one, limit the number of functions as much as possible.
One of the great things about WordPress is that it generates content dynamically, meaning if you wanted to change the contents of your footer on every page, you can do it by editing only one footer section in your WordPress admin instead of making the same changes to your footer on every page of your website by editing the code.
This is quite different from the way websites were built in the past, where all the contents of a page would lie in a single file. Back in the day, when a browser requested a page, the server would find the proper file such as “PageNumber28” and send it to the browser, which would then render the contents of the page through that one file.
But when a browser requests a page from a WordPress site, WordPress builds the page for you. It grabs the header that’s supposed to be on every page along with the footer, menu, etc. and of course the content that’s unique for that page too.
As you can imagine, this takes a bit more time.
One solution is to leveraging full-page caching through the use of a plugin or by using a host that provides caching. But keep in mind that there are different types of caching and not all caching plugins might be compatible with your host depending on the caching they already provide.
However, if you are running something a bit more complex like a membership site, eCommerce, or bbPress, your users are going to entirely skip full-page caching, at which point, your focus should be on optimizing your database.
Most WordPress websites are on a shared server instead of a dedicated server and there is nothing wrong with that. Using shared hosting plans are the most cost effective way to set up a website.
However, on a shared server, you will occasionally suffer from poor server performances. The result could be due to a minority of users hogging up all of the server resources during a particular time or that the server is simply overloaded with users.
There are some hosting companies that are notorious for overloading shared servers and as a result, their users consistently suffer from poor performance and frequent outages.
https://zenwp.co/wp-content/uploads/2017/01/TTFB6.png476711700Phillip Koohttps://zenwp.co/wp-content/uploads/2017/08/logo2017darkmedmargin.pngPhillip Koo2017-01-21 19:42:192017-02-09 06:43:51Decrease TTFB - Make Your Time to First Byte Faster