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.528

Looks 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.268

The second data is time when the first byte was received, Time To First Byte (TTFB).
TTFB: 1.528

The last data is the total time for the site to finish loading.
Total time: 1.528

You 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/

Related Posts

1 Comment to “Capture Time To First Byte using curl”

  • PhilippineBloggers May 9, 2009 at 7:04 pm

    trying this out mamaya
    Mabuhay ang Open source sa ‘Pinas!
    – Featured your blog at PhilippineBloggers.blogspot.com

    PhilippineBloggers´s last blog post is (Technology Blog) PinoyTux

Post comment

CommentLuv Enabled

Powered by 1and1.comDomain Registrations starting at $9.98* Earn with Your BlogAdvertise @ PinoyTux

Search PinoyTux

Subscribe to Email Feeds

Enter Email Address:

Blog Lounge

Popular Posts

Recent Posts

Recent Comments

Site Stats