Event Looped logoEvent Looped
Practice
Learn
    • Overview
    • Scaling ReadsScaling WritesReal-time UpdatesDealing with ContentionMulti-step ProcessesHandling Large BlobsManaging Long-running TasksSecurity & Access Patterns
    • Key Technologies
    • System Design Problems
  • Company ProblemsNew
  • ArticlesBeta
Interview Preparation
  • Javascript Conceptual
  • Resume Builder
Patterns & Scaling

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.

Pro
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.

Pro
Token Bucket AlgorithmLeaky Bucket AlgorithmSliding Window CountersDistributed Rate Limiting