Knowledge

How to measure TTFB (Time To First Byte)

#Performance

TTFB is one of the most important metrics to measure your website or webapp performance. Because only after the first byte the browser can begin to render it.

Published by Mark van Eijk on August 24, 2022 · 1 minute read

The performance of a web server is very important for your web application. The first metric that comes to mind when measuring web application performance is the TTFB (Time To First Byte).

This number shows the time it takes for the server to return the first byte in response of a request from a client.

We can easily get the time it takes for the server to process a HTTP request using the following command:

URL="https://rocketee.rs"

curl -o /dev/null \
    -H 'Cache-Control: no-cache' \
    -s \
    -w "TTFB: %{time_starttransfer}" \
    $URL

This command takes care of two important things:

  1. Make sure we don't get an earlier cached version of the webpage
  2. Only shows the number we're interested in using silent mode and directing output to /dev/null

Subscribe to our newsletter

Do you want to receive regular updates with fresh and exclusive content to learn more about web development, hosting, security and performance? Subscribe now!

Related articles

How to optimize server performance

TTFB is one of the most important metrics to measure your website or webapp performance. Because only after the first byte the browser can begin to render it.

Read more →