Issue with CLOSE_WAIT status
I see a number of connections with CLOSE_WAIT status on my production server, and there are few questions. Please advice.
- I know that the windows register has the following parameter:
TcpTimedWaitDelay in the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
According to the Microsoft stuff (http://social.technet.microsoft.com/Forums/en-US/windowsserver2008r2networking/thread/4288d218-fbf9-4489-b869-384a05dea83d/) , the value of the TIME_WAIT by default is 4 minutes. I set up the value in 30 seconds, but it looks like nothing is changed. Moreover, even after 4 mins CLOSE_WAIT connections are still t开发者_如何学JAVAhere.
My questions is how I can change the value of the TIME_WAIT, and see it in action? Should I restart my server?
- Is there any other settings to control the CLOSE_WAIT status in the Windows environment?
Regards, Cyril
CLOSE_WAIT means that the peer has closed the connection and you haven't. The operating system is waiting for you (the local application) to close it.
So close it. Somewhere or other you have missed out.
You're confusing CLOSE_WAIT
and TIME_WAIT
. They're not the same.
See here: http://www.serverframework.com/asynchronousevents/2011/01/time-wait-and-its-design-implications-for-protocols-and-scalable-servers.html for some details on TIME_WAIT and why you might not really want to play with shortening the timeout.
And see here: http://www.sunmanagers.org/pipermail/summaries/2006-January/007068.html and here: http://blogs.msdn.com/b/spike/archive/2008/10/09/tcp-connections-hanging-in-the-close-wait-and-fin-wait-2-state.aspx for details on why you might be collecting sockets stuck in CLOSE_WAIT
- in summary, you're possibly not closing your sockets correctly.
I Will suggest you to use Spring WS because I was facing same issue in my project and I switched to Spring Web Service than my problem resolved.
See the following code,
<bean id="viewCustomerInfo"
class="org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean"
p:serviceInterface="com.javaplex.CustomerInfoInterface"
p:wsdlDocumentUrl="http://127.0.0.1:8080/portal/CustomerInfoPort?wsdl"
p:namespaceUri="http://ws.customergen.com/" p:serviceName="CustomerInfo"
p:portName="CustomerInfoPort">
here is the complete article how to setup spring based beans which give your optimum performance.
http://www.javaplex.com/spring-jax-ws-client-for-best-performance/
精彩评论