-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Feature Title
Implement MVCC (Multi-Version Concurrency Control)
Feature Description
Add support for Multi-Version Concurrency Control (MVCC) to zcached. MVCC will allow the database to handle concurrent read and write operations efficiently by maintaining multiple versions of data. This will enable readers to access consistent snapshots without blocking writers, improving performance and consistency under high concurrency.
Motivation
Currently, zcached does not support concurrent transactions efficiently. Without MVCC, readers and writers may block each other, leading to reduced throughput and increased latency. MVCC will solve this by allowing multiple transactions to operate on the database simultaneously, providing snapshot isolation and improving the user experience for applications with high concurrency requirements.
Proposed Solution
- Design and document an MVCC model suitable for zcached’s in-memory architecture.
- Implement versioned storage for keys/values, associating each version with a transaction or timestamp.
- Ensure readers can access a consistent snapshot of the data as of the start of their transaction.
- Writers will create new versions of data without blocking readers.
- Implement garbage collection to remove obsolete versions once they are no longer needed.
- Add tests for concurrent read/write scenarios to verify correctness and performance.
- Update documentation to describe MVCC behavior and configuration options.
Alternatives Considered
- Traditional locking mechanisms (mutexes, read-write locks): simpler but can reduce concurrency and performance.
- Optimistic concurrency control: may be less suitable for high-write workloads compared to MVCC.
Additional Context
- Consider memory overhead and performance trade-offs of storing multiple versions.
- Reference: Wikipedia - MVCC
- This feature will make zcached more competitive with other modern in-memory databases.