jQuery in Action, 3rd edition
The moose likes Tomcat and the fly likes Connections to Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Connections to Tomcat" Watch "Connections to Tomcat" New topic

Connections to Tomcat

Thomas Greene
Ranch Hand

Joined: Aug 09, 2004
Posts: 127
We have around 50 users connected to the application which is deployed on tomcat 6 (windows 2008).

In catalina.log, I can see the following -

org.apache.tomcat.util.threads.ThreadPool logFull
SEVERE: All threads (200) are currently busy, waiting. Increase maxThreads (200) or check the servlet status

Can someone please let me know the following -

1. How could it be creating 200 threads when there are just 50 users. Could this be something related to code?

2. where can we increase the number maxthreads?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

When you display a web page, it commonly is not fetched via a single request. There is the master request plus many cascading sub-requests. These sub-requests fetch script files, CSS files, images, and so forth. So a 5-to-1 or higher request cascade would be quite common. Now augment that when the server begins to mis-behave and frustrated users start clicking buttons and links, thereby adding even more requests to the mix.

Before you expand the thread pool, you need to find out why the threads are not being released, because apparently there are a lot of stuck requests out there. That would seem to indicate a critical application bug, possibly due to unexpected race conditions resulting in either CPU loops (that's easy enough to detect) or deadlocks (which is trickier). Or sometimes a mix of both.

Since it looks like possibly not only is the main page request hanging up, but (if numbers mean anything), the minor stuff like page resources and image fetches as well, the first place I'd check would be to see if there are any filters in the request chain, since filters are something that almost everything gets passed through.

An IDE is no substitute for an Intelligent Developer.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13036
Use the management app to see what those Threads are doing.

When this happened to me, I found a bunch of Threads that had been running for hours because they were waiting for a resource that I had not started.

I agree. Here's the link: http://aspose.com/file-tools
subject: Connections to Tomcat
It's not a secret anymore!