Leases & Fences— Distributed Design Patterns
Ensuring consistency of critical data for which we want to have exclusive access, can be achieved through locking. However, in a distributed setup, we can run into scenarios where because of a network partition, process pauses or nodes go down. This leads to the resources being locked indefinitely!
Leases
To overcome the above problem, we make use of leases.
Leases are time-bound locks, where the locks are automatically released by the system managing them after a timeout.