- A+
所属分类:Linux
获取站点的各类响应时间,可以去看看前面写的文章。
对curl时间变量的格式化输出。
定义格式化文件
1 2 3 4 5 6 7 8 9 10 11 |
#vim curl-format.txt \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 |
这些变量的含义不解释了,大伙去看看curl帮助文档。重点说下time_connect和time_appconnect变量。time_connect 变量表示 TCP 握手的耗时,time_appconnect 变量表示 SSL 握手的耗时(ssl延时)。HTTPs 连接耗时要比 HTTP 连接耗时长 3 倍左右,具体取决于 CPU 的快慢。
发送请求
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# curl -w "@curl-format.txt" -o /dev/null -s http://www.baidu.com time_namelookup: 0.002 time_connect: 1.973 time_appconnect: 0.000 time_pretransfer: 1.973 time_redirect: 0.000 time_starttransfer: 3.126 ---------- time_total: 5.374 # curl -w "@curl-format.txt" -o /dev/null -s https://www.baidu.com time_namelookup: 0.003 time_connect: 1.705 time_appconnect: 4.007 time_pretransfer: 4.007 time_redirect: 0.000 time_starttransfer: 5.214 ---------- time_total: 5.214 |
-w 指定格式化文件
-o 请求重定向到

微信公众号
扫一扫关注运维生存时间公众号,获取最新技术文章~
07/07/2015 下午 5:08 沙发
不错,学习了。
06/07/2015 下午 1:09 板凳
很实用