Inventory / Engineering notes

Lock before you count the seats

What Slotline serialises, and what its contention test actually measured.

An availability read is not a reservation

Two clients can see the same seat as available. The important read happens after the writer locks the session's inventory row. Slotline then expires old holds using the database clock, counts from the hold and booking records, and decides whether it can commit the requested change.

Every writer takes the same lock

Checkout, expiry, waitlist promotion, and new holds can all change availability. If one path skipped the lock, the others would still race it. The constraint held_count + confirmed_count <= capacity is the last backstop, not the admission algorithm.

Make the losing requests visible

In one local run, 100 requests targeted three seats, with 20 requests in flight at once. Three holds succeeded, 97 were rejected for insufficient capacity, and there were zero timeouts or server errors. That shows the intended outcome for this fixture. It does not establish production-scale throughput.

Slotline case study
All engineering notes