Tags: #curl #performance #monitoring
# Run from the directory containing a curl-format.txt file (see below for file content)
curl -w "@curl-format.txt" -o /dev/null -s http://google.com/
# you don't have to use an external file
curl -w "%{time_starttransfer}\n" -o /dev/null -s http://google.com/
# you can use `ntimes` to try curl'ing endpoint multiple times
# go get github.com/yuya-takeyama/ntimes
ntimes 100 -- curl -w "%{time_starttransfer}\n" -o /dev/null -s http://google.com/
# now you can pipe results to the `percentile` command to figure out the various percentiles
# go get github.com/yuya-takeyama/percentile
ntimes 100 -- curl -w "%{time_starttransfer}\n" -o /dev/null -s http://google.com/ | percentile
# might be worth using `curl`'s --compressed option
\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