I had again the need to calculate proxy performance.
So a few notes on this topic.
Time to First Byte Using Curl
Jon Fox published an post how to find the time to first byte (TTFB) with curl.
curl -w "Connect time: %{time_connect} Time to first byte: %{time_starttransfer} Total time: %{time_total} \n" -o /dev/null [url to test]
Joseph Scott extended this in his port. https://blog.josephscott.org/2011/10/14/timing-details-with-curl/
- Time to First Byte Using Curl
- Create the file curl-format.txt with this content
- Make a request
- A stand-alone script
- Links
Create the file curl-format.txt with this content
content_type: %{content_type}\n
http_code: %{http_code} \n
http_connect: %{http_connect} \n
num_connects: %{num_connects} \n
num_redirects: %{num_redirects} \n
\n
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 a request
curl -w "@curl-format.txt" -o /dev/null -s "https://pp52.de/"
A stand-alone script
#!/bin/bash
curl -w @- -o /dev/null -s "$@" <<'EOF'
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
EOF
Links
- https://www.jonefox.com/blog/2011/10/10/find-the-time-to-first-byte-using-curl/
- https://blog.josephscott.org/2011/10/14/timing-details-with-curl/
- https://ajanthan-eliyathamby.medium.com/calculating-the-request-and-response-time-with-the-curl-command-e71ec8f2b547
- https://stackoverflow.com/questions/18215389/how-do-i-measure-request-and-response-times-at-once-using-curl

