tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeffrey Janner <>
Subject RE: Limiting threads per context
Date Thu, 03 Jan 2013 14:43:51 GMT
> -----Original Message-----
> From: []
> Sent: Thursday, January 03, 2013 8:31 AM
> To:
> Subject: Limiting threads per context
> Hello All,
> Yesterday we had a Tomcat6 server reach maxThreads and stay that way
> until we restarted it.  After researching a thread dump and some log
> files, we found one of the applications is creating
> NullPointerExceptions and subsequently leaving a TP-ProcessorX in
> WAITING state indefinitely for a DB closePreparedStatement return.  As
> more requests come in for this application threads are being
> established and put into BLOCKED state, waiting on TP-ProcessorX.
> Eventually, the server hits maxThreads and stops serving requests
> almost entirely.
> Obviously the application causing this needs to (and is being) fixed.
> But I'm curious if there is a higher level of protection that could be
> implemented to help protect the other applications (contexts) on this
> server?  For example, is there a way to specify that a context can only
> use X number of request threads?  Or perhaps X number of threads from
> an executor?  Et cetera.
> I haven't seen anything in the docs that would do this, but it never
> hurts to ask.  Here's our server info in case it's helpful:
> OS: Ubuntu 12.04 64-bit
> Front-end Server: Apache 2.2.22 (mod_ajp to back-end via Balancer
> setup) Back-end App Server:  Tomcat 6.0.24 (AJP & HTTP connectors, no
> executor) Java -version output:
>   java version "1.6.0_20"
>   OpenJDK Runtime Environment (IcedTea6 1.9.13)
> (6b20-1.9.13-0ubuntu1~10.04.1)
>   OpenJDK 64-Bit Server VM (build 19.0-b09, mixed mode)
> Thanks,
> Kyle Harper

Kyle -
Processor threads are tied to connectors, either directly or via executors.  Therefore, if
these are all contexts under one host, or you are sharing the connector (IP/port pair) for
multiple hosts, I don't think there is anything you can do.
However, since you are front-ending with apache, you might be able to set up multiple connectors
(IP/port pair) on the Tomcat server and use the front end to direct each context to a different
connector.  In this case, you can probably ignore setting up the executors, since you are
not going to be sharing threads between the contexts.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message