指令
curl -o /dev/null -s -w "time_namelookup:%{time_namelookup}\ntime_connect: %{time_connect}\ntime_starttransfer: %{time_starttransfer}\ntime_total: %{time_total}\n" "http://xx.xx.xx.xx:31000/api/v1/query_range?query=up&start=1578292826&step=300&end=1578379226"
输出
time_namelookup:0.000
time_connect: 0.031
time_starttransfer: 34.066
time_total: 34.132
curl命令参数解析
curl 命令参数解释:
-o: 把curl 返回的html、js 写到垃圾回收站[ /dev/null]
-s: 去掉所有状态
-w: 按照后面的格式写出rt
time_namelookup: DNS 解析时间,从请求开始到 DNS 解析完毕所用时间,单位为秒,如果测试的地址为IP,这里耗时即为0
time_commect: client 和 server 端建立 TCP 连接的时间,连接时间,从开始到建立TCP连接完成所用时间,包括前边DNS解析时间,如果需要单纯的得到连接时间,用这个 time_connect 时间减去前边 time_namelookup 时间
time_starttransfer: 从 client 发出请求;到 web server 响应第一个字节的时间
time_total: client 发出请求;到 web server 发送回所有的相应数据的时间
http_code: http状态码,如200成功,301重定向,404资源未找到,500服务器错误等