Open-Source Redis Database Reference Architecture
Scenarios
Remote Dictionary Server (Redis) is an open-source, high-performance key-value database. It supports not only simple strings but also complex data types such as hashes, lists, sets, sorted sets, streams, bitmaps, and geospatial data. Redis primarily supports four deployment modes: standalone, master-replica replication, Sentinel-based high availability, and cluster.
Architecture Principles
Figure 1 shows the Redis reference architecture.
|
Module Name |
Description |
|---|---|
|
eventLoop |
Core mechanism for processing client requests and system tasks. |
|
fileEvent |
Processes network I/O, such as client connections and command requests and replies. |
|
timeEvent |
Processes scheduled tasks, such as periodically deleting expired keys, triggering persistence, or updating statistics. |
|
String, hash, list, set, etc. |
Various data structures supported by Redis. |
|
RedisModule |
A feature introduced in Redis 4.0, which allows developers to write extension modules in languages such as C, C++, and Rust and compile them into dynamic link libraries. Once loaded, these modules behave just like native Redis features. |
|
Append Only File (AOF) |
Records each received write command as a log and provides higher data reliability through the rewrite and fsync policies. |
|
Redis Database (RDB) |
Periodically generates snapshot files (binary dump files) from the in-memory data, making it suitable for large-scale data recovery. |
|
Cluster |
Uses a decentralized horizontal scaling solution, with built-in data sharding and multi-replica support. |
