From: http://www.pinoytux.com/linux/capture-time-to-first-byte-using-curl
Working with websites is equivalent to non-ending website testing. Checking the speed of the site itself is not a new thing to check when doing performance diagnostics. And I found out that curl can calculate the speed of a website, from the initial connection time, to the time the first byte is downloaded, up to the total time the site has finished loading.
Here is a sample command using curl:
curl -o /dev/null -w “Connect: %{time_connect} TTFB: %{time_starttransfer} Total time: %{time_total} \n” http://inserturl.here
This command will output this:
[root@rai01 ~]# curl -o /dev/null -w “Connect: %{time_connect} TTFB: %{time_starttransfer} Total time: %{time_total} \n” http://pinoytux.com
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 –:–:– 0:00:01 –:–:– 0
Connect: 0.268 TTFB: 1.528 Total time: 1.528Looks like my website is fast 🙂
The first data is the Connect time, which means this is how long it took for the curl to connect to the website.
Connect: 0.268The second data is time when the first byte was received, Time To First Byte (TTFB).
TTFB: 1.528The last data is the total time for the site to finish loading.
Total time: 1.528You can also turn off the progress bar by adding the -s switch to the command.
From: http://www.unquietdesperation.com/2009/03/19/time-to-first-byte-with-curl/
发表回复