How Time To First Byte (TTFB) Impacts Your Site’s Performance
Let’s all agree that your website speed can be subject to many factors. While it’s hard to break down all of them, it’s still not impossible. In this context, one of the metrics you can try to interpret and improve is Time To First Byte (TTFB).
Through this article, we’ll walk you through essential information that will help you assimilate the impact of this metric on web performance.
So, what is Time To First Byte (TTFB) anyways?
Time To First Byte (TTFB) is the name given to the time between the first request of the end-user to a web server and the response back of that request from the webserver to the end-user.
Resolving the address of the site using a DNS and retrieving the response of the first request sent to the site are the factors that cause this time to occur.
In other words, this period will occur in 3 steps and the performance in these stages will play an active role in the duration of TTFB.
Step1: Submitting the first request to the site address
Important factors in this step may be:
- DNS response time (how fast is the end-user’ side for resolving DNS request)
- The distance of the website servers to the end-user, shorter the better.
- Stability of the network
Step 2: Resolving this request by the webserver
Important factors in this step may be:
- Physical hardware response time (how fast the web server can resolve it)
- The existing workload of the server operations
- Any network-related latency within the datacenter.
Step 3: Sending the first response to the end-user
Important factors in this step may be:
- The end-users internet speed
- Stability of the connection.
What is considered as good TTFB and what is not?
In fact, this may vary according to the content of your site. Depending on the proportion of dynamic and static data in the content of the site, good or bad evaluation will vary. In general, many speed test tools give ranges as following:
- 0 – 75ms Perfect
- 75 – 200ms Ideal
- 200 – 500ms Less than ideal but acceptable
- > 500ms There is a problem
However, the fact that the site is entirely composed of dynamic data can increase these ranges. Determining a TTFB based on the content of the site will always make more sense.
What can make TTFB slow?
Network problems that exist in Steps 1 and 3 (mentioned above) will increase TTFB.
Similarly, in step 2, during the processing of the request, older hardware and problems on Disk or RAM may cause a slowdown.
Low I/O values on the disk will prevent processing fast and will queue too many requests.
Likewise, if the server hardware is not enough for the operations or there is an instant flood of requests, they will end up with an increasing TTFB.
Additionally, poorly optimized code, database, and web server configuration may cause a delay in meeting incoming requests.
Finally, high-level software that meets and processes requests through the server will also cause slowdowns.
So now that you are able to determine the pain points, let’s see how you can increase TTFB speed
The initial response time can be reduced by:
- Presenting static data at first boot
- Using a Content Delivery Network, i.e. having your site content closer to end-users.
- Code Optimization: the settings of the software language used, and the performance of the encoding can be improved to accelerate the first rendered page.
- Database Query Optimization: database normalization and database operations must be overhauled.
- Data Caching in Memory
- Using the latest hardware as much as possible such as new CPUs, SSD or NVME for I/O.
The impact of CDN on TTFB
Basically, this is what you get when you use a robust CDN:
- All queries start with a DNS request. So a CDN using Anycast DNS will use the closest DNS server and speed up your web site.
- Better Routing on the requests, i.e. every request is routed to the closest server
- With static data transferred onto the CDN, origin servers will only be used for new content. Your web site will not use origin hardware resources for CDN cached content or requests.
- More hardware resources are available.
The impact of TTFB on web performance
In fact, TTFB is indirectly related to the performance of subsequent transactions since the first byte is the return period.
Optimizations to reduce TTFB will ensure that your site’s post-TTFB operations will be more efficient. Operations that can be performed to have a good TTFB pave the way for subsequent I/O operations to be faster.
On the other side of the spectrum, the user experience will get much better with higher performance. Because your site will load faster, and the probability of losing the user until the page opens becomes considerably reduced.
At this point, we assume you’ve accumulated a better understanding of TTFB. If you feel the need to reevaluate your site’s performance, our team of experts has elaborated a FREE assessment program to help you measure the performance of your website, by filling out this form, the detailed report will be sent to you within 24 hours.
Additionally, you can use our CDN Free Trial as a starting point for an improved TTFB. Make sure to contact our support team if you need any help.