我们可以使用"curl"命令我们可以查看服务器响应时长

语法:curl [选项] 访问地址

选项:

  -o <文件路径>        将获取的页面内容输出到一个文件中

  -s                   安静模式,不输出任何东西    

  -w <格式>            响应完成后输出信息,指定要输出信息的格式:

                             %{time_namelookup}        解析域名所花费的时间,单位为秒(s)

                             %{time_connect}           建立TCP连接所花费的时间,单位为秒(s)

                             %{time_starttransfer}     请求页面,服务器开始响应,传输的第一个字节的

                                                       数据所花费的时间,单位为秒(s)

                             %{time_total}             服务器响应完成,全部响应数据传输完成所花费的

                                                       时间,单位为秒(s)

                             %{speed_download}         在请求响应过程中,客户端主机下载速度,单位为

                                                       字节(Byte)

[root@localhost ~]# curl -o /tmp/access.tmp -s -w name_resolve_time\ \ :%{time_namelookup}\(s\)"\n"TCP_connect_time\ \ \ :%{time_connect}\(s\)"\n"start_response_time:%{time_starttransfer}\(s\)"\n"total_response_time:%{time_total}\(s\)"\n"download_speed\ \ \ \ \ :%{speed_download}\(Byte\)"\n" "http://www.baidu.com"

name_resolve_time  :0.014(s)

TCP_connect_time   :0.020(s)

start_response_time:0.029(s)

total_response_time:0.029(s)

download_speed     :81767.000(Byte)