← All posts
system-designredispythondevopsengineeringbackend

1 Ticket. 8,000 Users. 0 Race Conditions.

2026-01-18 · 1 min read

1 Ticket. 8,000 Users. 0 Race Conditions. 🎟️🛑

I wanted to test if my code could handle a "Thalaivar FDFS" level traffic spike.

So I built a ticket booking engine and attacked it with Locust (100 concurrent users blasting 10,000+ requests).


The Experiment

Without Locks (The Risky Path):

  • Requests: 10,649
  • Tickets Sold: 20 (for 1 seat!)
  • Result: Data Corruption.

Without Lock

With Redis Distributed Locks (The Safe Path):

  • Requests: 10,199
  • Tickets Sold: 1
  • Result: 100% Data Integrity.

With Lock


Why This Matters

In a distributed system, "checking" availability isn't enough. By the time you check, 19 other people have already checked too.

You need Atomic Locking—without it, your inventory system is just a suggestion.

Stack: FastAPI (Async Backend), Redis (SETNX + Lua Scripts for Locking), Locust (Load Testing)