Posts tagged “redis”

  1. Why isn't a Redis lock enough?

    A Redis lock is a lease: it expires whether or not its holder is done. Measured with Redis 7.4 and PostgreSQL 17: a paused holder overwriting newer data, a release that frees someone else's lock, a cron job running twice, and what fixes each.

    · 10 min read · Databases

  2. Why did adding a cache make our data wrong?

    A cache is a second copy of your data with its own rules, and every way it can disagree with the database shows up as a bug. Five failure modes measured with Redis in front of PostgreSQL, and the fix for each.

    · 11 min read · System Design

  3. How does a leaderboard stay sorted under constant updates?

    At a million players, a skip list updated a score in 6 µs and found a player's rank in 3 µs. A sorted array found ranks fast but took 3.4 ms per update; a plain map updated in nanoseconds but needed 22 ms per rank. That's why Redis sorted sets use skip lists. Measured, with the code.

    · 6 min read · Data Structures