Skip to main content

Redis

Ten articles on Redis tested on real instances: data structures, Pub/Sub and Streams, Lua, persistence, maxmemory, cache, locks, outages and HNSW search.

This series collects 10 articles (approximately 190 minutes of total reading time), designed for a level Intermediate. The main topics covered are Redis, Redis Sorted Set, Redis Pub/Sub, Redis persistenza.

10Articles190 minTotal reading timeIntermediateLevel
RedisRedis Sorted SetRedis Pub/SubRedis persistenzaRedis maxmemoryRedis lockRedis HNSW

Series Articles

  1. 1

    Redis data structures: Hash, Sorted Set and what they cost

    A hash goes from 136 to 336 bytes and 100,000 uniques fit in 14,392 bytes: Hash, Sorted Set and HyperLogLog measured, and why MEMORY USAGE is an estimate.

  2. 2

    Redis Pub/Sub or Streams: when no consumer is listening

    With Pub/Sub a message with no reader vanishes, with Streams it waits: both strategies tried on Redis 8.0.5 and 7.4.7, with real output.

  3. 3

    Lua in Redis: EVAL, EVALSHA and compare-and-delete

    GET then DEL deletes someone else's lock; a Lua script doesn't. EVAL, EVALSHA, WATCH and the cost of BUSY, measured on Redis 8.0.5 and 7.4.7.

  4. 4

    Does Redis lose data on restart? RDB, AOF and what survives

    Same configuration, two ways to stop Redis: with kill -9 zero of a thousand keys survive, with an orderly shutdown all of them. Measured on 8.0.5 and 7.4.7.

  5. 5

    Redis out of memory: maxmemory, eviction and the OOM error

    A full instance rejects writes or throws keys away. Which policy deletes the data you can't rebuild, measured on Redis 8.0.5 and 7.4.7.

  6. 6

    Spring Cache on Redis: TTLs, a version prefix and deploys

    After a release the cache serves old-code data. A version prefix avoids it without FLUSHALL: what it costs in memory, measured on Redis 8.0.5.

  7. 7

    Redis locks: the DEL with no owner and how to fix it

    An unconditional DEL deletes the lock of whoever took over after the expiry. The flaw reproduced with redis-cli, the fix with a token and Lua, and its limit.

  8. 8

    Redis is down: fail-open or fail-closed, use by use

    JWT revocation, idempotency, locks, tokens and cache each answer differently when Redis is silent. The table from the code and the 2-second timeout measured.

  9. 9

    Measuring Redis: latency, SLOWLOG and memory per key

    The client measured 238 ms per command, the server 1.28 microseconds: how to measure latency, slow commands and bytes per key on Redis 8.0.5 and 7.4.7.

  10. 10

    HNSW in Redis: recall and latency measured on our vectors

    With the defaults Redis's HNSW misses true neighbours: recall 0.94 on 300 real searches. How to measure it with a FLAT and what EF_RUNTIME changes.