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

RafaSashi picture RafaSashi · Mar 29, 2014 · Viewed 20.8k times · Source

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?

Answer

Hut8 picture Hut8 · May 27, 2014

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.