昨日、mod_perlを入れてから、様々操作してApacheのパフォーマンスを見てみた。
それで、今更ながら気づいたことがある。
現サーバ上のアプリケーションでPerlを使っているもので、処理負荷の重いものから挙げると、
- MovableType 4.12
- Webalizer 2.01
- SpamAssassin
- ClamAntiVirus
こんなラインナップとなる。
この中で、webの動的ページ出力に絡んでいるのはMovableTypeしかない(^^;
topコマンドで見ていると、MovableTypeはhttpdと別に、Perlの外部プロセスを起動してブログ作成・変更処理を行っている。
・・・と、いうことは、
mod_perl、使われてないじゃん。〜( ̄∇ ̄;)〜
・・・・・
反面、たまに使う自作CGIによる蔵書データベースは、「もう充分でございます」という位高パフォーマンスになった。
正に瞬殺(別に殺してる訳じゃないが)。
MySQLのチューンはまだなのに、mod_perlの威力がこんな所でダケ効いている。
こんなではバランスとれてないでしょー・・・。
どうやら、昨日のチューニングで多少良くなったのは、予備プロセスの調整による効果みたいだ。
ではどうしましょ。
ほとんどが静的ページなので、やはり、こちらのパフォーマンスを優先するのが王道だろう。
mod_perlは外そう。
で、起動時子プロセスを2から4に増やす。
これでいってみよう。
ちなみに、Apache子プロセスのメモリ(実+仮想)使用量は、
- mod_perl有: 約12Mバイト
- mod_perl無: 約10Mバイト
1./usr/local/etc/apache22/httpd.confの編集(差分)
--- ./httpd.conf.20080713_old 2008-07-12 12:57:25.000000000 +0900
+++ ./httpd.conf 2008-07-13 07:58:43.000000000 +0900
@@ -100,7 +100,7 @@
LoadModule alias_module libexec/apache22/mod_alias.so
LoadModule rewrite_module libexec/apache22/mod_rewrite.so
LoadModule php4_module libexec/apache22/libphp4.so
-LoadModule perl_module libexec/apache22/mod_perl.so
+#LoadModule perl_module libexec/apache22/mod_perl.so
2./usr/local/etc/apache22/extra/httpd-default.confの編集(差分ファイルの内容)
--- ./httpd-default.conf.20080713_old 2008-07-12 20:51:17.000000000 +0900
+++ ./httpd-default.conf 2008-07-13 08:53:52.000000000 +0900
@@ -20,13 +20,13 @@
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
-MaxKeepAliveRequests 40
+MaxKeepAliveRequests 30
#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
-KeepAliveTimeout 7
+KeepAliveTimeout 8
3./usr/local/etc/apache22/extra/httpd-mpm.confの編集(差分ファイルの内容)
--- ./httpd-mpm.conf.20080713_old 2008-07-12 20:45:31.000000000 +0900
+++ ./httpd-mpm.conf 2008-07-13 08:19:18.000000000 +0900
@@ -34,11 +34,11 @@
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
- StartServers 2
+ StartServers 4
MinSpareServers 2
MaxSpareServers 5
MaxClients 30
- MaxRequestsPerChild 0
+ MaxRequestsPerChild 2
# worker MPM
@@ -49,12 +49,12 @@
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
- StartServers 2
+ StartServers 4
MaxClients 30
MinSpareThreads 25
MaxSpareThreads 48
ThreadsPerChild 25
- MaxRequestsPerChild 0
+ MaxRequestsPerChild 2
4.Apacheのリスタート
# /usr/local/etc/rc.d/apache22 restart






コメントする