Terracotta 10.5 | Terracotta Server Administration Guide | Connection Leasing
 
Connection Leasing
Why Leasing
When a client carries out a write with IMMEDIATE or STRONG consistency, the server ensures that every client that could be caching the old value is informed, and the write will not complete until the server can ensure that clients will no longer serve a stale value.
Where network disruptions prevent the server communicating with a client in a timely manner, the server will close that client's connection to allow the write to progress.
To achieve this, each client maintains a lease on its connections to the cluster. If a client's lease expires, the server may decide to close that client's connection. A client may also close the connection if it realises that its lease has expired.
Lease Length
When selecting the length of lease, consider the range of possible client to server roundtrip latencies over a network connection that can be considered as functional. The lease should be longer than the largest possible such latency.
On a server that is heavily loaded, there may be some additional delay in processing a client's request for a lease to be extended. Such a delay should be added into the roundtrip network latency.
In addition, leases are not renewed as soon as they are issued, instead the client waits until some portion of the lease has passed before renewing. A guideline suitable for the current implementation is that leases should be approximately 50% longer to allow for this.
Setting long leases, however, has the downside that, when clients are unreachable by a server, IMMEDIATE writes could block for up to the length of a lease.
The default value of leases is currently two and a half minutes.
Lease Configuration
To configure the lease length, add a connection leasing service plugin configuration to the tc-config file. For example:

<tc-config xmlns="http://www.terracotta.org/config"
xmlns:lease="http://www.terracotta.org/service/lease">
<plugins>
<service>
<lease:connection-leasing>
<lease:lease-length unit="seconds">60</lease:lease-length>
</lease:connection-leasing>
</service>
</plugins>
</tc-config>

which configures a lease length of sixty seconds.
Valid values for the unit attribute are: milliseconds, seconds, minutes and hours.
Any positive integer may be used for the value within the lease-length element as long as the length of time configured for the lease length is not more than Long.MAX_VALUE nanoseconds, which is approximately 290 years.

Copyright © 2010-2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.