用于基准测试的ab linux命令的选项描述于 http://linux.die.net/man/1/ab,
-n请求数量 -c并发数
例如命令获取请求index.html(文件大小= 5937字节)
的统计结果 ab -n 1000 -c 1000 http://localhost:8000/ and show the output as follows
我的问题是命令执行1000并发进程,以便在同一个启动时间从一个nodejs进程获得1000次index.html对吗?为什么我需要指定-n 1000?如何用-n 1000和-c 1000一起描述命令?我相信-n选项仅针对一个进程请求的先前请求失败的请求重试次数设置。对吗?
The command output on apache Centos
==================================
Server Hostname: localhost
Server Port: 8000
Document Path: /
Document Length: 5937 bytes
Concurrency Level: 1000
Time taken for tests: 0.725 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 6052000 bytes
HTML transferred: 5937000 bytes
Requests per second: 1378.45 [#/sec] (mean)
Time per request: 725.455 [ms] (mean)
Time per request: 0.725 [ms] (mean, across all concurrent requests)
Transfer rate: 8146.83 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 21 30.0 0 83
Processing: 25 135 74.2 94 286
Waiting: 24 135 74.2 93 286
Total: 54 156 80.3 131 351
Percentage of the requests served within a certain time (ms)
50% 131
66% 227
75% 238
80% 242
90% 257
95% 266
98% 269
99% 272
100% 351 (longest request)
答案 0 :(得分:0)
-n
总共有多少请求。 -c
是同时发出的请求数量。如果-c
小于-n
,那么并非所有请求都会立即完成。例如:
-n 1000 -c 100
会立即发出100个请求。当一个请求完成时,另一个请求将被启动,直到发送了1000个请求。