The Technical Practice of Distributed Locks in a Storage System

1. Background

Figure 1: A distributed lock

2. From Standalone to Distributed Locks

Figure 2: From Standalone to Distributed Locks
Figure 3: Features and Implementation of Distributed Locks

3. System Classification of Distributed Locks

  1. Distributed systems based on asynchronous replication, such as MySQL, Tair, and Redis
  2. Paxos-based distributed consensus systems, such as ZooKeeper, etcd, and Consul

4. Distributed Locks of Alibaba Cloud Storage

4.1 Strict Mutual Exclusion

Figure 4: Scenario of Alibaba Cloud Storage
Figure 5: Cross-Border Scenario
  • Unreliable Wall Time (NTP Time)
  • Heterogeneous systems cannot ensure strict correctness
Figure 6: Heterogeneous Systems Cannot Ensure Exact Data Consistency
Figure 7: Introducing the I/O Fence Capability

4.2 Availability

  • The lock deletion operation is not secure. If the lock is preempted by another user, the lock deletion request will lead to deletion by mistake.
  • After the lock is deleted, the session of the user that holds the lock is still running, and the user thinks he still has the lock. This will break the principle of mutual lock exclusion.

4.3 Efficiency of Switching

Figure 8: The Client and Server Separately Maintain the Expiration Time

5. Conclusion

References

  1. How to do distributed locking — Martin Kleppmann

Original Source:

--

--

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com