我正在尝试调试一些网络问题,我想追踪不同事件的响应时间。例如,连接到服务器所需的时间与服务器呈现页面所需的时间(所以time wget ...
行不通)
我一直在使用 wget
$ wget --spider www.google.com
Spider mode enabled. Check if remote file exists.
--2013-11-22 13:56:10-- http://www.google.com/
Resolving www.google.com... 74.125.224.52, 74.125.224.49, 74.125.224.48, ...
Connecting to www.google.com|74.125.224.52|:80... connected. <-- Time here
HTTP request sent, awaiting response... 200 OK <-- Time here
Length: unspecified [text/html]
Remote file exists and could contain further links,
but recursion is disabled -- not retrieving.
有没有办法为各种请求添加时间戳?
答案1
ab
从包中尝试apache2-utils
。它会告诉您连接、处理和等待时间:
$ ab http://www.yahoo.com/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking www.yahoo.com (be patient).....done
Server Software: YTS/1.20.13
Server Hostname: www.yahoo.com
Server Port: 80
Document Path: /
Document Length: 82 bytes
Concurrency Level: 1
Time taken for tests: 0.066 seconds
Complete requests: 1
Failed requests: 0
Write errors: 0
Non-2xx responses: 1
Total transferred: 1217 bytes
HTML transferred: 82 bytes
Requests per second: 15.20 [#/sec] (mean)
Time per request: 65.796 [ms] (mean)
Time per request: 65.796 [ms] (mean, across all concurrent requests)
Transfer rate: 18.06 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 1 1 0.0 1 1
Processing: 65 65 0.0 65 65
Waiting: 62 62 0.0 62 62
Total: 66 66 0.0 66 66