LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1411|回复: 1

apache2.2 mod_cache 貌似无效

[复制链接]
发表于 2009-10-12 21:45:26 | 显示全部楼层 |阅读模式
我原来用的是Apache2 ,开启了mod_cache,mod_mem_cache效果很好
最近看到Apache的官方文档上说Apache2.2版本中mod_cache已经是个可靠的稳定版,于是想将Apache2更换为2.2,但是配置完毕后,发现,缓冲内容并没有效果。

具体如下:

我的配置:
<IfModule mod_cache.c>
    LoadModule mem_cache_module modules/mod_mem_cache.so
    <IfModule mod_mem_cache.c>
        CacheEnable mem /
        MCacheSize 1024000
        MCacheMaxObjectCount 4096
        MCacheMinObjectSize 1
        MCacheMaxObjectSize 4096000
    </IfModule>
</IfModule>

用ab作压力测试:

在未开启缓存时:
===================================
ab -n 1000 http://www.peter.com:8080/aa.tar.gz
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking www.peter.com (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests


Server Software:        Apache/2.2.13
Server Hostname:        www.peter.com
Server Port:            8080

Document Path:          /aa.tar.gz
Document Length:        9412280 bytes

Concurrency Level:      1
Time taken for tests:   13.054 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      9412548000 bytes
HTML transferred:       9412280000 bytes
Requests per second:    76.61 [#/sec] (mean)
Time per request:       13.054 [ms] (mean)
Time per request:       13.054 [ms] (mean, across all concurrent requests)
Transfer rate:          704164.54 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       1
Processing:    12   13   3.8     12      60
Waiting:        0    0   0.0      0       1
Total:         12   13   3.8     12      60

Percentage of the requests served within a certain time (ms)
  50%     12
  66%     12
  75%     12
  80%     12
  90%     14
  95%     14
  98%     27
  99%     37
100%     60 (longest request)
=============================
开启缓存时:
ab -n 1000 http://www.peter.com:8080/aa.tar.gz
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking www.peter.com (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests


Server Software:        Apache/2.2.13
Server Hostname:        www.peter.com
Server Port:            8080

Document Path:          /aa.tar.gz
Document Length:        9412280 bytes

Concurrency Level:      1
Time taken for tests:   30.101 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      9412556611 bytes
HTML transferred:       9412280000 bytes
Requests per second:    33.22 [#/sec] (mean)
Time per request:       30.101 [ms] (mean)
Time per request:       30.101 [ms] (mean, across all concurrent requests)
Transfer rate:          305370.62 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       1
Processing:    22   29   6.8     27     108
Waiting:        0    0   3.7      0      73
Total:         22   29   6.8     27     108

Percentage of the requests served within a certain time (ms)
  50%     27
  66%     27
  75%     28
  80%     28
  90%     37
  95%     44
  98%     47
  99%     57
100%    108 (longest request)
================================
同时我通过系统检测发现,开启缓存时,httpd占用内存有所增长(是否意味着内容被缓存了),同时磁盘IO数量居高不下(是否意味着缓存未命中,或缓存反复失效?)
================================
我的问题是,为什么同样的配置方式在apache2 下就可以,在Apache2.2中就不可以?是不是我哪里配错?我应该从哪些地方入手查找问题?

谢谢指教,不胜感激。
 楼主| 发表于 2009-10-13 09:10:51 | 显示全部楼层
昨天贴的配置文件有个参数更正一下:
<IfModule mod_cache.c>
LoadModule mem_cache_module modules/mod_mem_cache.so
<IfModule mod_mem_cache.c>
CacheEnable mem /
MCacheSize 1024000
MCacheMaxObjectCount 4096
MCacheMinObjectSize 1
MCacheMaxObjectSize 9192000
</IfModule>
</IfModule>
更正的地方是
MCacheMaxObjectSize 9192000
比aa.tar.gz大
缓存依然无效。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表