Forum Moderators: phranque

Message Too Old, No Replies

Setting MaxRequestPerChild to 500

         

ooen

1:40 am on Dec 26, 2005 (gmt 0)

10+ Year Member




The MaxRequestsPerChild directive sets the limit on the number of requests that an individual child server process will handle. After MaxRequestsPerChild requests, the child process will die. If MaxRequestsPerChild is 0, then the process will never expire.

Setting MaxRequestsPerChild to a non-zero limit has two beneficial effects:

* it limits the amount of memory that process can consume by (accidental) memory leakage;

* by giving processes a finite lifetime, it helps reduce the number of processes when the server load reduces.


Source - Apache.org [httpd.apache.org]
I'm having some problem on my server (Apache2) and MaxRequestsPerChild is currently set to 4000. Someone suggested that I set MaxRequestsPerChild to 500.

Q1. What does it really do?

Q2. What are disadvantages of setting MaxRequestsPerChild to 500 instead of setting it to 4000 or even 0 (infinite)?

Chico_Loco

2:28 am on Dec 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What are the problems you are having, and why do you think this would resolve the problems?

MaxRequestsPerChild is set to 0 (infinite) on my system, and this has never caused an issue.

Run 'top' at the command line and monitor the httpd processes over an extended period of time. If you notice that the memory consumed by the httpd processes increases significantly over the course of a few days (given you have steady traffic) then you may have a leakage problem and setting this directive to a hard limit might help - but if the problem is something other than memory, then this is probably not the source of your problems.

1. This basically kills a given child httpd process after it has handled x number of requests - thus freeing up any resources consumed by that process. A new child process is then started to replace it.

2. The disadvantages are minimal, but with high traffic your server would have a bit of extra work to do in killing and starting processes every so often.

A more realistic value for this directive is something like 10000. 500 is just very low.

ooen

4:23 am on Dec 26, 2005 (gmt 0)

10+ Year Member



> What are the problems you are having, and why do you think this would resolve the problems?

To be quite honest, " I " don't know exactly why. Someone suggested this and I'd like to know if this does anything.

Apache hangs periodically and this is really the problem that I'm having. I need some kind of solution to resolve the problem.

I cannot be 100% sure, but it is very possible that Tomcat is causing the problem indirectly. I see a bunch of error messages in error_log like the following:

[Sun Dec 18 18:33:27 2005] [error] Cannot configure connection "ooen_net_Connection_ssl"
[Sun Dec 18 18:33:27 2005] [error] Cannot read packet (//home/builder/pb_work_dir/psa_aiconfig_7.5.3/psa/apache-modules/mod_webapp/work/jakarta-tomcat-connectors-4.1.29-
src/webapp/lib/pr_warp_config.c:230)
[Sun Dec 18 18:33:27 2005] [error] Cannot configure connection "ooen_net_Connection"
[Sun Dec 18 18:33:28 2005] [error] Cannot read packet (//home/builder/pb_work_dir/psa_aiconfig_7.5.3/psa/apache-modules/mod_webapp/work/jakarta-tomcat-connectors-4.1.29-
src/webapp/lib/pr_warp_config.c:230)
[Sun Dec 18 18:33:28 2005] [error] Cannot configure connection "ooen_net_Connection"
[Sun Dec 18 18:33:29 2005] [error] Cannot read packet (//home/builder/pb_work_dir/psa_aiconfig_7.5.3/psa/apache-modules/mod_webapp/work/jakarta-tomcat-connectors-4.1.29-
src/webapp/lib/pr_warp_config.c:230)
[Sun Dec 18 18:33:29 2005] [error] Cannot configure connection "ooen_net_Connection_ssl"
[Sun Dec 18 18:33:29 2005] [error] Cannot read packet (//home/builder/pb_work_dir/psa_aiconfig_7.5.3/psa/apache-modules/mod_webapp/work/jakarta-tomcat-connectors-4.1.29-
src/webapp/lib/pr_warp_config.c:230)
[Sun Dec 18 18:33:29 2005] [error] Cannot configure connection "ooen_net_Connection"
[Sun Dec 18 18:33:30 2005] [error] Cannot read packet (//home/builder/pb_work_dir/psa_aiconfig_7.5.3/psa/apache-modules/mod_webapp/work/jakarta-tomcat-connectors-4.1.29-
src/webapp/lib/pr_warp_config.c:230)
[Sun Dec 18 18:33:30 2005] [error] Cannot configure connection "ooen_net_Connection_ssl"
[Sun Dec 18 18:33:31 2005] [error] Cannot read packet (//home/builder/pb_work_dir/psa_aiconfig_7.5.3/psa/apache-modules/mod_webapp/work/jakarta-tomcat-connectors-4.1.29-
src/webapp/lib/pr_warp_config.c:230)
[Sun Dec 18 18:33:31 2005] [error] Cannot configure connection "ooen_net_Connection_ssl"
[Sun Dec 18 18:33:32 2005] [error] Cannot read packet (//home/builder/pb_work_dir/psa_aiconfig_7.5.3/psa/apache-modules/mod_webapp/work/jakarta-tomcat-connectors-4.1.29-
src/webapp/lib/pr_warp_config.c:230)
[Sun Dec 18 18:33:32 2005] [error] Cannot configure connection "ooen_net_Connection_ssl"

This happens before Apache hangs. I'm suspecting that this starts up a bunch of Apache processes and ends up making Apache hang or lock up. That's my guess ...

[edited by: jdMorgan at 5:32 am (utc) on Dec. 26, 2005]
[edit reason] Fixed side-scroll. [/edit]

ooen

4:24 am on Dec 26, 2005 (gmt 0)

10+ Year Member



(Just one more thing:

It is very very important that I solve the problem, and this is one of reasons why I'm working on this on this Christmas Day ...)