--- url: "https://martinfowler.com/articles/patterns-of-distributed-systems/lease.html" titulek: "Lease" h1: "Lease" popis: "Use time-bound leases for cluster nodes to coordinate their activities." jazyk: "" kanonicka: "" drobecky: [] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-13 22:03:56" znaku: 1235 slov: 180 kodovani: "utf-8" sha256: "e83ec47370ccee9027e6b8f0d763a5a0a3a6dd2d60cbbdadab7e35f74c10ea45" --- # 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](consistent-core.html) 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](heartbeat.html) is used by clients to refresh the time-to-live value in the consistent core. for more details go to [Chapter 26](https://learning.oreilly.com/library/view/patterns-of-distributed/9780138222246/ch26.xhtml) of the online ebook at oreilly.com This pattern is part of [Patterns of Distributed Systems](.) [Unmesh Joshi](https://twitter.com/unmeshjoshi) 23 November 2023