In this article on Time To First Byte (TTFB), we have explained the relationship with good host, latency, CDN and how to know TTFB with cURL. Usually uneducated peoples who were last benchers in school found SEO is a way make quick money. Most has not a single masters’ degree on science. Practically the things are logical. Rocket science is nothing but Newton’s Law! Time To First Byte (TTFB) is mostly theoretical, it is usually higher for any CMS, blogging software including WordPress without tweaking. It is near impossible to measure using another server – except some command line tools, invariably it will show falsely higher or lower value.
Time To First Byte (TTFB) : Basics
For example, you using a cache plugin in WordPress, compressing to almost kill your server, it will definitely deliver a compressed HTML page with lower Time To First Byte (TTFB), but there is no warranty that a person living opposite the globe is not receiving a blank white page – quite common with PHP-MySQL based softwares. Time To First Byte (TTFB) has nothing to do with SERP. Google calculates the total rendering time. It is practically near impossible to get a Time To First Byte (TTFB) lesser than 100ms from geographically located place which is exactly residing opposite to the main server’s data center – thats too assuming a setup with all dedicated hardware and networking tools. If you test a plaintext’s URL, technically it will be the least possible Time To First Byte (TTFB) for your setup. This is for the MIME Type. For streaming media specific CDNs, the Edge Servers are optimized differently for delivering iOS specific stuffs. None possibly uses a text file for the whole website. HTML is the practical type.
As the process to GET a webpage is not one way, but our browsers, Internet Connection Speed, ISP – all matters like in a typical client server model, we can list these factors behind Time To First Byte (TTFB) :
---
Client Factors :
- DNS Lookup Time (again is dependent on many parameters)
- Initial Connection Time (dependent on many parameters)
- Opening connection (dependent on many parameters)
- Receipt of Data and recheck
- Closing the connection
Server and Host Factors (Hardware) :
- Disk IO
- Swap and RAM
- Networking
Server and Host Factors (Software) :
- Web server software configuration
- Dynamic language like PHP or other language’s settings
- Application server and software’s (Like MySQL) settings
- Operating system settings
Server and Host Factors (Front-end Software) :
- WordPress rendered page will take more time to load than a plain PHP file
- WordPress rendered page without cache will take more time to load than a WordPress rendered page with cache
- WordPress rendered page without CDN will take more time to load than a WordPress rendered page with CDN
There is no technology yet to deliver an Apache or Ngnix rendered PHP pages from geographically distributed way – CDN can only serve the static contents. Loadbalancers are used to fight with this issue. Unfortunately, if you deliver embedded images from CDN, there will be loss in terms of SEO. Google Images supply a good number of visitors without much effort and there is no Advert unlike Web search result. So, CDN is practical only for Javascripts, Theme images, CSS files etc.
Any good web host – be it Amazon, Rackspace or HP – all will give an acceptable Time To First Byte (TTFB). All bigger brands uses Akamai – that is Rackspace Cloud Files for us, we only need to test the WordPress default license.txt file and another set of pages with variable number of embedded images. You have to test from another server on the same data center and from your location. Do not consider Time To First Byte (TTFB) too seriously, it is better to consider the total page loading time. With TLS certificate, on HTTPS URLs, Time To First Byte (TTFB) will become higher. If you test naked IP, Time To First Byte (TTFB) will be lower. Low TTFB on a site with useful for servers under heavy traffic loads.
Time To First Byte (TTFB) : Test With cURL
Everyone knows what is cURL. Except Microsoft Windows, cURL is usually installed by default. Windows users need to follow this guide to install cURL in Windows to run cURL commands.
You can run command in this format :
1 | curl -o /dev/null -w "Connect: %{time_connect} TTFB: %{time_starttransfer} Total time: %{time_total} \n" https://thecustomizewindows.com/license.txt |
You will get return like this :
1 2 3 4 | % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 19930 100 19930 0 0 6799 0 0:00:02 0:00:02 --:--:-- 6797 Connect: 1.010 TTFB: 2.551 Total time: 2.931 |
Another method is described by Joseph Scott, first you need to write a text in cURL format :
1 2 3 4 5 6 7 8 9 10 | n time_namelookup: %{time_namelookup}n time_connect: %{time_connect}n time_appconnect: %{time_appconnect}n time_pretransfer: %{time_pretransfer}n time_redirect: %{time_redirect}n time_starttransfer: %{time_starttransfer}n ----------n time_total: %{time_total}n n |
If we give this file a name like ttfb.txt, then the set of commands on *nix system will be :
1 2 3 4 5 | nano ttfb.txt # paste the content under the sentence # "first you need to write a text in cURL format" # take that it is $HOME folder curl -w "@ttfb.txt" -o /dev/null -s https://thecustomizewindows.com/license.txt |
On OS X, omit all the n
. They are not required for Apple’s UNIX. The last way is to use a bash script to somewhat automate cURL command set :
Webpagetest? It can be misleading because it is a heavy software than native cURL.
Tagged With windows 10 curl time for fisrt byte