Troubleshooting High TTFB Using curl

Time To First Byte (TTFB) is a metric that depends on many variables but curl could give some insides to start troubleshooting. It is always better to run the test also locally within the server that hosts the website.

curl -s -w '\nLookup time:\t\t%{time_namelookup}\nConnect time:\t\t%{time_connect}\nSSL handshake time:\t%{time_appconnect}\nPre-Transfer time:\t%{time_pretransfer}\nRedirect time:\t\t%{time_redirect}\nTime to first byte:\t%{time_starttransfer}\n\nTotal time:\t\t%{time_total}\n' -o /dev/null https://w

Example output:

Lookup time:            0.032284
Connect time:           0.091980
SSL handshake time:     0.165990
Pre-Transfer time:      0.166032
Redirect time:          0.000000
Time to first byte:     0.265635
Total time:             0.282067