Keep-Alive
In an open connection, if a client is not requesting data from the server then the NCache client automatically closes the connection for better security and resource management.
Note
This feature can be enabled via manually editing the client.ncconf file and is disabled by default. Alternatively, you can also employ the CacheConnectionOptions
API, by setting EnableKeepAlive
to true and establishing a KeepAliveInterval
.
Keep-alive enabled
The keep-alive enabled
property specifies whether the connection between the client and server should be kept "alive", i.e., if the client is not communicating with its connected servers, keep-alive enabled
property sends heartbeats or pings from the client to server nodes at fixed intervals. This feature is particularly useful if there is a firewall which breaks idle network connections or if it detects connection breakages proactively.
<configuration>
<ncache-server connection-retries="3" ... enable-keep-alive="true" keep-alive-interval="30" />
<cache ...>
</cache>
</configuration>
Note
The default value of connection-retries
is 3, though you can change it as you feel appropriate. You can read more about connection retries, here.
Keep-alive interval
The keep-alive interval
is the interval, in seconds, after which a heartbeat is sent from the idle client to server to sustain the connection. The interval ranges between 1 and 7200 seconds with default set at 30 seconds. If any value is specified out of the range, NCache resorts to using the default value.
See Also
Client Config (client.ncconf)
Communication Reliability
Cache Settings