Databases 16 min read

Unlocking Redis: Core Concepts, Architecture, and Persistence Explained

This article introduces Redis as an in‑memory key‑value data‑structure server, explains its primary use cases, walks through deployment options such as single instances, high‑availability, Sentinel and Cluster, and details its persistence mechanisms including RDB, AOF and forking.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Unlocking Redis: Core Concepts, Architecture, and Persistence Explained

What is Redis?

Redis (Remote DIctionary Service) is an open‑source in‑memory key‑value database server that functions as a data‑structure server, making it popular among developers for speed and flexibility.

Unlike simple key‑value stores that iterate or sort data, Redis organizes data by structures from the start, supporting use cases such as publish‑subscribe, streams, and queues.

Redis is often used as a cache in front of a “real” database (e.g., MySQL or PostgreSQL) to reduce load by serving frequently requested or less‑critical data, session information, leaderboards, and aggregated analytics.

Redis Architecture

1. Single Redis Instance

A single instance is the simplest deployment, suitable for small‑scale caching or when sufficient memory and server resources are available. It processes commands in memory and can optionally persist data using RDB snapshots or AOF logs via a forked child process.

2. High Availability (HA)

HA setups use master‑slave replication, where write operations on the master are asynchronously copied to one or more slaves, providing read scaling and fail‑over capability.

3. Redis Sentinel

Sentinel is a distributed system of sentinel processes that monitor master and slave instances, perform automatic fail‑over, provide service discovery, and notify administrators of events. It relies on a quorum of nodes to decide when to promote a slave to master.

4. Redis Cluster

Cluster enables horizontal scaling by sharding data across multiple nodes. Keys are hashed to determine the slot (0‑16383) they belong to; each node owns a subset of slots. Adding a new node involves moving slots rather than individual keys, minimizing downtime.

5. Gossip Protocol

Cluster nodes continuously exchange gossip messages to share health information. If a majority of replicas agree that a master is unreachable, they can promote a replica to maintain cluster availability, provided a quorum is satisfied.

Redis Persistence Models

Redis offers several persistence options to balance durability and performance.

No Persistence : Disables all disk writes for maximum speed, with no durability guarantees.

RDB (Redis Database) : Takes point‑in‑time snapshots at configured intervals. Fast to load but may lose data between snapshots.

AOF (Append‑Only File) : Logs every write operation and replays them on restart, providing higher durability at the cost of larger files and slower writes.

RDB + AOF : Combines both; on restart Redis prefers AOF for reconstruction.

Forking and Write‑Copy‑On‑Write

Redis uses the operating system’s fork() call to create a child process for persistence. The parent and child share memory pages until a write occurs, at which point the kernel copies only the modified pages (copy‑on‑write), allowing efficient snapshot creation without duplicating the entire memory footprint.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

high availabilityrediscachingPersistenceClusterIn-Memory Database
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.