https://codefarm0.medium.com/building-a-ticketing-...
Erstellt am: 27. Januar 2026
Beantwortet mit GPT-5.2 Thinking von Chat01
Erstellt am: 27. Januar 2026
Beantwortet mit GPT-5.2 Thinking von Chat01
Here’s the gist of that Medium post (Arvind Kumar, Oct 30, 2025) and the concrete concurrency approaches it walks through. (Medium)
When a ton of people hit “Book” at the same time, the core failure mode is the classic read → decide → write race: multiple requests can read “seat is available” before any of them writes “seat is booked,” causing double-booking. (Medium)
A PoC repo based on the article lays these out very clearly (schema + sample queries + load-test behavior): (GitHub)
Naive (what not to do)
Read is_booked, then later UPDATE it—easy to break under concurrency. (GitHub)
Pessimistic locking (DB row lock)
Use a transaction + SELECT ... FOR UPDATE so only one transaction can “own” that seat row while deciding. (GitHub)
version column; update only if the version you read is still current (UPDATE ... WHERE id=? AND version=?). If 0 rows updated → conflict → retry/return failure. (GitHub)SET key value NX PX ...) before you touch the DB, so multiple app instances coordinate. (GitHub)The article’s ToC includes a “complete booking flow” + edge cases. (Medium) In practice, you usually combine one of the above with:
If you tell me what stack you’re using (Postgres/MySQL, Redis yes/no, monolith vs microservices), I can translate this into a concrete “do this, not that” implementation checklist.