This project aims to create an Advanced Redis Clone in C++, offering a high-performance in-memory data structure store with advanced caching and replication features. By leveraging modern C++17/20 techniques, this system delivers low-latency data access, efficient memory management, and a scalable architecture suitable for distributed environments.
Key Features
In-Memory Data Structures: Implement advanced data types (strings, hashes, lists, sets, sorted sets) with O(1) or near O(1) time complexity for core operations.
Asynchronous Event Loop: Employ an epoll/kqueue-based reactor pattern to handle thousands of client connections concurrently.
Replication & Persistence: Support for master-slave replication with optional snapshots or AOF (Append-Only File) style logging.
Advanced Concurrency: Utilize lock-free data structures and a fine-grained concurrency model for high throughput.
Extensible Command System: Easily add custom commands and modules to tailor the data store to specific use cases.
Implementation Details
Networking: Uses a non-blocking I/O model with an asynchronous event loop (epoll/kqueue) for handling client connections.
Data Storage: Custom memory allocator or standard C++ containers (e.g., std::unordered_map, std::vector) optimized for concurrency.
Command Processing: A modular command handler that routes parsed commands to the relevant data structures. Supports adding new commands with minimal overhead.
Replication: Configurable master-slave setup. The master streams updates to slaves, ensuring eventual consistency across nodes.
Persistence: Periodic snapshots or an append-only file (AOF) mechanism to recover from system restarts or crashes.
Testing & Benchmarking: Includes unit tests for data structures and integration tests for command handling. Benchmarking tools measure throughput and latency.