原文网址:https://www.youyong.top/article/1158e3052998
在使用 Apache 搭建网站时,经常会遇到因为访问量大,导致网站无法访问的情况。造成网站无法访问的情况有很多,例如服务器配置较低,无法承载当前的访问量。也有可能因为 Apache 的配置参数不够优化导致的。
原文网址:https://www.youyong.top/article/1158e3052998
在使用 Apache 搭建网站时,经常会遇到因为访问量大,导致网站无法访问的情况。造成网站无法访问的情况有很多,例如服务器配置较低,无法承载当前的访问量。也有可能因为 Apache 的配置参数不够优化导致的。
原文网址:https://www.youyong.top/article/1158e3052998
ECS Linux 系统下 Apache 的默认工作模式是 prefork MPM,使用多个子进程,每个子进程只有一个线程。每个进程在某个确定的时间只能维持一个连接,效率高,但内存占用量比较大。如果不做调整,访问量增大可能造成 Apache 崩溃的情况。
具体使用哪种模式是在编译安装 Apache 时指定的。在编译的时候可以加入 —with-pem=(prefork|worker) 选项决定启用什么模式。可以使用 httpd -l 命令查看当前 Apache 的工作模式:
Apache 的如下配置参数对性能影响较大:
StartServers 5MinSpareServers 5MaxSpareServers 10MaxClients 150MaxRequestsPerChild 0
建议做如下修改:
$ vi /usr/local/apache/httpd/conf/extra/httpd-mpm.conf StartServers 5 MinSpareServers 5 MaxSpareServers 10 ServerLimit 1024 MaxClients 1024 MaxRequestsPerChild 300
说明:
最后,重启apache生效:
$ /usr/local/apache/httpd/bin/apachectl restart
附一些参数的介绍:
共 0 条留言
阿里云·业务运营团队内部的前端构建和工程化工具 Dawn开源
tomcat报warinig Unable to add the resource at [] to the cache
Apache 出现 winnt_accept: Asynchronous AcceptEx faile?
iPhone X 跌破发行价,苏宁200亿入股恒大 | 财经日日评
资深黄牛现身说法:iPhone X价格秒变不停,就像炒股一样
手机扫一扫
分享文章