Sunday, November 10, 2013

How to set the TCP/IP keep alive in Windows

When the database connection is TCP/IP, the server machine utilizes a TCP/IP feature called "Keep-Alive". Keep-Alive packets are used to probe a connection that has been inactive for a long time. The server initiates a disconnect when the probes do not get through. This means that if the client connection is lost for a prescribed length of time, the server sends a disconnect message to its server job (usually the result of a system crash or power-down). The default Keep-Alive setting for Windows is two hours.
Use the following procedure to change these parameters:
  1. Run Registry Editor (REGEDT32.EXE).
  2. From the HKEY_LOCAL_MACHINE subtree, go to the following key:

    \SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
  3. The Value is "KeepAliveTime".
    If present (usually not), double click on it to edit in milliseconds as noted below. Otherwise, continue with Step 4.
  4. Select "Edit -> Add Value".
  5. For Value name, enter KeepAliveTime.
  6. From the Data Type drop down list, select REG_DWORD.
  7. Press OK.
  8. In the DWORD Editor dialog, enter the number of milliseconds. Select the Radix Decimal option.
  9. Select OK.
  10. Enter the Keep-Alive value in milliseconds; i.e., 5 minutes = 300000 msec.

    Valid Range: 1 - 0xFFFFFFFF

    Default: 7,200,000 (two hours)

    The parameter controls how often TCP attempts to verify that an idle connection is still intact by sending a Keep-Alive packet. If the remote system is still reachable and functioning, it will acknowledge the Keep-Alive transmission. Keep-Alive packets are not sent by default. This feature may be enabled on a connection by an application.
  11. After typing in the value, use the "Data Type" checkbox to set the value type.
  12. Select OK.
  13. Exit the Registry Editor.
  14. Reboot the system to make the change take effect.

No comments:

Post a Comment

Test1