Airbnb's "Booking System" interview question is a classic system design problem focused on designing a scalable hotel or property reservation platform, emphasizing concurrency control to prevent double-bookings, strong consistency, and high availability.
Problem Statement
Design a booking system like Airbnb or Booking.com that handles hotel/property searches, availability checks, reservations, payments, and cancellations. Key challenges include managing inventory under high concurrency (e.g., multiple users booking the last room simultaneously), ensuring no overbooking, supporting real-time updates, and scaling to millions of listings and queries.[1][2]
Functional Requirements
- Hotel Management: Admins add/update/remove hotels, room types, pricing, and inventory.
- Search & Discovery: Users search by location, dates, guests, price, amenities; results personalized via ML.
- Reservation Flow: Check availability, book rooms, view/cancel reservations; prevent double-bookings.
- Payments: Integrate gateways, handle failures/refunds.
- Notifications: Emails/pushes for bookings, changes.[8][1]
Non-Functional Requirements
- Consistency: Strong guarantees—no double-bookings via locking (pessimistic/optimistic) or 2PC/Sagas.
- Concurrency: Handle 1000s of simultaneous bookings per property.
- Latency: Search <500ms, booking <2-3s.
- Availability: 99.9%+ uptime with redundancy.
- Scalability: Horizontal scaling for global traffic, billions of queries.[2][4][1]
Constraints & Examples
No standardized LeetCode-style input/output formats exist; it's open-ended. Example scenarios:
- Concurrency Example: Two users query/book last room at t=0; system must allow only one via atomic checks (SELECT FOR UPDATE or optimistic versioning).[1]
- Scale Estimates: 10M hotels, 1B rooms, 1M daily bookings, 100M searches/day; DB ~TB-scale.[4]
- Edge Cases: Cancellations (policy-based refunds), overbooking tolerance (e.g., 5%), multi-channel (web/mobile/phone).[2][1]
Key Components
| Component | Purpose | Tech |
|-----------|---------|------|
| Search Service | Filtered queries | Elasticsearch[1] |
| Booking Service | Inventory locks | Relational DB (e.g., PostgreSQL w/ locking)[2] |
| Payment Service | Transactions | Saga/2PC[1] |
| Cache | Hot data | Redis[2] |
Solutions stress microservices, CDNs, and ML for ranking/fraud.[1][2]