« Linux ServerでVMWare Serverを使っている場合の注意( ・ω・)∩ | メイン | タバコ値上げ( ゚д゚) »

2006年6月27日

Apache2.2 で mod_mem_cacheを使ってみる( ・ω・)∩

Apache2.2 から mod_mem_cache というのがあって、昔の逆proxyなのだが、結構速くなるとかで試してみた。メモリも3.5GBとか積んでるマシンなので、256MBをキャッシュに割り当ててみました┐(´д`)┌
CPUをPentium4 3.2GHzに切り替えるよ...ケースもそのうち交換するぞ(゚Д゚ )

apache でコンパイル時に、取り込んでます。

コンパイル時のオプション
./configure \
--prefix=/usr/local/apache2.2 \
--with-mpm=worker \
--enable-so \
--enable-shared \
--enable-deflate=shared \
--enable-cache \
--enable-disk-cache \
--enable-mem-cache \
--disable-info \
--disable-status \
--disable-include \
--disable-rewrite \
--disable-imap \
--disable-ipv6

1回キャッシュするとかなり速いですね。
lighttpd+FastCGIも考えているが、結局のところ、外から繋いでどれだけ速いかだし。ルータも交換するぞ( ・ω・)∩

とりあえず設定です。httpd.confに追加。
< IfModule mod_cache.c >
< IfModule mod_mem_cache.c >
CacheEnable mem /
## CacheDisable /home/hoge ←キャッシュしたくないのはこれで追加。
MCacheSize 256000
## MCacheMaxObjectCount 3000 キャッシュの数の指定だけど今回は無し。
MCacheMinObjectSize 1
MCacheMaxObjectSize 128000
MCacheMaxStreamingBuffer 128000
< /IfModule >
< /IfModule >

abでベンチします。
☆mod_mem_cache 無し
[root@oscar2 conf]# /usr/local/apache2/bin/ab -n 100 -c 10 http://zephel.com/index.html
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 1997-2005 The Apache Software Foundation, http://www.apache.org/

Benchmarking zephel.com (be patient).....done


Server Software: Apache/2.2.2
Server Hostname: zephel.com
Server Port: 80

Document Path: /index.html
Document Length: 23144 bytes

Concurrency Level: 10
Time taken for tests: 1.146204 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Total transferred: 2347500 bytes
HTML transferred: 2314400 bytes
Requests per second: 87.24 [#/sec] (mean)
Time per request: 114.620 [ms] (mean)
Time per request: 11.462 [ms] (mean, across all concurrent requests)
Transfer rate: 1999.64 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 2 12.4 1 104
Processing: 2 104 132.7 16 464
Waiting: 0 100 133.5 7 462
Total: 2 106 132.3 16 464

Percentage of the requests served within a certain time (ms)
50% 16
66% 143
75% 218
80% 308
90% 322
95% 339
98% 363
99% 464
100% 464 (longest request)


☆mod_mem_cache有り
[root@oscar2 conf]# /usr/local/apache2/bin/ab -n 100 -c 10 http://zephel.com/index.html
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 1997-2005 The Apache Software Foundation, http://www.apache.org/

Benchmarking zephel.com (be patient).....done


Server Software: Apache/2.2.2
Server Hostname: zephel.com
Server Port: 80

Document Path: /index.html
Document Length: 23144 bytes

Concurrency Level: 10
Time taken for tests: 0.66763 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Total transferred: 2420603 bytes
HTML transferred: 2383832 bytes
Requests per second: 1497.84 [#/sec] (mean)
Time per request: 6.676 [ms] (mean)
Time per request: 0.668 [ms] (mean, across all concurrent requests)
Transfer rate: 35393.86 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.9 0 3
Processing: 1 5 2.1 5 11
Waiting: 0 2 1.7 2 8
Total: 1 5 2.2 5 11

Percentage of the requests served within a certain time (ms)
50% 5
66% 6
75% 7
80% 7
90% 9
95% 9
98% 11
99% 11
100% 11 (longest request)

設定の参考
http://httpd.apache.org/docs/2.2/ja/mod/mod_mem_cache.html

投稿者 hideki : 2006年6月27日 00:13

トラックバック

このエントリーのトラックバックURL:
http://zephel.com/hideki/cgi-bin/mt/mt-tb.fcgi/258

コメント

コメントしてください




保存しますか?