Post

linux curl request stats

linux curl request stats

I use this when I need a quick performance baseline for an endpoint — how long DNS takes, how long the connection takes, how long to first byte. The format file approach gives you a clean breakdown of each phase, which is far more useful than just watching the total time.

  • Specify response format in file
1
2
3
4
5
6
7
8
9
10
11

$ vi responseFormat

     time_namelookup:  %{time_namelookup}s\n
        time_connect:  %{time_connect}s\n
     time_appconnect:  %{time_appconnect}s\n
    time_pretransfer:  %{time_pretransfer}s\n
       time_redirect:  %{time_redirect}s\n
  time_starttransfer:  %{time_starttransfer}s\n
                     ----------\n
          time_total:  %{time_total}s\n
  • Make request
1
$  curl -w "@responseFormat" -o /dev/null -s "https://www.google.com/"

Source

This post is licensed under CC BY 4.0 by the author.