本帖最后由 jdgdf566 于 2013-07-02 14:16:48 编辑

解决方案 »

  1.   

    命令改为:/ab -c 5 -n 10 http://localhost/abtest.php
    未开启APC:
    Benching localhost (be patient).....done
    Server Software:        Apache/2.2.21
    Server Hostname:        localhost
    Server Port:            80Document Path:          abtest.php
    Document Length:        815 bytesConcurrency Level:      5
    Time taken for tests:   18.188 seconds
    Complete requests:      10
    Failed requests:        0
    Write errors:           0
    Total transferred:      10320 bytes
    HTML transferred:       8150 bytes
    Requests per second:    0.55 [#/sec] (mean)
    Time per request:       9093.750 [ms] (mean)
    Time per request:       1818.750 [ms] (mean, across all concurrent requests)
    Transfer rate:          0.55 [Kbytes/sec] receivedConnection Times (ms)
                  min  mean[+/-sd] median   max
    Connect:        0    0   0.5      1       1
    Processing:  9026 9065  48.1   9040    9155
    Waiting:     9026 9065  48.2   9039    9155
    Total:       9026 9066  48.1   9041    9156
    WARNING: The median and mean for the initial connection time are not within a no
    rmal deviation
            These results are probably not that reliable.Percentage of the requests served within a certain time (ms)
      50%   9041
      66%   9077
      75%   9104
      80%   9129
      90%   9156
      95%   9156
      98%   9156
      99%   9156
     100%   9156 (longest request)开启APC:
      

  2.   

    用于测试的文件abtest.php含有类的引入和实例化,无数据库连接。
    测试结果:
    APC开启和关闭,CPU的占用率都是100%,这意味着处理能力相同。而完成的时间如下:
    Time taken for tests:   11.464 seconds
    Time taken for tests:   29.521 seconds
    Time taken for tests:   10.361 seconds
    Time taken for tests:   28.444 seconds
    很明显,接近3倍。