Windows – Apache Tomcat communication problems. Performance is exteme slow

ajpapache-2.4tomcatwindows

Apache Version 2.4.34 (Win64)
Apache Tomcat 6.0.44
Windows Server 2016 Standard
Version 1607

After a certain period (1-2 hours). Application Performance becomes extremely poor and some time leads to Maintenance (Service Temporarily Unavailable) page.

In Tomcat logs i cannot find any problem. In Apache logs:

[Mon Apr 15 08:41:49.585041 2019] [proxy_ajp:error] [pid 3880:tid 1044] (OS 10060)A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.  : AH01030: ajp_ilink_receive() can't receive header
[Mon Apr 15 08:41:49.585041 2019] [proxy_ajp:error] [pid 3880:tid 1044] [client 1.2.3.4:50880] AH00992: ajp_read_header: ajp_ilink_receive failed, referrer ...

Apart from the above given logs. Logs are full with following entries

[Mon Apr 15 08:41:20.131907 2019] [proxy_balancer:error] [pid 3880:tid 1092] [client 80.114.182.213:54316] AH01167: balancer://ajaxbalancer: All workers are in error state for route (ajaxB), referer: https://url here

Analysis:

Database has been ruled out as a problem since there are no locks and query execution time is also normal and db Server is in optimal health.

Setup :

There are 2 Servers running in Cluster Environment using Load balancer.

Tomcat configuration on both the servers is same:

<Connector port="8109" protocol="AJP/1.3" redirectPort="8443" maxConnections="-1" connectionTimeout="300000" keepAliveTimeout="300000" />

Apache Configuration:

ProxyErrorOverride Off
    ProxyTimeout 120
    Timeout 120
    ProxyPass /static_html !

    <Proxy balancer://ajaxbalancer/>
            BalancerMember ajp://127.0.0.1:8109/app route=Srv1 loadfactor=10 ttl=90
            BalancerMember ajp://127.0.0.1:8109/app  route=Srv1 loadfactor=10 ttl=90
            ProxySet stickysession=JSESSIONID|jsessionid scolonpathdelim=On nofailover=On
            #ProxySet lbmethod=bybusyness
            ProxySet lbmethod=byrequests
        </Proxy>

        <Location "/swingApp/">
            ProxyPass balancer://ajaxbalancer/
            ProxyPassReverse balancer://ajaxbalancer/
            ProxyPreserveHost On
            SetEnv keepalive=on
        </Location>

I request you to help me the topic. If any further information is required please let me know.

Best Answer

Support for Apache Tomcat 6.0.x ended on 31st December 2016. There have been multiple security vulnerabilities announced since then that are very likely to affect the 6.0.x series (once a Tomcat version reaches EOL, it is not assessed to see if it is affected by new security vulnerability reports).

The problem you describe sounds like thread exhaustion on the Tomcat side. You can either increase maxThreads on your AJP connector so it is equal to MaxRequestWorkers on httpd or, alternatively, enable disablereuse in your proxy configuration.