最近遇到了需要在服务器上测试第三方api响应时间的需求。那么,怎么测呢?
curl安排上。
curl -w "dnslookup: %{time_namelookup} | connect: %{time_connect} | appconnect: %{time_appconnect} | pretransfer: %{time_pretransfer} | starttransfer: %{time_starttransfer} | total: %{time_total} | size: %{size_download}| redirect: %{time_redirect}"
比如: curl --location --request GET "https://www.tmall.com" -s -w %{http_code}:%{time_total}:%{speed_download}:%{time_namelookup}:%{time_redirect}:%{time_pretransfer}:%{time_appconnect}:%{time_starttransfer}:%{size_download}
那么,每个参数是什么意思呢,如下:
time_appconnect - The time, in seconds, it took from the start until the SSL/SSH/etc connect/handshake to the remote host was completed.
time_connect - The time, in seconds, it took from the start until the TCP connect to the remote host (or proxy) was completed.
time_namelookup - The time, in seconds, it t