Lease
Use time-bound leases for cluster nodes to coordinate their activities.
Problem
Cluster nodes need exclusive access to certain resources. But nodes can crash, be temporarily disconnected, or experience a process pause. Under these error scenarios, they should not keep the access to a resource indefinitely.
Solution
A cluster node can ask for a lease for a limited period of time, after which it expires. The node can renew the lease before it expires if it wants to extend the access. Implement the lease mechanism with Consistent Core to provide fault tolerance and consistency. Have a time-to-live value associated with the lease. Cluster nodes can create keys in a consistent core with a lease attached to it.
It's the responsibility of the node that owns the lease to periodically refresh it. HeartBeat is used by clients to refresh the time-to-live value in the consistent core.
for more details go to Chapter 26 of the online ebook at oreilly.com
This pattern is part of Patterns of Distributed Systems
23 November 2023