Julio Faerman
Julio Faerman

Reputation: 13501

Tomcat not recovering from excess trafic

When my tomcat (6.0.20) maxThreads limit is reached, i get the expected error:

Maximum number of threads (XXX) created for connector with address null and port 80

And then request starts hanging on queue and eventually timing out. so far, so good. The problem is that when the load goes down, the server does not recover and is forever paralysed, instead of coming back to life.

Any hints?

Upvotes: 2

Views: 2286

Answers (2)

Matthew Buckett
Matthew Buckett

Reputation: 4371

I think may be a bug in Tomcat and according to the issue:

https://issues.apache.org/bugzilla/show_bug.cgi?id=48843

should be fixed in Tomcat 6.0.27 and 5.5.30

Upvotes: 0

BalusC
BalusC

Reputation: 1108702

Consider switching to NIO, then you don't need to worry about the technical requirement of 1 thread per connection. Without NIO, the limit is about 5K threads (5K HTTP connections), then it blows like that. With NIO, Java will be able to manage multiple resources by a single thread, so the limit is much higher. The border is practically the available heap memory, with about 2GB you can go up to 20K connections.

Configuring Tomcat to use NIO is as simple as changing the protocol attribute of the <Connector> element in /conf/server.xml to "org.apache.coyote.http11.Http11NioProtocol".

Upvotes: 5

Related Questions