cloudflare-cdn-2a-small

CloudFlare CDN and TTFB (Time To First Byte)

Often clients teset their page load speeds, eg with a site like http://www.webpagetest.org/ ,  and see something like this in the results:

 

cdn-pagespeed-failed

 

They see the "F" result and get very concerned that their page load is slow.

Don't worry about this in the least!

It is simply the way this particular test works, and is by no means a failure.   

First off, remember that all MobiusMBL sites use the Cloudflare CDN to help speed up the website.

A real world example

"Time To First Byte" is often used as a measure of how quickly a web server responds to a request and common web testing services report it. The faster it is the better the web server (in theory). But the theory isn't very good.

From the end user perspective TTFB is almost useless. In this (real) example it's actually negatively correlated with the download time: the worse the TTFB the better the download time.

To illustrate that, the Cloudflare people took the largest Wikipedia page (List of Advanced Dungeons and Dragons 2nd Edition Monsters) and served it with and without gzip compression enabled (all MobiusMBL websites have Gzip set ON as default).

The table below shows the TTFB and total download time with compression on and off.

Gzip Compression     TTFB Page Load Time
  (ms = Miliseconds, 1ms = one millionth of a second)  
OFF   0.213ms 43ms
ON 1.7ms 8ms

Notice how:

  • with Gzip compression turned ON, the page was downloaded 5 times faster (8 ms Page Load Time), but the TTFB was 8 times greater (1.7 ms TTFB). That's because the webserver waits until compression has started before sending the HTTP headers;
  • when Gzip compression is turned OFF it sends the headers straight away, so the TTFB is much faster at 0.213 miliseconds, but the Page Load Time is 8 times slower.

So if you look at TTFB it looks as if compression is a bad idea. But it you look at the download time (which is what really matters), you will see the opposite.

The bottom line

Probably the only time TTFB is useful is as a trend. And it's best measured at the server itself so that network latency is eliminated. By examining a trend it's possible to spot whether there's a problem on the web server (such as it becoming overloaded).

Measuring TTFB remotely means you're also measuring the network latency at the same time which obscures the thing TTFB is actually measuring: how fast the web server is able to respond to a request.

The full details (warning...... technical!!!)

Here is an article from CloudFlare on this.....  WARNING....   it;s more than a a little technical! http://blog.cloudflare.com/ttfb-time-to-first-byte-considered-meaningles/