Why TTFB Matters a Lot! [WordPress installed on Server]
TTFB (Time To First Byte) is the time taken by your web server to respond to the request from a user (web browser). This is one of the critical factors which will allow users to engage with your website (or) web application. Assume you have a web / mobile application, that has a latency of 2 Seconds. Your entire system is messed up!
Let’s now go through the easy steps to reduce the TTFB on your server.
WordPress – Most Powerful and Widely used CMS
This is going to be the first session to be covered on TTFB Optimisation. Hence, I will be explaining you the most common scenario of having a WordPress CMS installed on your server and how to optimise TTFB.
In case of having WordPress, the average TTFB takes around 1 to 2 seconds if the CMS is not optimised properly. Here are some best practices!
Having too many plugins is not an issue. But, making sure you do not get a PHP warning (or) something getting written on error log is always an issue. You can have a plugin like “BPS Pro” to have an eye on the warnings that you get from plugins.
Make sure you have the plugins up-to date and remove unwanted ones.
You should also make sure that the database records of the plugins are deleted (manually) when you are actually deleting a plugin form your WordPress CMS.
Themes and Cron Jobs
There are tonnes of themes that get released new and updated every day in the market. Some are hard coded and some are using drag and drop builders. With these all scenarios, make sure you are either using a well established theme or a custom coded theme to avoid this Sluggish TTFB Trap!
Quick Tip: Perform a test with Default theme (Twenty Seventeen) and another test with your theme. Check the difference!
Over a period of time, we tend to install plugins, update and upgrade them. Sometimes, we remove plugins from WordPress. But, this does not remove the data form MySQL Database at all. Every time you delete a plugin, only the Files are removed from Web server. Not from the MySQL Database.
To make sure that the server responds fast, the MySQL Database should be free from the redundant data / use less data left over by the old plugins. At ClickDo, we do this operation manually. This gives us more control over the database. But, if you are looking forward for a quick solution and if you have no idea about how this is done, I suggest you to use WP-DB Manager WordPress plugin.
Once you install the plugin, you can follow on-screen instructions to perform the optimisation on your website built on WordPress CMS.
This might sound wired. But, this actually saves some milli seconds in loading time of your site. But, you will have a question how this will reduce TTFB?
Let’s assume your website has 20 concurrent visitors. If the first 10 visitors engage the server by requesting information, the later 10 users will face a delay in first byte response (TTFB). This creates Latency.
Hence, having the DNS Lookup’s prefetch in place, the server will communicate to the first 10 users with Prefetch DNS Data, so the server can handle the later 10 request without high resource usage. This comes handy in case on sites that has tonnes of live users on the site looking for various resources.
How to Fix DNS Lookups?
Fixing this DNS Lookup issue is not as simple as it sounds. You should first understand the target audience who actually performs these lookups based on Regions the users live. For instance, if the people who use your website / mobile app are in UK and if your server is also in UK, then this has the most minimal impact on your application.
But in most cases, people buy hosting form vendors in USA and will have the NS pointing to the USA based servers. Assuming the end customers are in Australia, the DNS look up time and TTFB dramatically increases and this causes latency. A good example is that, when you submit a contact form in a website and if it takes more than 2 seconds to respond, this is the issue.
You should be using a DNS Vendor like Google Cloud DNS to make sure your DNS is readily available across the globe with the most minimal (almost Zero) Latency. One such example is that when you open “Google.com”, it opens almost instantly without spending much time in DNS Lookups. This is because most of the Internet Service Providers (ISP’s) use Google DNS.
Hence, it acts as one of the major factor that influences SPEED of a website (or) a web application.
Usage of a CDN (Content Delivery Network)
Having a CDN to a website is more common in the recent days. But, the trick is on how we actually get the CDN setup with the CMS like WordPress. What files has to be cached and what shouldn’t be is the Key!
Assume, you have a WordPress website hosted on a VPS. Yeah, it will be super fast. But, having a CDN in place will make your website load even faster for your end customers. Having all the files hosted on the CDN actually makes the CDN to be more expensive. This will also make more-parallel connection towards the CDN.
The best way to utilize a CDN is to make sure that the Static resources (images, font, pdf, videos) to be hosted on CDN and the dynamic files (minified JS, CSS) to be hosted on the live server.
This will reduce the number of parallel connections to CDN as well as the server. Resulting in balanced usage of resourced and makes sure that the site is readily available to all concurrent end users.
Also, at ClickDo we strongly recommend you to use Google’s CDN (or) Amazon’s CDN. If you require professional help, let us know!
More to come up in the TTFB Series! Stay tuned! Cheers!