How To Reduce TTFB
What is TTFB?
In order to understand how to reduce TTFB, first of all, we need to understand what it means. TTFB stands for time to first byte. Simply put, The Time To First Byte is the time it takes your browser to receive its first byte of data from the site’s server. In other words, how long until I see anything on my browser page.
Let’s take a look at Google’s definition of TTFB:
“Time spent waiting for the initial response, also known as the Time To First Byte. This time captures the latency of a round trip to the server in addition to the time spent waiting for the server to deliver the response.”
In order to get a deeper understanding of this subject allow me to break down this process for you:
1. The time it takes to send the HTTP request
This whole process starts out with a simple HTTP request your browser makes when you write down a URL of a website and hit enter. This is where a good web host and proper configuration helps a ton! This is the time the server takes after it receives your browser’s request, up to the moment he passes it along to your web server (apache/nginx, etc.) and other systems.
2. The time it takes to process the request
Once the server receives the request, it needs to act upon it. meaning, running scripts, interacting with different systems, running database queries and more.
3. The time it takes for the server to send back the first byte of the response to the browser
Finally, the server responds to the user’s requests and sends out an output of data, the first byte. Heavy scripts, animation, big database queries, large sized images, ill configuration, bad optimization, and more factors will greatly impact the response time.
In conclusion of this process
The longer your server takes to process this request and output a stream of data the longer the user will wait for the first byte of data. We will dive in into some of the factors soon. keep on reading.
Why is TTFB So Critical?
You probably ask yourselves, Why I need to reduce the TTFB? The answer is not so simple.
There are some mixed opinions here regarding the importance of the TTFB, nowadays the main consensus is that it does matter. It does matter in an SEO point of view and your User experience. MOZ published a study on the importance of the TTFB and its impact on Googles Page Rankings. I won’t go into details. if you want to know more about it you can read it here: MOZ TTFB.
I want to talk about the more important fact why it matters, 2 main reasons:
- Users spend much less time tiredly waiting for your site to start loading. Thus improving the overall user experience on your platform.
- Users are less likely to bounce while waiting for content to start appearing on the page. Meaning higher engagement and retention.
If you don’t believe that TTFB impacts your google ratings, ITS A FACT it does impact your UX and Users Bounce rates.
What is Good TTFB?
It varies, in general, a good TTFB for dynamic websites(like WordPress) stands between 200-500ms. Static sites should be under 100ms.
What Causes a Long TTFB?
Now that we understand what is TTFB, we can go ahead and address its causes:
- Inadequate Hosting Plan – For Example, A large E-commerce website with 5K visitors a day on a small hosting plan.
- Bad Hosting Provider – Low-cost Hosting providers with poor server stability, optimization and response time.
- Inadequate Geographical Hosting Location – Website Targeting the USA, Hosted Over Seas. It Should Be Within For the best response time for its users.
- Poorly Optimized Website – Heavy Themes, big database calls, large sized image, slow server latency, big script/CSS files, bad structure and site architecture.
- Too much DNS Lookups
These are the main causes of a long TTFB! nevertheless, most of these problems can be addressed and solved.
How to Measure TTFB
The first step is finding out your current TTFB by measuring it, Afterward, you find out what are the reasons its soo long, and finally, you fix it. In this article I’m going to cover 1 tool out of many that can help you with measuring TTFB :
Measuring TTFB with Pingdom
Let’s get to it.
Measuring TTFB with Pingdom
You simply go here. fill in your domain and click TEST. When you get the result scroll down a bit and you will see it as “WAITING TIME”:
How To Reduce TTFB
So, Now we know what is TTFB. In addition to that, we know how to measure TTFB. But how do I reduce Tthe TTFB? Lets see How can I improve my TTFB
Use a Fast Web Host
One of the most important factors. get a solid start when it comes to hosting. Choose relevant geo hosting location upon the target crowd. In addition, choose a suitable package for your platform.
Keep WordPress, Plugins and Themes Updated
This is for all the WordPress users out there. beware of too many plugins, heavy themes, outdated versions of themes, plugins. Keep your WordPress site up to date and running smoothly. If you are using WordPress you can Install the strongest Optimization solution out there. WP Rocket.
WP Rocket provides a whole system for optimizing your site and thus, reducing TTFB! it’s simply a must on every WordPress website. I as a developer install it to every client of mine.
Reduce DataBase Queries
Database queries are one of the biggest factors for slow websites and long TTFB. use a developer to see what isn’t necessary and what can be made better and optimized in order to reduce TTFB.
Use Caching
Nowadays use simply must make use of browser caching. It improves loading times significantly! If you are using WordPress, WP Rocket Utilize and leverages browser caching!
Use a CDN
Utilizing the use of a good CDN can help deliver your static content, like images and scripts, faster to users via a network of servers worldwideFor example: if your server is geographically located in the US, and your users are mostly in Asia, they will receive your site’s content from a server location that’s closer to them.
This reduces the network latency between your site’s server and your visitors and allows a faster response time!
Prefetching & Preloading DNS Service
This will require its own article, this is a very high niche in the subject of optimizaing. a seprate article will follow to explain this subject.
In Conclusion
Thumbs up for reading until the end! Congrats, now you know what TTFB is, How to measure TTFB and even how to reduce TTFB. If you are using WordPress its highly recommended to install WP Rocket and Configure it Properly. You can visit my guides on this here:
- If You Don’t have WP Rocket, Get it here with a discount: WP Rocket Coupon Codes 2019
- To set it up with the best settings, follow my article here: Best Wp Rocket Settings For WordPress 2019
If you’re not using WordPress it’s still important to implement some sort of a caching and lazy loading mechanisms for your platform’ same rules apply to everyone 🙂
I hope you enjoyed this article and I will see you next time.