When performing a data integration or migration into CRM, it is very common to create a .Net application that transforms the data, then pushes the records into CRM using the WebServices. At times, however, the load of data being pushed to IIS can be more than is acceptable to the default settings in an IIS implementation. At these high load times, the server might post an error stating "Only one usage of each socket address (protocol/network address/port) is normally permitted (typically under load)."
What is happening, is that connections are being repeatedly opened and closed on the webserver. When a connection is closed, the connection goes into a TIME_WAIT state for 240 seconds. This is the default setting. In this case, the IP being used is typically fixed, which means that the variable is the local port. By default ports 1024-5000 are available to be used, which means that using default setting you have approximately 4000 ports to be used during a 4 minute span (240 seconds). So if your code is making more than 16 webservice calls per second, you will exhaust all of the available ports!
To fix this problem, you can make 2 different registry changes on the CRM Application Server.
-
Increase the dynamic port range. As stated above, the default is 5000 but this can be raised up to 65534.
-
Using Regedit, navigate to HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters\MaxUserPort (if this key does not exist, create it as DWORD value)
-
Set the value to 65534, or a value of your choice
-
-
Reduce the amount of time that the connection is in a TIME_WAIT state.
-
Using Regedit, navigate to HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters\TCPTimedWaitDelay (if this key does not exist, create it as DWORD value)
-
Set the value to 30
-
By performing the actions above, you are allowing the server to use a far larger number of available ports, and you also allow the server to recycle them faster. Problem solved!
No comments:
Post a Comment