开发者

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 an开发者_如何学Pythond is forever paralysed, instead of coming back to life.

Any hints?


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".


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜