Introduction
Modern hardware architectures, characterized by dozens of CPU cores and massive RAM capacities, present a significant opportunity for database performance. However, traditional Database Management Systems (DBMSs) often struggle to scale linearly due to bottlenecks in concurrency control. In systems employing 2-Phase Locking (2PL) or Optimistic Concurrency Control (OCC), worker threads frequently waste cycles managing locks or handling transaction aborts and restarts.
As shown in Figure 1, traditional protocols often lead to deadlocks or validation failures in high-contention scenarios. Furthermore, the standard "one-thread-per-transaction" model fails to exploit fine-grained parallelism within individual transactions.
Methodology: The DGCC Protocol
The Dependency Graph based Concurrency Control (DGCC) protocol addresses these limitations by decoupling concurrency control logic from execution. This approach transforms conflict resolution into a pre-processing step, ensuring contention-free execution. It operates in three distinct phases:
1. Chopping and Batching
Incoming transactions are grouped into batches and "chopped" into smaller transaction pieces, typically corresponding to individual stored procedure calls.
2. Dependency Graph Construction
Before execution begins, DGCC constructs a directed acyclic graph (DAG) of these pieces. The graph incorporates two types of dependencies:
- Logic Dependencies: These ensure that pieces belonging to the same transaction are executed in the correct sequence.
- Time-order Dependencies: These are established between pieces from different transactions that access the same data records, enforcing serializability based on arrival order.
3. Greedy Execution
A pool of worker threads executes the resulting graph. Any piece with an in-degree of zero is eligible for immediate execution. Since all potential conflicts are resolved during the construction phase, the execution phase requires no locks or runtime validation, effectively eliminating concurrency-related aborts.
Key Insights and Results
DGCC's primary advantage lies in its ability to convert a chaotic runtime environment into a structured execution plan. By enabling intra-transaction parallelism, independent operations within a single transaction can be processed simultaneously across multiple cores.
Experimental evaluations using YCSB and TPC-C benchmarks demonstrate DGCC's efficacy. In high-contention YCSB scenarios (80% writes), DGCC achieved up to 4x higher throughput than traditional protocols. While other methods saw performance plateaus or declines as core counts increased, DGCC exhibited superior scalability. Although batching introduces some initial latency, the overall average latency remains competitive because the system avoids the "long tail" of retries associated with traditional concurrency control.
Conclusion
DGCC represents a paradigm shift in concurrency control for multicore in-memory databases. By resolving conflicts upfront through dependency graphs, it maximizes CPU utilization and throughput in high-contention environments. Future work may address challenges related to dynamic access patterns in ad-hoc queries and optimizing for NUMA architectures.
Summary updated