redis / redis
Redis is a data structure server whose speed can hide expensive design mistakes
Redis makes counters, caches, queues, indexes, and ephemeral coordination feel immediate. The hard part is deciding which data deserves memory, what failure may lose, and which license actually covers the version and build you ship.
WHAT TO KNOW FIRST
- Redis is most effective when its native structures and atomic commands replace application-side read-modify-write races, not when it is used as an untyped bucket.
- Replication, Sentinel, Cluster, RDB, and AOF solve different availability and recovery problems. None turns every acknowledged write into a guaranteed durable transaction.
- The license is part of the version decision: 7.2 and earlier, 7.4 through 7.8, and 8 or later have different options, and optional Intel vector binaries narrow the available choice further.
01Begin with the command model, not the cache label
The redis/redis repository implements a networked data structure server. A key names a value, but that value can be a string, hash, list, set, sorted set, stream, geospatial index, bitmap, or one of the query-oriented structures integrated into current Redis releases. Commands understand those structures. Incrementing a counter, adding a member to a set, or selecting a ranked range happens at the server rather than through a client that fetches, changes, and writes an entire document.
That model is the durable reason to choose Redis. A rate limiter can use atomic increments and expiry. A leaderboard can use sorted-set scores. A work log can use Streams and consumer groups. The design is weaker when every object is serialized into one large string, because the server can no longer operate on its useful parts and every update may move the whole payload. Start a schema discussion by listing commands, key shapes, cardinality, and retention. If those are vague, the deployment plan is premature.
02Key design determines cost and operability
Redis keeps a global key space per logical database, so names carry much of the model. Consistent prefixes make ownership and observation easier, while hash tags can influence slot placement in Redis Cluster. A key should identify one bounded unit with a known lifetime. Very large collections, a single hot counter, or millions of tiny keys can each create different memory, latency, replication, and migration problems even when the aggregate byte count looks acceptable.
- Give each key family an owner, retention rule, expected cardinality, and maximum value size.
- Prefer bounded operations and paged reads over commands whose work or response grows without a limit.
- Keep cluster slot behavior in mind before a transaction or script needs several related keys.
03Expiration and eviction are separate mechanisms
A TTL expresses when a key should expire. Redis removes expired data through access-time checks and active expiration work, so expiry is an application lifetime rule rather than a promise that every byte disappears at the exact millisecond. Applications must also understand whether an update preserves, replaces, or clears an existing TTL. A session that accidentally becomes immortal after an ordinary write is a data-model bug, not a server performance issue.
Eviction begins when configured memory pressure reaches the maximum-memory policy. Depending on policy, Redis can reject writes or choose keys from an eligible population, using approximations for strategies such as least recently used or least frequently used. Eviction is not backup, expiry, or a fairness guarantee. A cache should tolerate a miss at any time, while authoritative state usually should not be exposed to an eviction policy. Set a hard memory budget, leave room for replication and fork-related overhead, and alert before evictions become the first signal of saturation.
04Persistence is a measured recovery tradeoff
Redis offers snapshotting through RDB and an append-only file through AOF, and deployments can use both. RDB creates compact point-in-time representations that are useful for backup and restart, with possible loss since the last snapshot. AOF records write operations and can sync at different intervals, trading latency and I/O for a smaller loss window. Rewrites compact the log. Neither mode removes the need to test disk capacity, corruption handling, backup transfer, and restoration on the same kind of environment used in production.
Acknowledgement and durable recovery are not identical. A server can confirm a command before bytes are safely persisted under common configurations. Replicas are asynchronous by default, so a promoted replica may also lack recent writes. The correct setup begins with a recovery point objective, not with a copied configuration file. State whether losing a second, a minute, or any acknowledged write is acceptable. If the answer is truly none, validate whether Redis is the system of record or whether a durable database should own the transaction while Redis holds a reconstructable projection.
05Sentinel and Cluster address different topologies
Replication copies a primary's data to replicas and can serve availability and read-scaling designs, subject to consistency tradeoffs. Sentinel monitors non-clustered primary and replica deployments, coordinates failover, and helps clients discover the current primary. It is not a data-sharding layer. A reliable Sentinel deployment needs independent failure domains, clients that understand discovery, and tests for network partitions, delayed replicas, DNS changes, and the period during which failover decisions are made.
Redis Cluster partitions the key space into hash slots across primary nodes, with replicas used for failover. Clients route commands to the node responsible for a slot and must handle redirections and topology changes. Multi-key operations generally require the involved keys to share a slot, which makes key design an architectural choice. Cluster adds horizontal capacity, but also resharding, node replacement, client compatibility, and partial-availability behavior. Do not adopt it merely because one instance may someday be large. First remove oversized keys and confirm the workload actually partitions cleanly.
06Atomic commands help, transactions need precise expectations
Redis processes commands with clear atomicity at the server, which makes operations such as increment-if-present, conditional set, and set membership valuable concurrency tools. MULTI and EXEC queue a sequence for execution without interleaving from other clients, while WATCH supports optimistic checks. This transaction model does not provide the same rollback semantics developers expect from a relational database. A runtime error in one queued command does not generally undo successful commands around it.
07Pub/Sub and Streams are not interchangeable queues
Redis Pub/Sub broadcasts messages to clients that are subscribed at that moment. It is useful for transient notifications, but ordinary Pub/Sub does not retain a durable backlog for a disconnected consumer. If a message must survive process failure, be retried, inspected, or claimed by another worker, an ephemeral broadcast is the wrong contract. Applications should state whether delivery is best effort, at least once, or deduplicated before selecting a messaging primitive.
Streams maintain an ordered log of entries and support consumer groups, pending entries, acknowledgements, and claiming work from failed consumers. Those features enable more durable processing patterns, but they also require trimming, lag monitoring, retry policy, idempotent handlers, and a plan for poison messages. Acknowledging too early can lose work; never acknowledging can grow pending state. Streams can be an excellent local building block when the workload fits Redis operations. They are not an automatic replacement for every dedicated event or message platform.
08Security and day-two operation are part of the design
A Redis endpoint should not be treated as harmless because its protocol is simple. Bind and network rules, protected mode, ACL users, command permissions, TLS where needed, and credential rotation all belong in the production plan. ACLs can limit command categories and key patterns, but permissions must match real client behavior and administrative access should be separated from application identities. Secrets in values remain application data that may appear in persistence files, backups, replicas, diagnostics, and memory snapshots.
09The version and build select the license
Redis licensing cannot be summarized by one timeless badge. The official matrix states that Redis 7.2 and earlier remains under BSD-3-Clause. Releases from 7.4 through 7.8 offer RSALv2 or SSPLv1. Redis 8 and later uses a tri-license: a recipient chooses RSALv2, SSPLv1, or AGPLv3. AGPLv3 is an OSI-approved copyleft license; RSALv2 and SSPLv1 are source-available options with different conditions. Teams should record the chosen version and option, and review the actual terms with counsel when distribution or service use is material.
The build can add another constraint. The repository says optional Intel SVS-VAMANA LeanVec and LVQ optimizations are closed source and available with Redis only under RSALv2 because their license is incompatible with the AGPLv3 and SSPLv1 options. The standard implementation remains available without those proprietary optimizations. This is a good example of why software bills of materials must describe the binary, not just the root repository. Modules, client libraries, visual tools, hosted products, and trademarks can each carry terms different from the Redis server source reviewed here.
A SENSIBLE FIRST HOUR
Start small enough to learn the repo
- Run an official Redis Open Source package or container in a disposable environment, pin the exact major and minor version, and record which license option governs that version.
- Use redis-cli to create a string with a TTL, a hash, a sorted set, and a stream. Inspect types, memory use, and expiry rather than treating every value as an opaque cache blob.
- Enable the persistence mode you expect to use, write test data, stop the process abruptly, and measure what actually returns after restart under the documented durability tradeoff.
- Before production, set memory and eviction policy, create ACL users, enable transport protection where required, define backup and failover ownership, and load test the largest realistic keys and commands.
SOURCE LEDGER
What this review is built on
We use the project repository and first-party documentation. Access, licenses and project direction can change, so recheck the linked source before making a production decision.