Part 1 of 8 · 1 min read
Why this page comes last in Level 11
In this module you will
- Scope a hotel booking system and work out its small write rate from first principles.
- Design the data model, with an inventory row for each room type and date.
- Stop a double click from making two reservations, using an idempotency key.
- Compare pessimistic locking, optimistic locking and database constraints, and pick one.
- Scale with sharding and an inventory cache, and explain why the database stays the source of truth.
Every earlier case in this level was about reading a lot of data fast. A booking system is the opposite: the load is small, but the answers must be exactly right. Two people must never get the last room. It brings in transactions, locks and idempotency (Level 5 and Level 8) in a real setting, and prepares for the payment case in Level 12. The book used is "System Design Interview, Volume 2" by Alex Xu, the hotel reservation chapter. Numbers marked "made up" only show the idea.