Distributed Lock Allocation via Service Process ID Inheritance
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
In large-scale cloud computing scenarios, failover events lead to a service-unavailable time window due to the session-based ownership management mechanism of distributed locks, where a restarted client process cannot contend for the ownership of a distributed lock until the original session expires, causing data inconsistency and unavailability.
Innovation Solution
A method is introduced where a unique Service Process ID (SPI) is allocated to each service process, allowing the service replacement process to inherit the ownership of the distributed lock by sending a request to the server before the lifecycle of the lock file expires, ensuring consistent and timely ownership transfer.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If a session-based ownership management mechanism is used for distributed locks, then the correctness and exclusiveness of the distributed lock are guaranteed, but a service-unavailable time window occurs during failover when the restarted client process cannot contend for the distributed lock until the original session expires
Solution Approach 1:
The patent segments the session identification into two independent parts: connection ID and sequence number. This allows the sequence number to be inherited and transferred independently from the connection ID, enabling the restarted process to contend for the lock immediately without waiting for the original session to expire, thus resolving the contradiction between lock correctness and service availability
Solution Approach 2:
The patent performs preliminary action by pre-allocating sequence numbers to processes and storing them in the lock file before failover occurs. When failover happens, the restarted process can immediately use the pre-stored sequence number to contend for the lock, eliminating the waiting period and reducing the service-unavailable time window while maintaining lock correctness
2Reliability
If the lifetime of the distributed lock is updated by periodic heartbeats between client and quorum server, then the session timeout can be determined, but the client needs to negotiate with the quorum server about reasonable session expiration periods to avoid data inconsistency
Solution Approach 1:
The patent implements self-service by enabling the client to autonomously determine session timeout based on its own heartbeat interval and transmission frequency, without needing to negotiate with the quorum server. The client calculates timeout as a multiple of its heartbeat interval, simplifying the mechanism while ensuring both client and server have consistent timeout expectations, thus reducing complexity while maintaining reliability
Data Source
AI summary
A method and device for allocating a distributed lock is provided. A globally unique service process ID (SPI) is introduced for each distributed application service process while guaranteeing correctness of a distributed lock, and the SPI is used to directly manage ownership of the distributed lock. The service replacement process sends to the server a request for inheriting ownership of the distributed lock before the lifecycle of the lock file expires, the inherit request including the SPI.


