Redis
Introduction
Redis (Remote Dictionary Server) is an open-source, in-memory data structure store that can be used as a database, cache, and message broker. It supports a wide variety of data structures such as strings, hashes, lists, sets, sorted sets, bitmaps, hyperloglogs, geospatial indexes, and streams. Redis is known for its high performance, flexibility, and support for features like replication, Lua scripting, LRU eviction, transactions, and different levels of data persistence. It is written in C and released under the BSD license.
History
Redis was created by Salvatore Sanfilippo, known online as antirez, and first released in May 2009. The project began after Sanfilippo wrote a small, ad‑hoc in‑memory data store while building a real‑time web log analyzer for his start‑up. Initially, Redis focused on providing fast, simple key–value operations, but quickly evolved to support more complex data structures. In 2010, VMware became the project's sponsor, followed by Pivotal Software and later Redis Labs (now Redis Ltd.). The software has grown into one of the most popular NoSQL stores, widely used for caching, session management, real‑time analytics, and message queuing.
Features
- In‑memory storage – All data is held in RAM for extremely low latency, with optional disk persistence.
- Rich data structures – Supports strings, hashes, lists, sets, sorted sets, bitmaps, hyperloglogs, geospatial indexes, and streams.
- Built‑in replication – Master‑slave replication with automatic failover and Sentinel for high availability.
- Persistence options – RDB snapshots and append‑only files (AOF) for durability.
- Atomic operations – Commands are executed atomically; transactions are supported via `MULTI`/`EXEC`.
- Lua scripting – Server‑side scripts executed atomically using the Lua interpreter.
- Pub/Sub messaging – Built‑in publish/subscribe pattern for real‑time messaging.
- Cluster mode – Redis Cluster provides automatic sharding and distribution across multiple nodes.
- Eviction policies – Supports various cache algorithms (LRU, LFU, TTL, etc.) when memory limit is reached.
- Extensibility – Modules API allows custom data types and commands (e.g., RedisJSON, RediSearch).
Use Cases
Redis is commonly deployed as a cache to accelerate web applications, a session store, a real‑time analytics engine (e.g., leaderboards, counters), a message broker (using Pub/Sub or streams), and a primary database for low‑latency, high‑throughput workloads. Its simplicity and speed have made it a staple in modern microservices and cloud‑native architectures.