我正在使用linux EC2,我在启动apache后看到8个httpd进程立即,其中2个由root拥有,其余由'apache'拥有:
root 22966 1 0 08:03 ? 00:00:00 /usr/sbin/httpd
root 22968 22966 0 08:03 ? 00:00:00 /usr/sbin/httpd
apache 22969 22966 0 08:03 ? 00:00:00 /usr/sbin/httpd
apache 22970 22966 0 08:03 ? 00:00:00 /usr/sbin/httpd
apache 22971 22966 0 08:03 ? 00:00:00 /usr/sbin/httpd
apache 22972 22966 0 08:03 ? 00:00:00 /usr/sbin/httpd
apache 22973 22966 0 08:03 ? 00:00:00 /usr/sbin/httpd
apache 22974 22966 0 08:03 ? 00:00:00 /usr/sbin/httpd
为什么有8个流程?我认为这与prefork / worker配置有关,可能是prefork,但是我的/etc/httpd/conf/httpd.conf文件看起来像这样,并且没有定义8或6,也许我错过了什么?
# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# ServerLimit: maximum value for MaxClients for the lifetime of the server
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule prefork.c>
StartServers 5
MinSpareServers 3
MaxSpareServers 9
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 4000
</IfModule>
# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule worker.c>
StartServers 4
MaxClients 300
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>