Dealing with Contention
Concurrency & locking — optimistic vs pessimistic locking, distributed locks, rate limiting, and the patterns that prevent race conditions, double-spending, and resource exhaustion.
Locking Strategies
Master concurrency control — optimistic vs pessimistic locking, distributed locks (Redlock), and row-level vs table-level locks. Understand the trade-offs between performance and correctness.
Optimistic vs Pessimistic LockingDistributed Locks (Redlock)Row-Level vs Table-Level Locks
Rate Limiting
Control traffic and prevent abuse — token bucket, leaky bucket, sliding window counters, and distributed rate limiting. Protect systems from overload while ensuring fair usage.
Token Bucket AlgorithmLeaky Bucket AlgorithmSliding Window CountersDistributed Rate Limiting