Chapter 26

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.

The leases are replicated ...

Get Patterns of Distributed Systems now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.