This is ApacheBench, Version 2.3 <$Revision: 1757674 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking www.google.com (be patient).....done
Server Software: gws
Server Hostname: www.google.com
Server Port: 80
Document Path: /
Document Length: 12419 bytes
Concurrency Level: 1
Time taken for tests: 10.700 seconds
Complete requests: 100
Failed requests: 97
(Connect: 0, Receive: 0, Length: 97, Exceptions: 0)
Total transferred: 1331107 bytes
HTML transferred: 1268293 bytes
Requests per second: 9.35 [#/sec] (mean)
Time per request: 107.004 [ms] (mean)
Time per request: 107.004 [ms] (mean, across all concurrent requests)
Transfer rate: 121.48 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 20 22 0.8 22 26
Processing: 59 85 108.7 68 911
Waiting: 59 85 108.7 67 910
Total: 80 107 108.8 90 932
Percentage of the requests served within a certain time (ms)
50% 90
66% 91
75% 93
80% 95
90% 105
95% 111
98% 773
99% 932
100% 932 (longest request)
10 回答
这是一个重复击中同一台服务器的Bash单行程序:
嘿比Apache Bench更好,SSL的问题更少
另一个可能是命令行中最简单的选项是添加内置的
--trace-time
选项:即使它在技术上不输出OP请求的各个步骤的时序,它也会显示请求的所有步骤的时间戳,如下所示 . 使用它,您可以(相当容易地)计算每个步骤花费的时间 .
您可以根据此处的其他答案添加到.bashrc等的快捷方式:
用法:
这是答案:
与
-w
一起使用的所有变量都可以在man curl
中找到 .Option 1. 要使用curl测量响应时间,请使用以下命令:
样本输出:
Option 2. 要获取更多详细信息,请使用以下命令:
样本输出:
参考:Get response time with curl
来自这篇精彩的博文... https://blog.josephscott.org/2011/10/14/timing-details-with-curl/
cURL支持格式化输出以获取请求的详细信息(请参阅the cURL manpage for details,在
-w, –write-out <format>
下) . 出于我们的目的,我们将仅关注所提供的时序细节 .或者在Windows上,它是......
这是做什么的:
-w "@curl-format.txt"
告诉cURL使用我们的格式文件-o /dev/null
将请求的输出重定向到/ dev / null-s
告诉cURL不要显示进度表"http://wordpress.com/"
是我们要求的网址 . 如果您的URL具有"&"查询字符串参数,请使用引号这是你得到的:
制作Windows快捷方式(又名BAT文件)
将此命令放在CURLTIME.BAT中(与curl.exe位于同一文件夹中)
然后你可以简单地打电话......
以下内容的灵感来自Simon 's answer. It' s自包含(不需要单独的格式文件),这使其非常适合包含在
.bashrc
中 .此外,它应该适用于
curl
通常需要的所有参数,因为"$@"
只是通过它们 . 例如,你可以这样做:输出:
如果您想分析或总结延迟,可以尝试使用apache bench:
例如:
它将显示:
我做了一个友好的格式化程序来嗅探curl请求以帮助调试(参见使用注释) . 它包含您可以用易于阅读的格式写出的每个已知输出参数 .
https://gist.github.com/manifestinteractive/ce8dec10dcb4725b8513