Skip to content

Redis core architecture

Redis is a NoSQL in-memory database designed for high performance^[600-developer-redis.md]. It operates primarily as a single-threaded system where data is stored in memory rather than on disk^[600-developer-redis.md].

Performance Model

The high speed of Redis is attributed to its in-memory nature, which avoids the latency of disk I/O^[600-developer-redis.md]. In this architecture, memory size and network bandwidth act as the bottlenecks rather than CPU cycles^[600-developer-redis.md]. By utilizing a single thread for command execution, Redis eliminates the overhead associated with context switching and concurrent resource contention^[600-developer-redis.md].

Network Layer

Redis manages concurrent network connections using an I/O event notification mechanism^[600-developer-redis.md]. It employs the Reactor pattern with epoll to handle I/O events efficiently^[600-developer-redis.md].

Data Persistence

While primarily an in-memory database, Redis supports persistence to ensure data survival across restarts^[600-developer-redis.md]. It utilizes two main persistence mechanisms:

  • RDB (Redis Database)
  • AOF (Append Only File)^[600-developer-redis.md]

Data Types

Redis supports several fundamental data structures, including strings, lists, sets, sorted sets (zset), and hashes^[600-developer-redis.md].

Common Use Cases

Due to its speed and structural flexibility, Redis is employed in various roles such as a database, a cache layer, and a message broker^[600-developer-redis.md].

Sources

  • 600-developer-redis.md