就最新版本的Web服务器Apache(版本是Apache 2.4.10,发布于2014年7月21日)来说,一共有三种稳定的MPM(Multi-Processing Module,多进程处理模块)模式。它们分别是prefork,worker和event,它们同时也代表这Apache的演变和发展。
查看我们Apache的模式,可以使用httpd -V命令来查看:
# httpd -V
Server version: Apache/2.4.10 (Unix)
Server built: Dec 29 2014 11:23:13
Server's Module Magic Number: 20120211:36
Server loaded: APR 1.5.1, APR-UTIL 1.5.3
Compiled using: APR 1.5.1, APR-UTIL 1.5.3
Architecture: 64-bit
Server MPM: event
threaded: yes (fixed thread count)
forked: yes (variable process count)
编译的时候,可以通过configure的参数来指定:
--with-mpm=prefork|worker|event
也可以编译为三种都支持,通过修改配置来更换
--enable-mpms-shared=all
在httpd.conf中修改Apache的多处理模式MPM可以通过(modules文件夹下,会自动编译出三个MPM的so):