job.answiz.com
  • 4
Votes
name

We are regularly experiencing strange issues with networking on our dedicated server. It runs Windows Server 2012 R2 x64 on Xeon E5620 with 16 GB RAM and Intel 82575EB network adapter.

Please note that we've already tuned HKLMSYSTEMCurrentControlSetServicesTcpipParameterskey values TcpTimedWaitDelay and MaxUserPort to 30 and 65530 respectively.

At a random point of time our websites stop responding, the reason being they cannot connect to a local database. It's approximately 2 weeks uptime when this issues start taking place. The system log starts getting TCPIP warnings 4227 and 4231.It states "A request to allocate an ephemeral port number from the global TCP port space has failed due to all such ports being in use.".

If I run

Get-Counter -Counter TCPv4*

or

Get-Counter -Counter TCPv6*

or

netstat -abn | find /c ":"

I always get reasonable value of 500-1500 connections, which is not even close to 65K limit.

Additionally, "localhost" stops resolving to ::1 locally, reverting to 127.0.0.1
Only a forced machine restart can resolve the situation.

Could it be a network adapter problem?

UPDATE 1

It happened again and seemed to have been resolved when I restarted the mail server. Weird though, all the counters showed ~1000 connections with ~500 being active at the moment, and still the 10055 socket error when trying to connect to the database which has nothing to do with the mail server.

UPDATE 2 This IS strange, but the daily restart of the mail services fixes the problem completely.

In addition to the Tcpip driver settings, the ephemeral TCP port range is managed in Windows Server using the netsh command (source).

You can view the dynamic port range with the following commands:

  • netsh int ipv4 show dynamicport tcp
  • netsh int ipv4 show dynamicport udp
  • netsh int ipv6 show dynamicport tcp
  • netsh int ipv6 show dynamicport udp

To change the port range, use this command:

  • netsh int <ipv4|ipv6> set dynamic <tcp|udp> start=number num=range

For example:

netsh int ipv4 set dynamicport tcp start=49152 num=16384

The setting (start=49152 num=16384) is also the default on Windows Server 2008 onwards.

  • 1
Reply Report

Please note that we've already tuned
HKLMSYSTEMCurrentControlSetServicesTcpipParameters key
values TcpTimedWaitDelay and MaxUserPort to
30 and 65530 respectively.

At a random point of time our websites stop responding, the reason
being they cannot connect to a local database.
It's approximately 2 weeks uptime when this issues start taking place.
The system log starts getting TCPIP warnings 4227 and 4231.
It states "A request to allocate an ephemeral port number from the
global TCP port space has failed due to all such ports being in use.".
If I run
Get-Counter -Counter TCPv4*

or

Get-Counter -Counter TCPv6*

or

netstat -abn | find /c ":"

I always get reasonable value of 500-1500 connections, which is not
even close to 65K limit.
Additionally, "localhost" stops resolving to ::1 locally, reverting to
127.0.0.1

Only a forced machine restart can resolve the situation.

Could it be a network adapter problem?

  • 1
Reply Report

I've had similar problem with exhausted pool of TCP/IP ports on WinSvr 2012R2 x64 for almost 1 month where server stopped receiving any new and TCP connections. So I played with registry values and these are stable for me:

[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParameters]
"TcpTimedWaitDelay"=dword:0000001e
"MaxUserPort"=dword:0000fffe
"TcpNumConnections"=dword:00fffffe
"TcpMaxDataRetransmissions"=dword:00000005
  • TcpTimedWaitDelay - 30
  • MaxUserPort - 65534
  • TcpNumConnections - should be in default state stretched to maximum = 16777214 should prevent server from exhausting ephemeral ports.
  • TcpMaxDataRetransmissions - Timeout limit of TCP unacknowledged data segments retransmission on actual connection = 5.

In result same like yours. I think you should consider to audit your behavior of your applications/scripts performance. If everything is ok and nothing help, then you can try to put proxy server before your web application server, make 2 nodes with web server (IIS, Apache, ...) which will share same static content and access same database at the same time (if you have enough resources in your company).

Maybe this article would help you in some way: http://blogs.technet.com/b/tristank/archive/2008/03/11/maxuserport-what-it-is-what-it-does-when-it-s-important.aspx

 

  • 1
Reply Report