Riaan's SysAdmin Blog

My tips, howtos, gotchas, snippets and stuff. Use at your own risk!

Curl

Service Response Time

There are several ways to get this done but I found using curl gives a good quick test of how long a web response was. You can use a formatted text file or just command line.

Command line can be something like this:

# curl -w "\ntime_namelookup:\t%{time_namelookup}\ntime_connect:\t\t%{time_connect}\ntime_appconnect:\t%{time_appconnect}\ntime_pretransfer:\t%{time_pretransfer}\ntime_redirect:\t\t%{time_redirect}\ntime_starttransfer:\t%{time_starttransfer}\n----------\ntime_total:\t\t%{time_total}\n" -o /dev/null -s https://www.wormly.com
 
time_namelookup:        0.366
time_connect:           0.367
time_appconnect:        0.402
time_pretransfer:       0.402
time_redirect:          0.000
time_starttransfer:     0.408
----------
time_total:             0.408

Or using a text file for formatting:

# curl -w "@curl-format.txt" -o /dev/null -s https://www.wormly.com

            time_namelookup:  0.127
               time_connect:  0.128
            time_appconnect:  0.142
           time_pretransfer:  0.142
              time_redirect:  0.000
         time_starttransfer:  0.150
                            ----------
                 time_total:  0.151

Text file like this:

# cat curl-format.txt 
\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

admin

Bio Info for Riaan