Optimistic Concurrency in Multi-Writer Database Systems
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Distributed computing systems face challenges in scaling to meet growing demand for data management and user services without increasing complexity, particularly in ensuring consistent writes across multiple writers in a database hosted on separate computer systems.
Innovation Solution
Implementing optimistic concurrency techniques in a multi-writer database system, where a log-structured database store detects conflicts and resolves them by using a primary write node to select successful writes, allowing non-conflicting writes to proceed quickly and ensuring data integrity through logical ordering and conflict resolution schemes.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If multiple writers are allowed to write to the database concurrently, then write throughput and availability are improved, but data consistency and conflict management become more complex
Solution Approach 1:
The system performs preliminary actions by assigning sequence numbers to write requests before they are executed and storing them in a log-structured database. This preliminary ordering allows the system to detect conflicts after the fact rather than preventing them in advance, enabling concurrent writes while maintaining consistency through post-hoc conflict detection and resolution.
Solution Approach 2:
A log-structured database store acts as an intermediary between multiple writers and the primary database. This intermediary layer receives write requests from multiple writers, stores them with sequence numbers, and manages conflict detection and resolution, thereby isolating the complexity of multi-writer coordination from the writers themselves and enabling them to write concurrently without direct interaction.
2Productivity
If optimistic concurrency control is implemented, then write performance is improved, but conflict detection and resolution overhead increases
Solution Approach 1:
The conflict detection and resolution process is extracted from the critical write path. Write requests are accepted and logged without immediate conflict checking, allowing writes to proceed at high speed. Conflict detection is performed separately by comparing sequence numbers of concurrent writes to the same data, and resolution is handled by selecting the write with the highest sequence number, minimizing the time overhead for conflict management.
Solution Approach 2:
The log-structured database automatically performs conflict detection by examining sequence numbers and maintains data integrity through automated resolution rules (selecting the write with the highest sequence number). This self-service approach eliminates the need for complex coordination protocols between writers, allowing them to write concurrently without incurring significant overhead while the system autonomously manages conflicts.
Data Source
AI summary
Optimistic concurrency may be implemented for multiple writers to a database. Writes to a database from different writers may succeed unless a conflict is detected at the data store for the database. For detected conflicts, a request to resolve the conflict between writes may be submitted to a primary writer, which may determine and provide a resolution of the conflict to the conflicting writers. The data store may then be updated to commit the selected write identified by the resolution of the conflict.


