有一台服务器 IBM P550 小型机上的 IHS 在连续运行几天后,其中的一个 httpd 进程占用内存接近几百兆。
IHS 其实就是 Apache ,AIX 5.3 下运行在 worker 方式下,它被看作 Apache 未来的主流工作模式,它是一种多进程与多线程混合的模式。
Apache的主流工作模式MPM模式。MPM是Multi-Processing-Modules的简称,意思是多道处理模块。MPM模块有不同的种类。现在用的比较多的MPM种类主要是prefork和worker。prefork的工作方式是多个进程工作,每个进程会在处理一定数量的请求后结束(这个数量可能是无穷),没有线程的概念。worker被看作apache未来的主流工作模式,它是一种多进程与多线程混合的模式。
配置文件 httpd.conf 中 work 的参数配置项:
<IfModule worker.c>
ThreadLimit 100
ServerLimit 256
StartServers 8
MaxClients 1200
MinSpareThreads 100
MaxSpareThreads 300
ThreadsPerChild 100
MaxRequestsPerChild 0
</IfModule>
关键的问题出现在 MaxRequestsPerChild 参数。MaxRequestsPerChild这个指令设定一个独立的子进程将能处理的请求数量。
在处理“MaxRequestsPerChild 数字”个请求之后,子进程将会被父进程终止,这时候子进程占用的内存就会释放,如果再有访问请求,父进程会重新产生子进程进行处理。
如果MaxRequestsPerChild缺省设为0(无限)可以使每个子进程处理更多的请求,不会因为不断终止、启动子进程降低访问效率。
但如果占用了200~300M内存,即使负载下来时占用的内存也不会减少。内存较大的服务器可以设置为0或较大的数字。内存较小的服务器不妨设置成30、50、100,以防内存溢出。
分享到:
相关推荐
apache httpd.conf中文 apache优化
apache httpd php wordpress
apache httpd2.4.6 for linux
Linux下安装Apache httpd.doc
Apache httpd 2.4.17 Released x64,Update 2015-10-13.
Apache HTTPD cluster config
Apache 的 httpd.conf 详解 Apache 的 httpd.conf 详解Apache 的 httpd.conf 详解Apache 的 httpd.conf 详解Apache 的 httpd.conf 详解Apache 的 httpd.conf 详解Apache 的 httpd.conf 详解
apache-httpd-2.4.6,工具类,jar包,spring-mvc
peoxy balancer 配置 ProxyPass /11serv balancer://saleserv-cluster/ nofailover=On
apache httpd禁止某IP访问网站.IP黑名单
Windows版本apache httpd
Apache httpd-2.2.15源码,很宝贵的哦!Apache的官网现在都没这个版本了!
版本 apr-1.4.6 apr-util-1.4.1 pcre-8.20 httpd-2.4.33
Apache httpd 2.4.16 Released,Update 2015-7-15.
Apache的httpd.conf文件常用指令解释Apache的httpd.conf文件常用指令解释Apache的httpd.conf文件常用指令解释
#参见<url:http://httpd.ache.org/doc-2.0/>以取得关于这些指令的详细信息 # #不要只是简单的阅读这些指令信息而不去理解它。 #这里只是做了简单的说明,如果你没有参考在线文件,你就会被警告。 # #这些配置...
Apache配置httpd-vhosts虚拟主机
Apache2 httpd.conf 中文版 Apache2 httpd.conf 中文版
This version of Apache is our latest GA release of the new generation 2.4.x branch of Apache HTTPD and represents fifteen years of innovation by the project, and is recommended over all previous ...
工作原因查了需要在机顶...直接上传到机顶盒等安卓环境或嵌入式linux环境下,解压缩,(默认会解压缩到/data/data/apache-for-android目录下,可自行调整),注意需要检查解压缩后的httpd有可执行权限;特共享给大家!