Improving Your Website’s TTFB (Time To First Byte)

March 22, 2016

Blog

Last September, I blogged about some ways that you can make your website faster. Let’s face it: The time it takes your website to load is critically important. If its too slow, you will lose visitors. In this blog post, I’m going to write about one aspect of page speed: The Time To First Byte (or TTFB) and some ways you can possibly improve it.

Server response time (or TTFB) is the time it takes your web server to load the HTML code a web browser needs to begin displaying your web page to an end user. Google recommends that a server’s response time should be under 200ms. In 2013, Moz, a leading SEO platform, recommended a maximum TTFB of 500ms. According to http://www.webpagetest.org/, which is a popular performance testing tool used by web developers, the Develop CENTS website’s TTFB currently falls in below 400ms, which is that testing platform’s recommendation.

Web Page Performance Test Results for developcents.com as reported by http://www.webpagetest.org/result/160322_MB_K69/1/performance_optimization/. Note that we are not using - nor do we need to use - a CDN (Content Delivery Network).

Web Page Performance Test Results for developcents.com as reported by http://www.webpagetest.org/result/160322_MB_K69/1/performance_optimization/. Note that we are not using – nor do we need to use – a CDN (Content Delivery Network).

Improving Time to First Byte

As I explained in my blog post from last September, caching is very important to a website’s overall performance. You can implement both server-side and client-side caching. Server-side caching is done on the server. For example, if you have a page on your website that is popular, and it takes significant server resources to generate that page (think: selecting information from a database), then its possible to generate the page once and then cache it (save it into the server’s memory) for subsequent visitors.

Client-side caching leverages web browser functionality for repeat visitors. Once someone visits your website, if they visit the site again – or move to a different page on the website, then chances are that many of the same files will be used for those subsequent visits. One popular way to leverage web browser caching is by editing the .htaccess file in the website’s root directory. This is the caching-related code we use in our .htaccess file:

Contact us to help optimize your website

### EXPIRE CACHING-BROWSER CACHING ###
# Enable expirations
ExpiresActive On

# Set default expire time
ExpiresDefault “access 2 week”

# Specify expire time by file type
ExpiresByType image/jpg “access plus 1 year”
ExpiresByType image/jpeg “access plus 1 year”
ExpiresByType image/gif “access plus 1 year”
ExpiresByType image/png “access plus 1 year”
ExpiresByType text/css “access plus 1 week”
ExpiresByType application/pdf “access plus 1 month”
ExpiresByType text/x-javascript “access 1 month”
ExpiresByType image/x-icon “access 1 month”

There are certainly other ways to cache data and there are also other ways to improve TTFB, but this basic information should help get you started!

To learn more about our services, visit our home page, or read about our services.

Sign Up for Our Newsletter

Recently on Twitter:
Contact us today to discuss the best ways to turn your IT challenges into IT opportunities.
Develop CENTS