In-memory data structure store used as a database, cache, message broker, and streaming engine.

C 74k stars RSALv2 / SSPLv1 / AGPLv3

About

Redis started as a single programmer's solution to a database bottleneck and grew into one of the most widely deployed pieces of server software ever written. The core codebase is C, written to be read as much as to be run — antirez famously prioritized code clarity, and the source files remain some of the most legible systems code available for study.

Version 8.6.1 is the current stable release. The codebase sits around 150,000 lines of C, but its architecture is unusually approachable: a single-threaded event loop handles all client commands, a small set of hand-tuned data structures backs every data type, and persistence is achieved through two complementary mechanisms that represent distinct tradeoffs. Understanding how these pieces connect gives you a clear mental model of why Redis behaves the way it does under load, after a crash, or at the boundary of memory.

The project was created by Salvatore Sanfilippo (antirez) in 2009, open-sourced shortly after, and has been maintained by Yossi Gottlieb and Oran Agra since antirez stepped back as BDFL in 2020. Redis Inc. funds core development. Since March 2024, the project is no longer BSD-licensed — it uses a tri-license of RSALv2, SSPLv1, and (as of May 2025) AGPLv3, a change that prompted the Linux Foundation to launch the Valkey fork.

Architecture

Event loop (ae.c). A single thread drives everything. aeMain() loops continuously, calling aeProcessEvents() to dispatch I/O events via epoll (Linux) or kqueue (macOS/BSD). No threads means no locks on the hot path — commands execute serially, which makes behavior predictable and the source code traceable without needing to follow concurrent execution.

Data structures. Redis exposes data types — strings, lists, hashes, sets, sorted sets, streams — rather than raw byte values. Internally, each type uses one or more compact representations: dict (a hash table with incremental rehashing), listpack (a tightly packed byte array for small collections), and skiplist (a probabilistic linked structure for sorted sets). The choice of representation switches automatically based on element count and size thresholds.

Persistence: RDB + AOF. Redis forks the process to write a point-in-time snapshot (RDB) — the child writes, the parent continues serving commands using copy-on-write memory pages. The append-only file (AOF) records every write command for finer-grained durability. Both mechanisms can run simultaneously. The tradeoffs between them are explicit and documented in the configuration.

Replication and cluster. Replicas connect to a primary and receive a stream of commands after an initial full sync. Cluster mode shards the keyspace across 16,384 hash slots distributed across nodes, with each node aware of the full slot map.

Start here

If you're new to the Redis codebase, the Grand Tour is the right starting point. It traces execution from main() in server.c through the event loop, command dispatch, and into the data structure and persistence layers. Eight stops, roughly 20–30 minutes of reading. No Redis expertise required — basic C reading ability is enough.

Tours

Maintainers

Salvatore Sanfilippo Creator
@antirez

Creator of Redis. Sicilian programmer and security researcher, previously known for creating the Idle Scan TCP technique and hping. Built the first Redis prototype while working on LLOOGG, a real-time analytics product at his company Merzia. Stepped back as BDFL in June 2020, rejoined Redis Inc. in November 2024.

Yossi Gottlieb Core maintainer
@yossigo

Current lead maintainer. Took over day-to-day technical leadership from antirez in 2020. Focused on reliability and the cluster subsystem.

Oran Agra Core maintainer
@oranagra

Co-maintainer alongside Gottlieb. Works on security hardening and the replication system.

Origin Story

Redis: From a Sicilian Startup to a License War

How one programmer's database bottleneck became critical infrastructure for the web -- and what happened when a company had to decide what open source was worth.

Read the full story

Related Projects

Your codebase next

Create code tours for your project

Intraview lets AI create interactive walkthroughs of any codebase. Install the free VS Code extension and generate your first tour in minutes.

Install Intraview Free