Grokking Redis
0% completed
7.4 Redis Locks vs Database Locks
A lock that expires on a timer can be held by two workers at the same moment, and the lock server cannot prevent it. If worker A pauses for longer than its lock's time to live, the lock expires, worker B acquires it, and worker A then wakes up still believing it is the holder. Every lock design in this comparison has to answer what happens next.
The answer depends on the cost of a double hold. Take one running example, order 42 in a checkout service
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%