What is the recommended max value for Max Connections Per Child in Apache configuration?

前提是你 提交于 2019-12-07 05:21:42

问题


I am traying to reduce memory usage by Apache on the server.

My actual Max Connections Per Child is 10k

According to the following recommendation

the Max Connections Per Child should be reduced to 1000

http://www.lophost.com/tutorials/how-to-reduce-high-memory-usage-by-apache-httpd-on-a-cpanel-server/

What is the recommended max value for Max Connections Per Child in Apache configuration?


回答1:


The only time when this directive affects anything is when your Apache workers are leaking memory. One way this happens is that memory is allocated (via malloc() or whatever) and never freed. It's the result of design/implementation flaws in Apache or its modules.

This directive is somewhat of a hack, really -- but if there's some module that's loaded into Apache that leaks, say, 8 bytes every request, then after a lot of requests, you'll run out of memory. So the quick fix is to just kill the process every MaxConnectionsPerChild requests and start a new one.

This will only affect your memory usage if you see it gradually increase over the span of lots of requests when setting MaxConnectionsPerChild to zero.




回答2:


The default is 0 (which implies no maximum connections per child) so unless you have memory leakage I'm unaware of any need to change this setting - I agree with Hut8.

Sharing here FYI from the Apache 2.4 Performance Tuning page:

Related to process creation is process death induced by the MaxConnectionsPerChild setting. By default this is 0, which means that there is no limit to the number of connections handled per child. If your configuration currently has this set to some very low number, such as 30, you may want to bump this up significantly. If you are running SunOS or an old version of Solaris, limit this to 10000 or so because of memory leaks.

And from the Apache 2.4 docs on MaxConnectionsPerChild:

Setting MaxConnectionsPerChild to a non-zero value limits the amount of memory that process can consume by (accidental) memory leakage.



来源:https://stackoverflow.com/questions/22732768/what-is-the-recommended-max-value-for-max-connections-per-child-in-apache-config

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!