2014-09-03 132 views
0

选项在AB Linux命令为基准在 http://linux.die.net/man/1/ab描述的NodeJS并发进程基准,Linux命令AB对

-n数目的并发

的请求 -c数目例如命令来获得统计量结果在请求index.html的(文件大小= 5937个字节)

ab -n 1000 -c 1000 http://localhost:8000/ and show the output as follows 

我的问题是命令执行1000个并发进程从获得的index.html在1000倍e nodejs在相同的开始时间处理对吗?为什么我需要指定-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

-n是总共需要多少个请求。 -c是多少请求同时进行。如果-c小于-n,则不是所有请求都会立即完成。例如:

-n 1000 -c 100会立即发出100个请求。当一个请求完成时,另一个请求将被启动,直到发送了1000个请求。

+0

所以你的意思是1000 * 1000的进程请求在同一时间启动? – aabb 2014-09-03 12:18:46

+0

什么是不同的(-n 10 -c 1000)和(-n 1000 -c 1000)相同-c? – aabb 2014-09-03 12:19:32

+0

不停止思考同时请求。 'ab'并不总是同时提出所有请求。 – 2014-09-03 12:19:54