Analyze your website’s TTFB (time to first byte)

Have you recently improved the load times of your websites and web applications? Or, maybe your web store or other web app is now slow to respond because you’ve added more features or because of data growth? The time it takes for your web application to respond when users visit is more important than ever! After seeing the tangible benefits of this blog on reducing server responsiveness, network connect, and page load times, I can attest to this. Without going into specifics, some of the benefits include longer stays on the site, increased engagement, and more conversions, to name a few.

That said, as it pertains to the end-user performance of your web applications, where should you start? This will vary from case to case. For example, let’s say your WebDev team did a futile job of optimizing your application’s performance. Thus, when you scan your page using a tool like gtmatrix, psdi tool (a blog sponsor)Etcetera. The results look something like this:

… in this case, you have more to address before this Looking seriously into TTFB. However, if your frontend test result looks closer to the screenshot below, then most of the times, you can continue to improve page load times by reducing your TTFB.

Low TTFB can achieve this by optimizing and improving your network connection and back-end (server) response times. In short, some of the factors that can cause a slow TTFB are: DNS resolution, database, server-side scripting, server hardware, poorly configured server, lack of caching, web host network and upstream performance. To successfully troubleshoot and reduce your TTFB, you may need professional help. For this article, we will be looking Analysis of TTFB, Plus, check out 100+ top server monitoring and application monitoring tools.

What is TTFB?

The time spent waiting for the initial “server response” is also known as Time to First Byte (TTFB). This time captures the latency of one round trip to connect the client to the server, as well as the time it takes for the server to wait for a response. (Source: developers.google.com, High TTFB is usually a sign of one or both of the following issues: 1) poor network conditions between client and server or 2) a slow responding web application/server.

High TTFB will often slow down your page loads mysteriously or, at the very least, increase the latency between page loads. You should check to see if your TTFB is a performance issue. Try to keep TTFB under 200 milliseconds. The second+ request should be even less.

TTFB check using curl

Here’s a quick example of using curl to check TTFB from your Linux or Mac Terminal app. Use the following command instead of “with your domain”:

curl -o /dev/null -w "Connect: %{time_connect} TTFB: %{time_starttransfer} Total time: %{time_total} \n" https://haydenjames.io/

Example output:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 34782    0 34782    0     0   143k      0 --:--:-- --:--:-- --:--:--  144k
Connect: 0.018 TTFB: 0.231 Total time: 0.236

Additional TTFB checking methods (using web browser)

TTFB check

Also, for curl, you can check TTFB using these tools.

Related Reading: Nginx Tuning Tips: TLS/SSL HTTPS – Improved TTFB/Latency

Last Updated: August 9, 2021

Leave a Comment