6 Replies Latest reply on Feb 5, 2007 8:10 AM by shi lei

    Open connections with Apache 2.2+mod_proxy_ajp+JBoss/Tomcat

    Stephen Keumurian Newbie


      I've been trying to track down a problem on our server for a while now and thought I'd check in here to see if anyone has a solution. I have Apache 2.2.2 setup as a front end for JBoss 4.0.2 on the same server. I have a rather long list of named virtual hosts being served on this one system. I'm using mod_proxy_ajp to route traffic to multiple web applications on the server. I'm running into a situation where the number of connections from Apache to the Tomcat AJP connector (localhost:8009) is forever growing and eventually people are blocked from accessing the server. The connections are left in the "ESTABLISHED" state as viewed by netstat.

      tcp4 0 0 localhost.8009 localhost.49163 ESTABLISHED
      tcp4 0 0 localhost.49163 localhost.8009 ESTABLISHED

      I've tried using Apache with the worker MPM as well as the pre-fork MPM and the problem seems to occur with both, but becomes a problem a lot sooner with the pre-fork MPM.

      I tried editing jboss-4.0.2/server/default/deploy/jbossweb-tomcat55.sar/server.xml to include a connectionTimeout value of 20000 milliseconds. This timeout works, but then instead of the connections being left in the "ESTABLISHED" state they are now left as "CLOSE_WAIT." I've tried changing various values on the Apache side, such as specifying smax, ttl, etc. to no avail.

      I'm defining the proxy to my application like this:

      <Location /cdf>
       ProxyPass ajp://localhost:8009/cdf smax=30 ttl=30 retry=1
       ProxyPassReverse ajp://localhost:8009/cdf

      This is included in each named virtual host that needs access to the application. Other virtual hosts have their own Location entries that proxy pass to other applications.

      My http-mpm.conf is setup like this for the worker MPM:
      <IfModule mpm_worker_module>
       StartServers 2
       MaxClients 300
       MinSpareThreads 25
       MaxSpareThreads 300
       ThreadsPerChild 25
       MaxRequestsPerChild 0

      and like this for the prefork:

      <IfModule mpm_prefork_module>
       StartServers 15
       MinSpareServers 51
       MaxSpareServers 65
       MaxClients 500
       MaxRequestsPerChild 0

      I have a test server that I has a simpler version of the same setup on (no named virtual hosts) and I'm seeing this behavior there as well. I've tried creating a test application that only includes a basic index.html and it appears to behave the same way. Am I missing something? Am I using mod_proxy_ajp incorrectly?