It is Possible To Reduce Time To First Byte (TTFB), regardless of the web software or cms like WordPress, Joomla, Magento etc. used to create and maintain content on Cloud Server if You Know Which Components Determines This Time To First Byte (TTFB). Previously, we have discussed about Time To First Byte (TTFB). Some more information Here.
Know What Determines The Value Before Trying To Reduce Time To First Byte (TTFB) on Cloud Server
If your Time To First Byte (TTFB) is 15000 ms, you can not expect the page to rank first on Google’s SERP. There are lot hypothesis are given that Time To First Byte (TTFB) has no impact, but actually all the good websites have very low TTFB. There are meaningless conversations like :
1 | https://wordpress.org/support/topic/how-to-reduce-time-to-first-byte-on-my-wordpress-site |
8.5 Second is only the Time To First Byte (TTFB). If you test Facebook, Google, Twitter etc. website’s almost always the TTFB is very low – lower than ours (median 350 ms), hardly half of our value. Where we have the wrongs or rather what are the determining factors which can significantly reduce Time To First Byte (TTFB) on Cloud Server?. We are talking in the context of HTTP 2.0, SPDY (pronounced as speedy and CORS. If you open this webpage on slow bandwidth, older operating system, browser not supporting HTTPS Preloading, text will appear first but with 1 mbps connection with Chrome, it will appear as if instantaneously. That is what dependent on Cipher Suite. On cloud platform, other than we discussed before, three are determining factors :
---
- Time to process the request through the network to the front end web server – so, front end server must have shiny SSD disks, good networking. That is what Rackspace marks as Performance 1, 2, 3 and PVHVM.
- Backend process to generate the response, which practically can be reduced by various types of caching.
- Time taken for the response to get back to your browser, which is again to some extent part of point 1.
We performed a test with under powered one server setup against this website :
1 | http://scans.zoompf.com/s/5b44f0e874f7fb36c19666c6742b493a/report.html |
Softwares used were same. But the rating went very poor. Underpowered means, it was Rackspace Performance 1 one 2 GB PVHVM Ubuntu server with Nginx, WordPress and W3TC. With a weak for the purpose server can not give the right response – it will tend to hang. There are measurements of this aspect (we discussed them before). Horizontal scaling can solve this issue and decrease the TTFB to quite lower value, after a point, it will not get reduced, you need to use your own formula or someone else’s formula, like Facebook uses this :
1 | https://github.com/facebook/hhvm/wiki |
So, the work starts at the level of Virtualization.
Practical Way to Reduce Time To First Byte (TTFB) on Cloud Server
It is not possible for everyone to have an excellent backend, however with WordPress like PHP-MySQL based web softwares, these are good practice :
- Use at minimum 2 servers – one application server and one web server
- Web server can have the content on a faster disk for better I/O
- If point 2 is followed, the application server with InnoDB engine can cache database requests on Web Server. It avoids the direct load on application server.
- Nginx for sure performs better for SPDY
- Use LuaJIT to configure Nginx. This webpage loaded asynchronously (not deferred)
- The proper arrangement of DOM elements matter much
- Forget about adding Google Plus One, Facebook Like, Pinterest Buttons
- W3 Total Cache only a practical Cache for Nginx
- As Caching takes time and when we Publish our Posts, all are flushed, may be it is better to use multiple WordPress instances – it is quite frequently done for the larger websites. Old webpages do not require to be flushed so often, 4-6 hourly.
- WordPress plugin’s logical conflict can increase the TTFB. It happens in the blocks where we can not Cache – be it fragment cache, XCache or simple W3TC’s methods like for Ad blocks.
- If Ad Server matches your web server configuration closely, it will not affect the TTFB. Google Ads serves the Ads in full asynchronous way.
- CDN is important, but sometimes some content needs to be served from own server like Icon Fonts.
- You can not have the same TTFB worldwide, Geotarget your visitors.
- Forum, ideally should not hosted on the same server.
- Backend optimization is most important for TTFB. A Grade A host will optimize for you.
- If you run server on your GNU Linux machine or Mac and test with your tools on the same machine, TTFB will be lower. Now imagine the cables are running under the oceans. If this website was for Kolkata, West Bengal; we had to load balance and logically serve a subdomain like `ww2.thecustomizewindows.com’ from London Datacenter.
- TTFB is important for Commercial websites, old method of load balancing per region should be done.