Hi Jeff,

 

Thanks for quick response. We will check and do the needful

 

That 100 is to prevent memory leak.

 

Regards,

Krishna.

 

From: Jeff Trawick [mailto:trawick@gmail.com]
Sent: Friday, August 22, 2014 2:24 AM
To: users@httpd.apache.org
Subject: Re: [users@httpd] MaxRequestsPerChild - New child process doesn't process requests

 

On Thu, Aug 21, 2014 at 4:39 PM, Vattikuti, Vamsi Krishna Venkata (STSD) <vamsik@hp.com> wrote:

Hi,

 

We are having an issue with Tomcat application accessing through proxy and details are below. Can you please check and share your feedback.

 

Issue:

We have an application(tomcat) accessed through proxy as below. Also, we have MaxRequestsPerChild setting as 100

 

Whenever MaxRequestsPerChild reached its limit, a new process is started but the application become unresponsive. It seems that new process doesn’t service any requests

We have to restart httpd to recover that

 

 

Log:

-          Access.log doesn’t show any requests for new child

-          Error_log shows that

a)      workers are initiated for new process but it didn’t service any requests

b)       

c)       processing has stuck for a minute due to some reason

   [Fri Aug 08 16:09:17 2014] [debug] ssl_engine_kernel.c(2118): [client 127.0.0.1] Certificate Verification, depth 0 [subject: /C=y/ST=y/L=y/O=y/OU=y/CN=y, issuer: /C=y/ST=y/L=y/O=y/OU=y/CN=y, serial: xyz]

   [Fri Aug 08 16:10:12 2014] [info] [client 10.150.90.25] Connection to child 6 established (server *:<port number from client>)

 

d)      SSL handshake has started but didn’t complete for 4 connections related to new process. There are no errors related to ssl

$ grep -i handshake errorlog.2014-08-08-07_06_44 | grep -c start

707

$ grep -i handshake errorlog.2014-08-08-07_06_44 | grep -c done

703

$

 

Apache version:

2.2.15

 

 

Proxy setting:

SSLProxyEngine On

SSLProxyCipherSuite ALL

SSLProxyMachineCertificateFile /var/ssl/proxy.pem

 

proxyPass /app1 https://localhost:<port number>/app1 (Tomcat)

 

Worker configuration:

KeepAlive On

MaxKeepAliveRequests 100

KeepAliveTimeout 15

<IfModule worker.c>

StartServers         1

MaxClients           25

MinSpareThreads      12

MaxSpareThreads      25

ThreadsPerChild      25

ServerLimit          1

MaxRequestsPerChild  100

MaxMemFree  50

</IfModule>

 

Thanks & Regards,

Krishna


MaxRequestsPerChild 100 is ridiculously low.  What is happening in httpd to cause you to need that setting?

 

Anyway...

 

Once an httpd child process has reached 100 connections, it initiates a graceful shutdown, which means that instead of aborting current requests it will instead wait for current requests to finish, then exit.

 

During the time that it is waiting for current requests to finish, new connections must be handled by other child processes.  BUT you set ServerLimit to 1 (and other directives such as ThreadsPerChild and MaxClients are consistent with allowing only one child process), so no other child process can be created during that time.

 

Thus, once 100 connections are handled, new clients will be blocked until existing requests finish.

 

--/--

 

My guess:  Your Java application takes a long time (maybe forever?) to handle some requests.  MaxRequestsPerChild makes it worse.  If the Java requests are slow and eventually finish, the solution is to keep a steady set of httpd child processes (having them gracefully exit when there are slow backend requests can be harmful) and increase the number of httpd threads/child processes to handle the load.

 

If some Java requests hang, see how to handle that on the Tomcat side.


Enable server status with ExtendedStatus On and watch what happens -- whether or not certain requests handled by the Java application take a relatively long time, tieing up some or all of your very limited number of httpd threads.

 

--

Born in Roswell... married an alien...
http://emptyhammock.com/