wood burning stoves 2.0*
The moose likes Tomcat and the fly likes Tomcat - Increase maxThreads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat - Increase maxThreads " Watch "Tomcat - Increase maxThreads " New topic
Author

Tomcat - Increase maxThreads

Swapan Mazumdar
Ranch Hand

Joined: Jul 23, 2003
Posts: 83
Hi All,

I am receiving the following error in my tomcat log.
org.apache.tomcat.util.threads.ThreadPool logFull
SEVERE: All threads (150) are currently busy, waiting. Increase maxThreads (150) or check the servlet status


How should be thread be set in order to increase the thread pool and its performance.

Regards,
Swapan
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41108
    
  45
There are several thread-related attributes in the <Connector> element in your server.xml file, including maxThreads, which by default is set to 150.
But: Are you actually using that many threads, or is there maybe a problem in the code which causes the threads not to terminate?
[ September 28, 2005: Message edited by: Ulf Dittmer ]

Ping & DNS - my free Android networking tools app
Swapan Mazumdar
Ranch Hand

Joined: Jul 23, 2003
Posts: 83
Originally posted by Ulf Dittmer:
...Are you actually using that many threads, or is there maybe a problem in the code which causes the threads not to terminate?

The problem that I have mentioned is coming into scene when the connection link from web app to remote GDS system is terrible with bad performance. You could be right the threads are not being terminated.

I need few suggesions from you. 1) What open source application profiling tool is available for tomcat with regards to analysis of thread pooling and profiling of online applications hosted on tomcat.
2) Is their any way from my web application code I could be able to check the limit of no. of threads available and when it is about to reach its limit I could be able to control the behaviour of my web application.
Now in this situation any http request is rejected and website home page is not rendered but the website can still be accessible through https.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41108
    
  45
There are a number of profilers available, look here and here.
The relevant profiling API is called JVMPI (up to and including Java 1.5) or JVMTI (starting with Java 1.5).

You can use the Tomcat server API to gain access to Tomcat internals, something like:
ServerFactory.getServer()
server.findService(...)
(CoyoteConnector) service.findConnectors(...)
The thread information should be available in the Connector, because that's where it's configured in server.xml, but at a quick glance I don't see it. You could check the source to see where it goes, and how to access it.
Swapan Mazumdar
Ranch Hand

Joined: Jul 23, 2003
Posts: 83

...You can use the Tomcat server API to gain access to Tomcat internals, something like:
ServerFactory.getServer()
server.findService(...)
(CoyoteConnector) service.findConnectors(...)

Hi Ulf,

It is a while since I had read your reply. I am resuming work on this problem and looking for some help again. I am trying to understand how I can get access to Server through ServerFactory.getServer(). Does this line of API is found in Java Servlet APIs.

Rgrds,

Swapan Mazumdar
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41108
    
  45
No, it's part of the Tomcat API, right here. Note that the web app needs to set privileged="true" in its <Context> element to be allowed access to Tomcat APIs (see documentation here).
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
If all these requests are going through the same application it seems to me that a request filter is what you want. Your filter can keep track of pending requests and refuse or otherwise throttle access as the number rises.
Bill
Swapan Mazumdar
Ranch Hand

Joined: Jul 23, 2003
Posts: 83
Originally posted by William Brogden:
If all these requests are going through the same application it seems to me that a request filter is what you want. Your filter can keep track of pending requests and refuse or otherwise throttle access as the number rises.
Bill

I would like this to be happening at the controller level. Actually I have an airlines booking apps embedded with the website. It is the airlines app which hogs the thread pool and overflows the stack since the underlying connection is never released when the connection to GDS is terrible. I would like the website to be up and running always and manage the threads at the booking engine level using servlet controller before the requests is finally passed on further to rmi/jini server.

I really appreciate your suggestion and will consider. Currently I am trying to create a reporting on thread pools(# busy, #waiting, ThreadStatus)

Kind regards,

Swapan Mazumdar
Swapan Mazumdar
Ranch Hand

Joined: Jul 23, 2003
Posts: 83
Originally posted by Ulf Dittmer:
No, it's part of the Tomcat API, right here...

Hi Ulf,

I have realized just then that it's in the tomcat5 docs. Thanks. I am trying hard to find access to Thread Pool object. That's what I have been looking for whole of my life

regards,
Swapan
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

A lot of this information can be seen from the Tomcat Manager/html application .

On a default install:
http://localhost:8080/manager/html

You may need to add your name to the realm in the tomcat/conf/tomcat-users.xml file. Once on the page, click the Server Status link on the right side of the header.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tomcat - Increase maxThreads
 
Similar Threads
I/O exception (java.net.SocketException) caught when processing request
How to resolve the "All threads (500) are currently busy" issue in Tomcat.
Tomcat Processes
how to increase max thread size
Tomcat 6 Server Status - No maxThreads Attribute