![如何在具有 16GB RAM 的 m4.xlarge AWS 实例中设置 prefork mpm](https://linux22.com/image/710788/%E5%A6%82%E4%BD%95%E5%9C%A8%E5%85%B7%E6%9C%89%2016GB%20RAM%20%E7%9A%84%20m4.xlarge%20AWS%20%E5%AE%9E%E4%BE%8B%E4%B8%AD%E8%AE%BE%E7%BD%AE%20prefork%20mpm.png)
背景:我在 ELB 后面有六个 Web 服务器,每个 Web 服务器运行 2 个虚拟主机站点。我的 httpd.conf 文件没有 prefork mpm、worker mpm 或 event mpm 的配置。
我试过:我检查了以下路径并找到了 prefork mpm 路径的默认配置:usr/share/doc/httpd24-2.4.23/httpd-mpm.conf
# 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
# MaxRequestWorkers: maximum number of server processes allowed to start
# MaxConnectionsPerChild: maximum number of connections a server process serves
# before terminating
<IfModule mpm_prefork_module>
StartServers 10
MinSpareServers 8
MaxSpareServers 10
MaxRequestWorkers 250
MaxConnectionsPerChild 0
</IfModule>
我已经在 /etc/httpd/conf.d 下创建了 prefork.conf 文件,然后重新启动了 httpd 服务,但出现以下错误:
AH00180: WARNING: MaxRequestWorkers of 400 exceeds ServerLimit value of 256 servers, decreasing MaxRequestWorkers to 256. To increase, please see the ServerLimit directive.
请告诉我需要设置哪些值才能使 prefork mpm 正常工作。我的服务器中有 16GB 的 RAM,只剩下 100MB 的空间。我认为两个虚拟主机站点不需要那么多配置。请告诉我如何优化内存使用并使 prefork mpm 正常工作
答案1
以下配置对我有用
<IfModule mpm_prefork_module>
StartServers 10
MinSpareServers 8
MaxSpareServers 10
ServerLimit 400
MaxClients 400
MaxConnectionsPerChild 0
</IfModule>
谢谢