0

I'm using tomcat server 7 with apache mode_proxy_ajp module to serve a website. Here is my ajp connector config:

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" connectionTimeout="20000"
minSpareThreads="10" maxThreads="512" executor="tomcatThreadPool_1" acceptCount="128"
acceptorThreadCount="2" maxKeepAliveRequests="50" keepAliveTimeout="10000" URIEncoding="UTF-8"/>

& here is executer config:

<Executor name="tomcatThreadPool_1" namePrefix="catalina-exec-" connectionTimeout="20000"
minSpareThreads="10" maxSpareThreads="50" maxThreads="512" acceptCount="128"/>

now the problem is that many times I see many connections with S (service) status in tomcat manager (server status), something like this:

enter image description here

these connections seems to open for a long time, but they have not any send or receive & even background code execution & cpu consumption (so I assume that my servlet code is OK), they look like just some zombie connections & they won't destroy till restarting tomcat server (restarting apache server & even tomcat virtual hosts via host manager has no effect on them)!
I checked all possible related parameters, but I could not find source of this problem.

0

These are likely pooled connections in mod_proxy. It will open connections to your backend server and keep them open to reuse them. You can either tune the settings, both for mod_proxy (timeout, ttl, etc...) & Tomcat (connectionTimeout), or you can set disablereuse in mod_proxy which will tell it not to pool connections.

For the purposes of troubleshooting, I would suggest setting disablereuse=On. That should allow you to confirm really quickly that the threads you're seeing are being held open due to the pooling settings.

After you've confirmed the issue, you can either leave disablereuse=On or you can tune the pooling settings. Personally, I prefer disablereuse as it's easier to configure and easier to troubleshoot when there is a problem.

Furthermore contrary to what is often said about disablereuse, I have never seen a measurable performance impact when using it. Your mileage may vary though, so if you enable this setting you should be prepared to monitor for a potential performance impact.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.