Summary
mod_cache + mod_disk_cache を利用した apache2 のパフォーマンス改善とその効果 [2006-02-28-6] では,mod_disk_cache の使用前後を比較し,その効果は証明されたが,以下のエラーが発生するようになった.
Directory index forbidden by rule: /path/to/public_html/foo/
今度は,mod_cache + mod_mem_cache を利用することにした.
/etc/apache2/mods-available/mem_cache.conf
MCacheSize は kByte単位.<IfModule mod_cache.c>
<IfModule mod_mem_cache.c>
CacheEnable mem /
MCacheSize 4096
MCacheMaxObjectCount 100
MCacheMinObjectSize 1
MCacheMaxObjectSize 2048
</IfModule>
</IfModule>
mod_cache と mod_mem_cache の有効化
# a2enmod cache
# a2enmod mem_cache
# apache2ctl configtest
# apache2ctl restart
mod_cache + mod_mem_cache 使用後のベンチマーク (ApacheBench を利用)
mod_cache + mod_mem_cache 使用後 (HTMLへのアクセス)% ab -n 100 -c 10 http://xight.org/test/static
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.4502 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/
Benchmarking xight.org (be patient).....done
Server Software: Apache
Server Hostname: xight.org
Server Port: 80
Document Path: /test/static
Document Length: 119 bytes
Concurrency Level: 10
Time taken for tests: 2.615437 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Total transferred: 43800 bytes
HTML transferred: 11900 bytes
Requests per second: 38.23 [#/sec] (mean)
Time per request: 261.544 [ms] (mean)
Time per request: 26.154 [ms] (mean, across all concurrent requests)
Transfer rate: 16.06 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 10 25 9.7 26 60
Processing: 36 224 44.5 230 304
Waiting: 26 136 65.5 136 269
Total: 62 250 44.8 259 333
Percentage of the requests served within a certain time (ms)
50% 259
66% 265
75% 267
80% 271
90% 291
95% 311
98% 325
99% 333
100% 333 (longest request)
mod_cache + mod_mem_cache 使用後 (PHPへのアクセス)
% ab -n 100 -c 10 http://xight.org/test/dynamic
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.4502 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/
Benchmarking xight.org (be patient).....done
Server Software: Apache
Server Hostname: xight.org
Server Port: 80
Document Path: /test/dynamic
Document Length: 1011 bytes
Concurrency Level: 10
Time taken for tests: 2.532703 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Total transferred: 125500 bytes
HTML transferred: 101100 bytes
Requests per second: 39.48 [#/sec] (mean)
Time per request: 253.270 [ms] (mean)
Time per request: 25.327 [ms] (mean, across all concurrent requests)
Transfer rate: 48.17 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 10 24 5.9 24 38
Processing: 36 216 43.1 223 271
Waiting: 33 134 61.2 136 267
Total: 60 241 43.9 247 303
Percentage of the requests served within a certain time (ms)
50% 247
66% 253
75% 263
80% 263
90% 279
95% 291
98% 295
99% 303
100% 303 (longest request)