22.2. Tunnel/Mirror (TCP) Heartbeat and Timeout

The DataHub program uses a heartbeat to determine the status of the network connection. The tunnel/mirror slave sends a special heartbeat message to the master at specified time intervals, to detect network failures. If the master does not respond within a certain timeout period, the slave changes the status of its connection to Disconnected and attempts to reconnect.

The overall principle for optimizing the heartbeat and timeout is choosing settings based on the dynamics of the system and how quickly you need to know about a lost connection. With that in mind, we recommend choosing the longest reasonable timeout that fits your needs, and then set the heartbeat to half of that.

Specific Guidelines

  1. The timeout should be at least twice the heartbeat.

  2. The default heartbeat is set to 1 second and the timeout to 5 seconds. That is reasonable LAN timing. If the network or CPU situation could produce temporary timeouts longer than 5 seconds then this timing could cause unnecessary disconnect/reconnect cycles.

  3. When connecting to a DataHub instance over the Internet we recommend setting the heartbeat to 10 seconds and the timeout to 30 seconds. That generally produces a very stable connection.

  4. When connecting to a remote system via a metered connection (usually cellular) we recommend setting the heartbeat to 30 seconds and the timeout to 60 seconds.

  5. A short timeout will notify the DataHub instance quickly when a connection is lost. If you need to know quickly about a lost connection, set the timeout low.

  6. A long timeout makes it less likely that the connection will time out during a temporary event, like a burst of heavy network traffic or a high CPU load on one of the computers. A short timeout under these conditions will cause extra traffic to reconnect the tunnel, and will cause data to temporarily become Not Connected.

  7. A short heartbeat will cause more traffic when the connection is idle. This traffic is not significant on a LAN, but could be important on a metered connection like a cellular modem. If traffic is an issue, set the heartbeat high.

Additional Considerations

Normal ping times on a LAN are less than a millisecond, so you could technically set the heartbeat very low on a LAN. However, Windows O/S time slices are 33 ms, which means that a busy CPU could easily hold off the DataHub instance for tens of milliseconds. We generally do not recommend sub-second heartbeats without a really good reason.

VPNs, proxies and encryption can all have an impact on latency, which can result in transmission delays.