Distributed Database Client Library Timestamp Calculation
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
In distributed databases, commit wait times are prolonged due to the need for time-based synchronization while holding user-level locks, which can lead to delays and decreased throughput.
Innovation Solution
A client library calculates a tentative timestamp prior to lock acquisition, based on the uncertainty of clocks in the distributed system, allowing the commit process to initiate before locks are acquired, and uses timestamp information to ensure the transaction's timestamp is within the lock-hold interval, thereby reducing commit wait times.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If time-based synchronization is performed while holding user-level locks, then external consistency is guaranteed, but commit wait times are prolonged
Solution Approach 1:
The system performs preliminary actions by calculating the tentative commit timestamp before acquiring locks. The client library computes the commit timestamp based on clock uncertainty bounds prior to lock acquisition, allowing the commit process to be initiated earlier without compromising consistency guarantees.
Solution Approach 2:
The commit process is segmented into distinct phases: timestamp calculation phase (before lock acquisition) and lock acquisition phase. This segmentation allows the timestamp to be determined independently of lock holding, reducing the overlap between critical sections and time-based synchronization requirements.
2Reliability
If commit timestamp is calculated after lock acquisition, then consistency within lock-hold interval is ensured, but transaction throughput decreases
Solution Approach 1:
The commit timestamp is calculated in advance before lock acquisition occurs. The client library computes the timestamp using the formula involving clock uncertainty bounds, allowing the transaction to proceed with lock acquisition without waiting for timestamp calculation, thereby improving throughput while maintaining consistency.
Solution Approach 2:
The system introduces an intermediary mechanism where the client library acts as a mediator between the transaction and the lock management system. The library pre-calculates timestamps and passes them to the transaction, decoupling the timestamp generation from the lock acquisition process and enabling parallel execution.
3Productivity
If commit wait is reduced by using earlier timestamp, then efficiency increases, but clock uncertainty bounds must be carefully managed
Solution Approach 1:
The system changes the parameter used for commit timestamp from the actual lock acquisition time to a pre-calculated tentative timestamp based on clock uncertainty bounds. This parameter change allows earlier commit initiation while the underlying complexity of clock synchronization is abstracted away through the uncertainty bound calculations.
Solution Approach 2:
Each client library instance independently calculates its own commit timestamp based on its local clock and known uncertainty bounds, without requiring complex centralized coordination. This self-service approach reduces the overall system complexity while maintaining efficiency gains from earlier timestamp calculation.
Data Source
AI summary
In a distributed system where a client's call to commit a transaction occurs outside the transaction's lock-hold interval, computation of timestamp information for the transaction is moved to a client library, while ensuring that no conflicting reads or writes are performed between a time of the computation and acquiring all locks for the transaction. The transaction is committed in phases, with each phase being initiated by the client library. Timestamp information is added to the locks to ensure that timestamps are generated during lock-hold intervals. An increased number of network messages is thereby overlapped with a commit wait period in which a write in a distributed database is delayed in time to ensure concurrency in the database.


