[Paper Review] CoroBase: Coroutine-Oriented Main-Memory Database Engine
CoroBase introduces a coroutine-to-transaction model that enables inter-transaction batching in main-memory database engines, allowing lightweight coroutines to hide data stalls via asynchronous prefetching without breaking backward compatibility. On a 48-core server, it achieves up to 2× speedup on read-intensive workloads compared to optimized baselines.
Data stalls are a major overhead in main-memory database engines due to the use of pointer-rich data structures. Lightweight coroutines ease the implementation of software prefetching to hide data stalls by overlapping computation and asynchronous data prefetching. Prior solutions, however, mainly focused on (1) individual components and operations and (2) intra-transaction batching that requires interface changes, breaking backward compatibility. It was not clear how they apply to a full database engine and how much end-to-end benefit they bring under various workloads. This paper presents \corobase, a main-memory database engine that tackles these challenges with a new coroutine-to-transaction paradigm. Coroutine-to-transaction models transactions as coroutines and thus enables inter-transaction batching, avoiding application changes but retaining the benefits of prefetching. We show that on a 48-core server, CoroBase can perform close to 2x better for read-intensive workloads and remain competitive for workloads that inherently do not benefit from software prefetching.
Motivation & Objective
- Address the challenge of data stalls caused by pointer chasing in main-memory database engines due to CPU-memory performance gaps.
- Overcome the limitations of prior software prefetching techniques that require application-level changes via multi-key interfaces or focus only on individual operations.
- Enable end-to-end performance improvements in a full database engine by supporting inter-transaction batching while maintaining backward compatibility.
- Design a coroutine-based execution model that efficiently overlaps computation and data prefetching across transactions using lightweight context switching.
- Evaluate the real-world performance impact of coroutine-based prefetching across diverse workloads in a production-grade database engine.
Proposed method
- Model database transactions as coroutines to enable fine-grained, cooperative multitasking and inter-transaction batching.
- Introduce a two-level coroutine design: a lightweight coroutine per request and a higher-level coroutine scheduler to manage batching across multiple transactions.
- Insert prefetch and suspend operations in sequential code at pointer dereference points to overlap memory access with computation.
- Use C++20 coroutines to simplify implementation of asynchronous, pipelined execution without low-level state machine management.
- Maintain backward compatibility by allowing existing single-record transaction interfaces to coexist with coroutine-based batching.
- Optimize coroutine frame management to reduce memory footprint and switching overhead, balancing performance and resource usage.
Experimental results
Research questions
- RQ1Can coroutine-based software prefetching be effectively applied at the full database engine level without requiring application changes?
- RQ2How much end-to-end performance improvement can be achieved by enabling inter-transaction batching via coroutines compared to intra-transaction or point solutions?
- RQ3What is the performance impact of coroutine-to-transaction batching on workloads that do not inherently benefit from prefetching?
- RQ4How does the two-level coroutine design balance performance, memory overhead, and switching cost in a high-concurrency environment?
- RQ5To what extent can coroutine-based prefetching hide data stalls in real-world database workloads on modern multicore servers?
Key findings
- CoroBase achieves up to 2× speedup on read-intensive workloads by effectively hiding data stalls through inter-transaction batching using coroutines.
- The coroutine-to-transaction model enables transparent performance improvements without requiring changes to existing application interfaces or transaction APIs.
- On workloads that do not benefit from prefetching, CoroBase remains competitive with highly optimized baselines, indicating minimal performance regression.
- The two-level coroutine design reduces memory footprint and switching overhead, achieving better performance than single-level coroutine models.
- Inter-transaction batching significantly increases prefetching opportunities compared to intra-transaction batching, especially for short or single-record transactions.
- The use of C++20 coroutines simplifies implementation of software prefetching while maintaining low switching costs, making it practical for production database engines.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.