Tomcat NIO/RESTEasy 在每次请求后断开 TCP
我通过 NIO 连接器在 Tomcat 6 上使用 RESTEasy 异步 (Comet) IO 支持。目前,在每次响应发送回客户端后,TCP 连接都会被服务器丢弃。
我读过的有关 Tomcat HTTP 连接器配置的所有文档都表明它应该默认保持连接处于活动状态,因此我对问题所在感到困惑。
这是我的连接器配置:
<Connector connectionTimeout="20000" port="6080"
emptySessionPath="true" enableLookups="false"
protocol="org.apache.coyote.http11.Http11NioProtocol"
acceptorThreadCount="4" pollerThreadCount="12"/>
感谢您的任何建议!
I'm using RESTEasy asynchronous (Comet) IO support on Tomcat 6 via the NIO Connector. Currently, TCP connections are getting dropped by the server after each response is sent back to the client.
All documentation I've read on HTTP Connector configuration for Tomcat suggests that it should keep connections alive by default, so I'm puzzled as to what the problem is.
Here's my connector config:
<Connector connectionTimeout="20000" port="6080"
emptySessionPath="true" enableLookups="false"
protocol="org.apache.coyote.http11.Http11NioProtocol"
acceptorThreadCount="4" pollerThreadCount="12"/>
Thanks for any suggestions!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明问题的根源在其他地方(仍在调查并将直接发布一个单独的问题以避免混淆!)。
Tomcat 在几秒钟后释放连接,而不是在响应 HTTP 请求后立即释放连接。在这种情况下,客户端错误地为每个请求创建新的 TCP 连接,而不是重新使用已建立的连接。
It turns out the root of the problem is elsewhere (still investigating and will post a separate question directly on that to avoid confusion!).
Tomcat is releasing the connections after a period of a few seconds rather than immediately on responding to the HTTP request. The client in this case is at fault for creating new TCP connections for each request rather than re-using connections already established.