System Design: Online Reservation System
You are designing a backend platform to book time-based slots for services or events (e.g., appointments, classes, tables). Each resource offers time slots with a fixed capacity. The system must prevent double-booking under high concurrency and support lifecycle operations.
Assume a single region to start, with the need to scale reads (availability lookups) more than writes (bookings). Payments are out of scope; focus on reservation integrity.
Requirements
-
Core capabilities
-
Create, modify, and cancel reservations.
-
Prevent double-booking and overselling capacity.
-
APIs
-
Specify external-facing endpoints and request/response behaviors.
-
Define idempotency strategy for write APIs.
-
Data model
-
Entities, relationships, and key indexes/constraints.
-
Consistency and concurrency
-
Consistency guarantees for reads/writes.
-
Concurrency control approach to avoid double-booking.
-
Capacity, waitlists, and expiration
-
Capacity checks, holds, waitlist mechanics, and TTL/expiration handling.
-
Trade-offs
-
Optimistic vs. pessimistic locking.
-
Relational vs. NoSQL stores.
-
Centralized vs. sharded inventory.
-
Scaling and reliability
-
Partitioning, caching, queues, rate limiting, backpressure.
-
Monitoring, alerting, and failure recovery patterns.
-
Security and privacy
-
Key risks and mitigations.
-
Deployment
-
Choose between blue/green, canary, and rolling; justify your choice.
-
Product engineering principles
-
What principles and risks do you prioritize when designing features/services?