Posts tagged “concurrency”
-
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.
-
Should you lock the row or retry on conflict?
Pessimistic locking (SELECT … FOR UPDATE) vs optimistic retries (a version column) vs a single atomic UPDATE, measured on PostgreSQL 17 at high and low contention, plus 50 buyers rushing the last 10 tickets.
-
Which isolation level should you use, and what does each one let through?
Ten concurrency scenarios, four isolation levels, one PostgreSQL 17 database. A measured matrix of what each level allows, and why the stricter levels move the work into your retry loop.