Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  Advanced Search 


January 2002

The TIME_WAIT State's Effect on IIS Performance

RSS
Subscribe to Windows Web Solutions | See More Registry Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

My IIS 5.0 server is usually under a large load, and performance slows periodically. While investigating the problem, I've discovered more than 1000 TCP ports in the TIME_WAIT state. Is this state typical on an active server, and could it be affecting performance?

The TIME_WAIT state is typical, but it can also affect performance. You might want to adjust the amount of time your IIS machine keeps a TCP/IP session open after the client has disconnected. After a connection is closed, the server port goes into a TIME_WAIT state when the client sends the server a FIN packet. By default, the server then keeps the connection alive for 4 minutes. (Internet Engineering Task Force—IETF—Request for Comments—RFC—793 provides the rationale for keeping the connection alive this long.) As long as the server port is in TIME_ WAIT state, no other connections can be made to the port. This default time is protection against delayed network communication from an old session intermingling with communication from a new session and resulting in unpredictable consequences.

Network traffic on today's Internet and intranets is unlikely to have a 4-minute latency. Consequently, you can usually decrease the TIME_WAIT interval to 1 minute or less. This change will cause your server to recycle connections almost four times faster than the default configuration, resulting in more efficient use of your server's resources. You can use the Netstat (netstat.exe) utility to determine how many ports are in the TIME_WAIT state. (For more information about TCP connections and the Netstat utility, see the Microsoft article "TCP Connection States and Netstat Output" at http://support.microsoft.com/support/kb/articles/q137/9/84.asp.)

The setting you need to adjust to change the TIME_WAIT interval doesn't exist by default. You must add the Tcp TimedWaitDelay REG_DWORD value to the HKEY_LOCAL_MACHINE\ SYSTEM\CurrentControlSet\Services\ Tcpip\Parameters registry subkey. Then, you set the delay to the number of seconds (in decimal form):

Value Type: REG_DWORD--
  Time in seconds
Valid Range: 30­300 (decimal)
Default: 0xF0 (240 decimal)

Of course, before you make any changes to the registry, be sure you have a good recovery system in place. For more information about this registry change, see the Microsoft article "TCP/IP and NBT Configuration Parameters for Windows" (http://support.microsoft.com/support/kb/articles/q120/6/42.asp) and the Windows Registry Guide Web site (http://www.winguides.com/registry/display.php/878).

Another factor that can affect performance is that you might be running low on ephemeral ports—ports used to create connections to the client computers from the server and between COM server objects. By default, these ports range from 1024 to 5000, and if you run out of them, connection problems can occur. As the Microsoft article "Unable to Connect from TCP Ports Above 5000" (http://support.microsoft.com/support/kb/articles/q196/2/71.asp) states, you can increase the number of ports available to 65,535. Each port uses 2KB to 4KB of memory, so be certain you have ample RAM to support the number of connections you intend to use. (Each connection requires at least one port.)

End of Article



Reader Comments
That socket (TCP Connection Endpoint) cannot be re-established until TIME_WAIT ends -- which means that connections can still be made to that port. They just can't be made from the same remote IP and remote port addresses that are currently in TIME_WAIT. That port will be able to accept other connections from other addresses/ports.


Anonymous User October 29, 2004 (Article Rating: )


I have an issue where I need to connect through port 27001 and I am getting a TIME_WAIT when running NETSTAT -a on the client pc. We are unable to get the software to read the license files on the server and am wondering when it states TIME_WAIT is is blocking that port in anyway?? I get the feeling it means there is a connection but in reality there hasnt been one? Any info is greatly appreciated.

Anonymous User November 11, 2004 (Article Rating: )


You must be a registered user or online subscriber to comment on this article. Please log on before posting a comment. Are you a new visitor? Register now




Top Viewed ArticlesView all articles
Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

WinInfo Short Takes: Week of November 9, 2009

An often irreverent look at some of the week's other news, including some more Windows 7 sales momentum, some Sophos stupidity, Microsoft's cloud computing self-loathing, more whining from the browser makers, Zoho's "Fake Office," and much, much more ...

Understanding File-Size Limits on NTFS and FAT

A general confusion about files sizes on FAT seems to stem from FAT32's file-size limit of 4GB and partition-size limit of 2TB. ...


IIS and Web Administration Whitepapers Best Practices for SharePoint Backup & Recovery

Meeting Compliance Objectives in SharePoint

Improve SharePoint Performance for Remote Workers

Related Events Managing IT Across Multiple Locations

Check out our list of Free Email Newsletters!

IIS and Web Administration eBooks Web Filtering: An Assessment

Keeping Your Business Safe from Attack: Monitoring and Managing Your Network Security

Related IIS and Web Administration Resources Introducing Left-Brain.com, the online IT bookstore
Looking for books, CDs, toolkits, eBooks? Prime your mind at Left-Brain.com

Discover Windows IT Pro eLearning Series!
Clear & detailed technical information and helpful how-to's, all in our trademark no-nonsense format


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro DevProConnections IT Job Hound
Left-Brain.com Technology Resource Directory asp.netPRO ITTV Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2009 Penton Media, Inc. Terms of Use | Privacy Statement