Hybrid Logical Clock Transaction Processing Across Availability Zones
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Distributed databases face challenges in maintaining high-throughput and low-latency transactional loads due to network latency and clock skew issues when using multiple physical clocks across availability zones, leading to inconsistent transaction commits and reads.
Innovation Solution
Implementing a hybrid logical clock (HLC) system with centralized time services within each availability zone, using a two-phase commit protocol and applying a time delay based on clock skew to ensure consistent transaction processing across zones.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If multiple physical clocks are used in different availability zones, then high availability and distributed scalability are improved, but network latency and clock skew cause inconsistent transaction commits and reads
Solution Approach 1:
The system segments the distributed database into multiple availability zones, each with its own local clock, allowing independent operation and high availability while maintaining global consistency through the two-phase commit protocol
Solution Approach 2:
The patent introduces a coordinator node as an intermediary that manages transactions across availability zones. The coordinator collects prepare timestamps from all zones, determines the maximum timestamp, and coordinates the commit process to ensure consistency despite clock skew between zones
2Manufacturing precision
If a single global clock is used, then transaction commit consistency is improved, but network latency increases for distant database instances
Solution Approach 1:
Instead of using a single global clock, the system segments timekeeping into local clocks at each availability zone, allowing database instances to access local time without network latency while maintaining global consistency through coordinated commit protocols
Solution Approach 2:
The system performs preliminary actions by having all database instances prepare their transactions and record prepare timestamps before the actual commit. This preliminary preparation phase allows the coordinator to determine the commit timestamp based on the maximum prepare timestamp, ensuring consistency without requiring distant instances to wait for a global clock
Data Source
AI summary
Transaction processing for a database distributed across availability zones is disclosed, including: determining that a transaction comprising a set of one or more statements is to be executed on a plurality of database servers across at least two availability zones, wherein each availability zone is associated with a respective hybrid logical clock (HLC)-based centralized time service; causing the set of one or more statements to execute on the plurality of database servers across the at least two availability zones; obtaining a plurality of HLC-based prepare timestamps from the plurality of database servers across the at least two availability zones; selecting a maximum HLC-based prepare timestamp to use as a commit timestamp associated with the transaction; and determining whether to return a commit result corresponding to the transaction after a time delay that is determined based at least in part on a predetermined time skew.


