2014-09-03 133 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