KeepAlive Filter

The etch KeepAlive filter is a message filter which periodically checks the health of a connection and resets it if it not responsive. The filter must be added to both sides of the connection to be effective.

KeepAlive Operation

The client periodically sends a request message to the server. The server responds by sending a response message to the client.

Both client and server periodically check to see how long it has been since the last KeepAlive message was received from the other side. If the time since the last KeepAlive message was received is too great, the connection is reset.

KeepAlive Parameters

There are two parameters which control KeepAlive:

  • KeepAlive.delay - the number of seconds between sends (client) and checks (client and server). Value is number of seconds. The default value is 15 seconds.
  • KeepAlive.count - the number of delay intervals without a message before the connection is reset. Value is number of delay intervals. The default value is 4.

The server adopts the settings (per connection) of the client.

KeepAlive SessionNotify

When KeepAlive decides to reset a connection, it also notifies the session with an event:

"KeepAlive resetting dead connection"

KeepAlive Examples

Start KeepAlive with default parameters.

tcp://localhost:4001?filter=KeepAlive

Start KeepAlive with a delay of 60 seconds and a count of 5.

tcp://localhost:4001?filter=KeepAlive&KeepAlive.delay=60&KeepAlive.count=5

KeepAlive Issues

A few issues with KeepAlive come to mind:

  • Client specified parameters override server. Seemed like a good idea at the time. On reflection I think the server settings ought to rule. Centralized management, etc.
  • If a really long running operation is holding up the message receiver thread then the connection will be declared dead and reset. Not necessarily a bad thing, just something to note.
  • Server is passive and only sends a message to client when it receives a message from client. Again, not exactly an issue, just something to note.