Analyze Your Website’s TTFB (Time to First Byte)

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

That said, as it pertains to end-user performance of your web applications, where should you start? This will vary case by case. For example, lets say your webdev team did a clumsy job of optimizing your application’s performance. Thus, when you scan your page using tools such as GTmetrix, Pingdom tools, etc the results look something like this:

GTmetrix poor score

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

This can be achieved by optimizing and improving your network connect and back-end (server) response times. In brief, some of the factors that can cause 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 lower your TTFB you may need professional help. For the purpose of this article, we will be looking at analyzing TTFBAlso see: 100+ Top Server Monitoring & Application Monitoring Tools.


What is TTFB?

Time spent waiting for the initial “server response” is also known as the Time To First Byte (TTFB). This time captures the latency of a round trip to connect the client to the server, plus, the time spent waiting for the server to deliver a response. (Source: High TTFB is usually a sign of one or both of the following issues: 1) Poor network conditions between client and server or 2) Slow-to-respond web application/server.

High TTFB will often cause your page loads to be mysteriously slow or at the very least increase the latency between page loads. You should check to see if your TTFB is a performance issue or not. Try to keep TTFB under 200 milliseconds. 2nd+ requests should be even lower.


TTFB check using CURL

Here’s a quick example using CURL to check TTFB from your Linux or Mac terminal app. Use the following command replacing “” with your domain:

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

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 check methods (using web browser)

ttfb check

In addition to curl, you can check TTFB using these tools.

Related reading: Nginx tuning tips: TLS/SSL HTTPS – Improved TTFB/latency

Updated: December 2th 2018


Tags: , ,