1
votes

I am developing a JAX-WS web service client. This client is a part of a web application deployed at Glassfish 3.2.1 server and is called from a 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.

The problem is that the client generates a growing number of connections in TIME_WAIT status (I can see it in 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.

I tried to tune the option "maxConnections" in Glassfish, but it did not help. I have also tried JDK 7 with the same result.

Is it possible to close connection immediately after client request completes, or to reuse existing connection in TIME_WAIT status?

1
You should be looking into why HTTP keep-alive isn't working. - user207421

1 Answers

1
votes

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