Database Replication Server Selection and Mode Switching
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current database replication systems face challenges in efficiently managing write requests across multiple replication servers, particularly in ensuring data durability and latency while handling asynchronous and synchronous operations, and in dynamically adapting to changing quality guarantees and network conditions.
Innovation Solution
A system where a database server selects a set of replication servers based on acquired mastership, quality guarantees, and user-defined attributes, with the ability to dynamically switch between asynchronous and synchronous replication modes, and adjust the number, location, and cache size of replication servers to optimize data durability and throughput.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If data is written to multiple replication servers to ensure data durability, then reliability is improved, but latency increases due to waiting for confirmations from multiple servers
Solution Approach 1:
The system dynamically adjusts replication mode between synchronous and asynchronous based on quality guarantee levels. For lower durability guarantees, it switches to asynchronous replication where the primary server returns success immediately after sending data to replication servers, without waiting for confirmations. This dynamic adaptation resolves the contradiction by allowing fast writes when maximum durability is not required.
Solution Approach 2:
The system changes the confirmation waiting parameter based on quality guarantee level. When a lower durability guarantee is selected, the system modifies the write operation to not wait for replication server confirmations, effectively changing the parameter from 'wait for confirmation' to 'return immediately'. This parameter change directly addresses the latency issue while maintaining acceptable durability levels.
2Reliability
If the system waits for confirmation from all replication servers before returning success, then data durability is improved, but productivity decreases due to slower write operations
Solution Approach 1:
The system dynamically selects between synchronous and asynchronous replication modes based on the quality guarantee level specified by the user. For performance-critical applications with lower durability requirements, asynchronous mode is used where the primary server does not wait for replication confirmations, significantly improving write throughput. This dynamic selection resolves the contradiction between durability and productivity.
Solution Approach 2:
The system applies partial replication confirmation based on quality guarantee levels. Instead of requiring confirmations from all replication servers for all operations, it selectively applies confirmation waiting only when higher durability is required. This partial action approach maintains productivity for operations that don't require maximum durability while still ensuring durability when needed.
3Reliability
If replication servers are geographically distributed to improve data durability and availability, then reliability is improved, but device complexity increases due to managing distributed servers
Solution Approach 1:
The system employs self-service mechanisms where replication servers independently manage their own data writing and confirmation processes. Each replication server autonomously receives data from the primary server, writes to its local storage, and sends confirmations without requiring complex coordination with other replication servers. This self-service approach simplifies the management of geographically distributed servers while maintaining high availability.
Solution Approach 2:
The system segments the replication process into independent operations at each replication server. Instead of requiring centralized coordination for all replication activities, each server handles its own data reception, storage, and confirmation independently. This segmentation reduces the complexity of managing geographically distributed replication servers while maintaining data availability across locations.
4Reliability
If the system uses synchronous replication to ensure data durability, then reliability is improved, but loss of time increases due to waiting for all replication operations to complete
Solution Approach 1:
The system dynamically switches between synchronous and asynchronous replication modes based on the quality guarantee level. When a lower durability guarantee is specified, the system transitions to asynchronous replication where the primary server returns success to the client immediately after sending data to replication servers, without waiting for their confirmations. This dynamic mode switching resolves the contradiction by allowing fast writes when maximum durability is not required.
Solution Approach 2:
The system changes the replication timing parameter based on quality guarantee levels. For operations with lower durability requirements, the system modifies the replication process to proceed asynchronously, changing the parameter from 'synchronous waiting' to 'asynchronous non-waiting'. This parameter change directly reduces replication time while maintaining acceptable durability levels for the given quality guarantee.
Data Source
AI summary
A database server receives a request from a client application for performing a data transaction on persistent data storage. The request is sent to a set of replication servers. An acknowledgement for the request is received from each replication server, including a start sequence number and an end sequence number for data that is stored in local cache of the replication server, and a latest committed sequence number for data that was written to the persistent data storage by the replication server. A maximum value of latest committed sequence numbers received from the set of replication servers is determined. For each replication server, it is examined whether there is a gap between the start sequence number for data stored in local cache and the maximum value of the latest committed sequence numbers. Based on the examining, it is determined whether there is an occurrence of loss of data.


