RPM版Apacheをworkerで動作させる

RPM版のApacheはそのままだと「prefork」で動作します。

# /etc/init.d/httpd start
httpd を起動中:                                            [  OK  ]
# ps -fe | grep httpd
root      2851     1  0 22:14 ?        00:00:00 /usr/sbin/httpd
apache    2852  2851  0 22:14 ?        00:00:00 /usr/sbin/httpd
apache    2853  2851  0 22:14 ?        00:00:00 /usr/sbin/httpd
apache    2854  2851  0 22:14 ?        00:00:00 /usr/sbin/httpd
apache    2855  2851  0 22:14 ?        00:00:00 /usr/sbin/httpd
apache    2856  2851  0 22:14 ?        00:00:00 /usr/sbin/httpd
apache    2857  2851  0 22:14 ?        00:00:00 /usr/sbin/httpd
apache    2859  2851  0 22:14 ?        00:00:00 /usr/sbin/httpd
apache    2860  2851  0 22:14 ?        00:00:00 /usr/sbin/httpd
root      2862  2711  0 22:14 pts/0    00:00:00 grep httpd

「worker」するには、「/etc/sysconfig/httpd」の「HTTPD=/usr/sbin/httpd.worker」の
コメントアウトを外して起動スクリプトを実行すればOKです。

#
# The default processing model (MPM) is the process-based
# 'prefork' model.  A thread-based model, 'worker', is also
# available, but does not work with some modules (such as PHP).
# The service must be stopped before changing this variable.
#
HTTPD=/usr/sbin/httpd.worker
# /etc/init.d/httpd start
httpd を起動中:                                            [  OK  ]
# ps -fe | grep httpd
root      2877     1  0 22:17 ?        00:00:00 /usr/sbin/httpd.worker
apache    2878  2877  0 22:17 ?        00:00:00 /usr/sbin/httpd.worker
apache    2880  2877  0 22:17 ?        00:00:00 /usr/sbin/httpd.worker
root      2936  2711  0 22:17 pts/0    00:00:00 grep httpd

バイナリが分かれてるんですね。

# /usr/sbin/httpd -l
Compiled in modules:
  core.c
  prefork.c
  http_core.c
  mod_so.c

# /usr/sbin/httpd.worker -l
Compiled in modules:
  core.c
  worker.c
  http_core.c
  mod_so.c

今日はこんな所で。