3 ways to check your TTFB

In the world of websites, devops and linux gurus, the acronym TTFB gets thrown around a lot. But what is it? It’s essentially the time it takes for a web browser to receive it’s first byte of data from your web server and start doing something with it.

Why is it important?

The lower the TTFB, the faster your users will start viewing your webpage. At least, in theory.

Why would I care?

Well, people care how long it takes to load their webpages, as potential visitors might get put off by slow loading sites and might go elsewhere instead. Devops type people (as well as manager type people) also tend to care if the latest release or configuration changes increased it or not.

How do I find my TTFB / how do I test my website TTFB ?

I’m going to show you three ways:

  • From your own web browser (assuming you aren’t looking at the server over your local LAN which would significantly affect results, you want something outside your network, but on the internet) you can press F12 in Chrome or Firefox which brings up the inspector window. Then hit reload, so it will start analysing the page. You should get an output similar to the below image . Here you can see the first object loaded in 335ms
using the inspector in chrome to see loading events
  • Checking with a command line tool: I was recently introduced to a nifty little command line tool that will check the TTFB against any site you ask it to. It’s handy because you can obviously use it in shell scripts and do something with the output. If you want to be able to check TTFB using a linux command line then check out this project, then you will be able to do something like this. You can also specify the number of requests and time the fastest/slowest/median response time.
  • webpagetest.org is a favourite of mine for checking external connectivity, but also giving an overall health of the website i’m checking. It will show you (amongst many other things) the TTFB it’s even one of the score boxes at the top of the results page. Clicking on the “First Byte Time” will give you TTFB specific info.

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *