Special Client Connection Properties
Client connections can also be tuned for the following special cases:
Client failover after server failure
First-time client connection
The connection properties associated with these cases are already optimized for most typical environments. If you attempt to tune these properties, be sure to thoroughly test the new settings.
Client Failover After Server Failure
When an active Terracotta server instance fails, and a mirror Terracotta server is available, the mirror server becomes active. Terracotta clients connected to the previous active server automatically switch to the new active server. However, these clients have a limited window of time to complete the failover.
Tip: | Clusters with a Single Server - This reconnection window also applies in a cluster with a single Terracotta server that is restarted. However, a single-server cluster must have <restartable> enabled for the reconnection window to take effect. |
This window is configured in the Terracotta configuration file using the <client-reconnect-window> element:
<servers>
...
<client-reconnect-window>120</client-reconnect-window>
<!-- The reconnect window is configured in seconds, with a default value of
120. The default value is "built in," so the element does not have to
be explicitly added unless a different value is required. -->
...
</servers>
Clients that fail to connect to the new active server must be restarted if they are to successfully reconnect to the cluster.
First-Time Client Connection
When a Terracotta client is first started (or restarted), it attempts to connect to a Terracotta server instance based on the following properties:
# -1 == retry all configured servers eternally.
# Must the client and server be running the same version of Terracotta?
l1.connect.versionMatchCheck.enabled = true
# Time (in milliseconds) before a socket connection attempt is timed out.
l1.socket.connect.timeout=10000
# Time (in milliseconds; minimum 10) between attempts to connect to a server.
l1.socket.reconnect.waitInterval=1000
To control connection attempts before configuration is resolved, set the following property on the client:
-Dcom.tc.tc.config.total.timeout=5000
This property limits the time (in milliseconds) that a client spends attempting to make an initial connection.