简体   繁体   English

WS客户端中有许多TIME_WAIT连接

[英]Many TIME_WAIT connections in WS client

I am developing a JAX-WS web service client. 我正在开发一个JAX-WS Web服务客户端。 This client is a part of a web application deployed at Glassfish 3.2.1 server and is called from a servlet. 该客户端是在Glassfish 3.2.1服务器上部署的Web应用程序的一部分,可从Servlet调用。 The OS is Windows Server 2003, and I use JDK 6. It sends several hundreds requests in minute to the web service deployed on other machine. 操作系统是Windows Server 2003,我使用JDK6。它在几分钟内将数百个请求发送到部署在另一台计算机上的Web服务。

The problem is that the client generates a growing number of connections in TIME_WAIT status (I can see it in netstat). 问题是客户端以TIME_WAIT状态生成了越来越多的连接(我可以在netstat中看到它)。 I thought that turning on the "keep-alive" option would solve the problem, but it did not happen - the WS client opens new connections instead of reusing connections in TIME_WAIT status. 我以为打开“ keep-alive”选项可以解决问题,但是并没有发生-WS客户端打开新的连接,而不是在TIME_WAIT状态下重用连接。

I tried to tune the option "maxConnections" in Glassfish, but it did not help. 我试图在Glassfish中调整选项“ maxConnections”,但没有帮助。 I have also tried JDK 7 with the same result. 我也尝试过JDK 7,结果相同。

Is it possible to close connection immediately after client request completes, or to reuse existing connection in TIME_WAIT status? 客户端请求完成后,是否可以立即关闭连接,还是可以在TIME_WAIT状态下重用现有连接?

As per the Microsoft KB article on "TCP Connection States and Netstat Output" ( http://support.microsoft.com/kb/137984 ), it is perfectly normal for closed connections to remain in TIMED_WAIT after the client has disconnected. 根据有关“ TCP连接状态和Netstat输出”( http://support.microsoft.com/kb/137984 )的Microsoft KB文章,在客户端断开连接后,关闭的连接保留在TIMED_WAIT中是完全正常的。 This is part of the OS's clean up process. 这是操作系统清理过程的一部分。 There's a fairly good explanation on Super User ( https://superuser.com/questions/173535/what-are-close-wait-and-time-wait-states ). 关于超级用户( https://superuser.com/questions/173535/what-are-close-wait-and-time-wait-states ),有一个相当不错的解释。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM