1

我正在使用 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>
4

0 回答 0