top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Tomcat: Does maxActive limit the size of threadpool?

+1 vote
483 views

I am having difficulty understanding some of the documentation for the tomcat JDBC thread pool and I was hoping somebody could clarify.

If I have maxActive set to 100, does this mean that the size of the pool is limited to 100, so 50 idle + 50 active for example? Or can I have 100 active connections and 100 idle connections if I so wished, meaning the size could be 200 with maxActive set to 100?

The reason I ask is we have an app with maxActive set to 100 and it stopped handling connections when size reached 100.

Some debug output from when it died :

Initial Size : 100
Active Connection : 28
Idle Connection : 0
Size : 100

Max Active Connections : 100
Max Age : 0
Max Idle : 100
Min Idle : 80
Max Wait : 5000

Log Abandoned : true
Remove Abandoned : true
Remove Abandoned Timeout : 300

timeBetweenEvictionRunsMillis : 60000
minEvictableIdleTimeMillis : 3600000

Validation Query : SELECT 1
posted Oct 8, 2013 by Meenal Mishra

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

If I have maxActive set to 100, does this mean that the size of the pool is limited to 100, so 50 idle + 50 active for example?

That's my understanding of how it works.

Or can I have 100 active connections and 100 idle connections if I so wished, meaning the size could be 200 with maxActive set to 100?

No, maxActive should limit the size of the pool not just "active" connections.

The reason I ask is we have an app with maxActive set to 100 and it stopped handling connections when size reached 100.

This sounds like the expected behavior. Are you expecting to hit the limit, in other words do you legitimately have 100 connections in use?

As a side note, usually the pool will output some helpful logging when you hit a situation like this. You'll see a "PoolExhaustedException" with some additional information. Do you happen to have those log records?

Lastly, have you tried a more recent version of the pool? Can you try the pool that ships with the latest download of Tomcat 7.

http://search.maven.org/#artifactdetails|org.apache.tomcat|tomcat-jdbc|7.0.42|jar

answer Oct 8, 2013 by Majula Joshi
Thanks for the clarification. We shouldn't legitimately see 100 connections but we are trying to debug issues with our application that may be leaking connections, we are seeing strange behavior that I will reference in a different post as to not confuse things.

I will also try to get our app running on the latest version of tomcat if you think that will help

Now that we know that maxActive dictates the overall size we can adjust our setting, thanks again!
Similar Questions
+3 votes

I have a requirement where the tomcat load has to be managed by tuning the following parameters.

--> Limit the number of user requests at Apache level that are routed to Tomcat server.
--> Track the number of processed requests and the requests that are queued at Apache level.

Any suggestions?

+1 vote

In tomcat does the no . of open sockets on http port (netstat -anlp|grep 8080) is it equal to number of threads in use in tomcat .
Actually I want to understand how & when I can say that the all threads in a tomcat are fully utilized that why it is responding slow.

+1 vote

Does Tomcat server support Graceful Shutdown (like all other App Servers: Weblogic, Websphere), where new requests are rejected, and the server finishes in-flight work on existing requests?

Something like the apachectl -k graceful, but instead to restart to stop the server.

0 votes

Does heartbleeding bug impact on Tomcat 6.x, 7.x and 8.x ? I noticed that Tomcat native connector version 1.1.22 uses : OpenSSL 0.9.8 which doesn't have the heartbleeding bug, but 1.1.24 and 1.1.29 also include the buggy openssl.

How can I find which version of Tomcat uses which version of Tomcat native connector ? For example, how can I figure out which version of Tomcat native connector is used by Tomcat 7.0 build 47.

+1 vote

Apache/Tomcat (by default) does not allow symbolic linking (nice as it can cross mounted file systems) except in the top apache/lib directory. I use hard links in the Application/WEB-INF/lib directories to reduce copying and help me manage things.

HOWEVER, some applications have special needs - e.g. pictures. You don't want to always distribute these with the release of the application (Application.war file), so symbolic links are the way to go (except for MS land, sorry). The nice solution to this is:

.../webapps/Application/WEB-INF/context.xml
which must contain at least the two below lines:

However this allows ALL symbolic linking in the Application directory. I agree with the developers that this is dangerous.

Is there some way to allow linking in just ONE sub-directory of the Application?
- e.g. .../webapps/Application/images

This would allow all I need to have local images for the application without endangering other things using a symbolic link.

...