On the Internet, speed matters. A lot.
While our tolerance levels for stoplights and microwave ovens are somewhere along the lines of two minutes, our tolerance for a loading webpage is less than three seconds. This is where the issue of “time to first byte” (TTFB) comes into play.
What Is Time To First Byte?
When someone selects your website on Google, their web browser requests information – or bytes – from a server. TTFB is the number of milliseconds it takes for a browser to receive the first byte of the response from your web server.
More clearly TTFB is also called "waiting" by Google:
Time spent waiting for the initial response, also known as the Time To First Byte. This time captures the latency of a round trip to the server in addition to the time spent waiting for the server to deliver the response.
A website with a higher TTFB can frustrate its visitors. If your webserver takes too long to even send the first byte of a page request, two problems can occur:
- Your website’s visitors will abandon your site and visit your competitor’s site instead
- Your website’s SERP rank can suffer because Google takes TTFB into consideration
Time To First Byte is different from page load speed measurements like Google PageSpeed. Google says not to worry so much about that one.
Google says speed is a ranking factor but no correlation has ever been found between a good Google PageSpeed score and ranking. Such a correlation is present for Time To First Byte.
What Is Considered A Good Time To First Byte?
According to Google, your website’s TTFB should be 200 milliseconds or less.
If your site is much slower than that, such as 500 milliseconds or more, it needs some work.
- 100ms for static content (content that already exists on the sever as files)
- 200-500ms for dynamic content (content that is put together from a database and templates, like WordPress does, for example)
Testing Your Website’s TTFB
While not the only way to test TTFB, WebPageTest is one of the most reliable and trusted tools.
- Enter your website URL at WebPageTest.
- If you’re in the US, choose a “Test Location” in North America.
- In the “Browser” dropdown menu, choose the web browser you’re using.
- Select the “Start Test” button.
WebPageTest will give your website a letter grade for TTFB, among other things. It also provides detailed analytics.
WebPageTest "uses the socket connect time for the base page as an estimate for the round-trip time to the server. It then takes the DNS time, socket connect time, SSL time and adds on one additional round trip as it's estimate for the fastest possible TTFB and then allows for 100ms on top of that" before grading you down.
What Causes Slower TTFB?
Four causes of slow TTFB are:
- High web traffic
- Network problems
- Dynamic content:
- disk usage
- disk speed
- RAM usage
- database setup
- database speed
- Server configuration:
- PHP/ASP settings
- database settings
- shared server?
There isn’t much you can do to solve high amounts of website traffic or network issues. There are, however, ways to improve slow TTFB caused by dynamic content and server configuration.
What Is Dynamic Content, And How Does It Slow TTFB?
Dynamic content (which is commonly used by WordPress) is one of the biggest causes of slower TTFB. Most pages on the web as we know it are dynamically served.
Unlike static webpages that are sent to a web browser instantly upon request, dynamic web pages need to be assembled each time a user requests the webpage. This assembling process is what slows TTFB.
The time to look find and get the relevant content from the database, get the files, and put everything together can easily form a bottleneck, especially if the server has to do so for multiple visitors at the same time.
Improving Your Website’s TTFB By Caching
Significant improvements to TTFB occur by caching your dynamic pages. Caching your pages make the pages “pre-built,” with HTML ready to go as soon as a browser requests the pages. Here are a few ways you can cache:
- WordPress Plugins. Plugins such as WP Super Cache will help you cache your dynamic pages. The plugin keeps tracks of when a "saved" dynamic page should be renewed so that the freshest copy possible is served. (See also: A Complete Guide To Using W3 Total Cache)
- WordPress hosting that caches automatically. WordPress hosting can give you caching capabilities that improve your site’s TTFB.
- Server Configuration. A common way to cache files -- but not dynamic content -- is to configure the .htaccess web file. (.htaccess is short for hypertext access.) Beware that minor errors in this file can lead to major problems; hiring a professional is advised.
When improving TTFB, there are many details to consider. Those who follow through and take measures to improve their TTFB enjoy competitive advantages. Just like SEO and other labor intensive website initiatives that give consumers a better experience, it’s all worth it at the end of the day.