Recommended MaxConnectionsPerChild value for mod_lsapi

yagami_kira

Member
Mar 7, 2017
21
2
53
Tokyo
cPanel Access Level
Website Owner
According to an article here it says " Setting a MaxConnectionsPerChild limit is a specific method for assuring Apache is periodically recycling programs to reduce the impact of leaked memory on the system. When using external code handlers like Mod_fcgid, PHP-FPM or mod_lsapi, it becomes necessary to set MaxConnectionsPerChild to 0 (unlimited), doing so prevents periodic error pages caused by Apache terminating threads prematurely. "

So the way I understand it, you set a MaxConnectionsPerChild to avoid memory leakage (is that still happening in these modern times?). But as the statement above, it will result to periodic error pages (does that really happen - I always thought it will always do a graceful restart and not terminate prematurely?)

I'm using MPM_worker, http/2, and mod_lsapi modules. As a best practice in general, what would be the recommended value for MaxConnectionsPerChild for this kind of setup?
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
14,338
2,243
363
cPanel Access Level
Root Administrator
Hey there! The default from Apache itself, which would exclude lsapi or other external tools, is also 0. We can see this about 1/3 of the way down this page:


Their own documentation says this:

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

It would seem from everything that I am finding that leaving this set to the default of zero is the best option for most users.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
14,338
2,243
363
cPanel Access Level
Root Administrator
Inside cPanel, we set the values to a default that works with our initial configuration of the Prefork MPM, which is what cPanel is installed with by default. If there are additional tools installed later, such as lsapi, that would be up to the server admin to adjust other values on the machine.
 

Spirogg

Well-Known Member
Feb 21, 2018
700
161
43
chicago
cPanel Access Level
Root Administrator
It would be nice to get a write up of some defaults to use for event and worker if installed. Or have it preconfigured with defaults when we change mpm to event or worker
 

Spirogg

Well-Known Member
Feb 21, 2018
700
161
43
chicago
cPanel Access Level
Root Administrator
I think that would be a good idea, but then we run into the "I changed my handler and now my Apache settings changed" issue.
just a reference as examples for defaults..
even if its in the ticket area of how too this would be good just for the basics defaults with a link to apache for each worker.

*check apache for more detailed information or contact a server administrator.
 
  • Like
Reactions: nlaruelle