sagelearnai

Pattern: Contention

When many users want the same scarce thing at once (the last concert ticket, a flash-sale item, a username, an auction lot), naive read-then-write logic sells it twice. The pattern is about choosing the right concurrency control and, at extreme scale, reshaping demand so the database isn't the battlefield.

In this lesson

  • Learning objectives
  • The race
  • Fixes, from simplest
  • Distributed locks
  • Extreme spikes
  • Self-check

Questions covered

  1. How do you prevent double-booking a seat?
  2. When would you use a distributed lock, and how do you make it safe?

This lesson is part of System Design Interview: Concepts, Patterns & Real Designs. Unlock the full course to read it, take the quiz and track your progress.

See plans →

Last reviewed 2026-11-05.