Tomcat – causing Apache httpd (+mod_proxy_ajp) to drop connections

ajpapache-2.2mod-proxy-ajptomcat

I have the following VirtualHost configured (Apache 2.2.22)

<VirtualHost *:80>
    ServerName ************

    ProxyRequests Off
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>

    ErrorLog /var/log/apache2/dalo-lt_error_log
    LogLevel warn
    TransferLog /var/log/apache2/dalo-lt_access_log

    ProxyPass / ajp://localhost:8009/
    ProxyPassReverse / ajp://localhost:8009/

    <Location />
        Order allow,deny
        Allow from all
    </Location>

</VirtualHost>

With the following in my Tomcat's server.xml (7.0.39)

<Connector port="8009" protocol="AJP/1.3"
           redirectPort="8443"
           connectionTimeout="60000"
           maxConnections="36864"
           maxThreads="600" />

<Connector port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000"
           maxConnections="36864"
           maxThreads="600"
           redirectPort="8443" />

When I run my stress test through the vhost:80 + ajp, I start seeing dropped connections after a certain point. However, if i run the test directly through tomcat's http connector (:8080) I see no dropped connections whatsoever.

What is the best way to determine what is causing this?

Just for completeness, here are some settings from my apache2.conf

<IfModule mpm_prefork_module>
    StartServers          10
    MinSpareServers       10
    MaxSpareServers      20
    MaxClients          500
    MaxRequestsPerChild   0
</IfModule>

<IfModule mpm_worker_module>
    StartServers          4
    MinSpareThreads      50
    MaxSpareThreads      450
    ThreadLimit          256
    ThreadsPerChild      150
    MaxClients          300
    MaxRequestsPerChild   0
</IfModule>

<IfModule mpm_event_module>
    StartServers          4
    MinSpareThreads      50
    MaxSpareThreads      450
    ThreadLimit          256
    ThreadsPerChild      150
    MaxClients          300
    MaxRequestsPerChild   0
</IfModule>

Update:
Requesting server-status?auto yields the following while during the phase of the load test when requests are being dropped – so it looks to me like there are enough workers etc. to spare

Best Answer

Apache web server will start droping connections if it is getting too many request. You could use mod_status in order to look at the scoreboard, if it is full, you can increase the number of workers. (should be investigated if the increased number of workers fits your environment)

Related Topic