Design several large-scale systems
RipplingSoftware Engineer · HR ScreenLast updated
This question tests the ability to design a distributed, high-concurrency reservation system that requires strong consistency for inventory management and low-latency read access for search.
System Design: Global Event Booking Platform
Design a global event booking system (e.g., for concert tickets or sports matches) that handles high-traffic spikes when tickets first go on sale. Millions of users will attempt to purchase a limited number of tickets simultaneously.
Requirements
Functional:
- Users can search for events by location, date, and category.
- Users can view seat availability in real-time.
- Users can reserve seats for a temporary period (e.g., 10 minutes) before completing payment.
- Ensure that a single seat cannot be sold to two different users.
Non-Functional:
- High availability and low latency for seat selection.
- Strong consistency for booking operations to prevent overselling.
- Scalability to handle sudden traffic surges (thundering herd problem).
Scope
Provide a high-level architecture including:
- API design for seat selection and booking.
- Storage schema choice (SQL vs. NoSQL) and why.
- Strategies for handling concurrency during the "check-out" flow.
- Handling the read-heavy load of users checking seat maps simultaneously.
Hints
Hint 1
Consider the trade-offs between using a relational database with row-level locking versus an in-memory distributed store for the reservation state.
Hint 2
Think about how to offload read-heavy traffic from the primary booking database using caching or read replicas.
Hint 3
Address the 'thundering herd' issue by implementing a virtual waiting room or using rate-limiting strategies for initial traffic spikes.
Follow-up questions
- How would you modify your design if you needed to support 'dynamic pricing' that changes based on real-time demand?
- What changes would be necessary to ensure the system remains available for search even if the booking database is undergoing maintenance or is partially unavailable?
- How would you handle a distributed transaction failure where a user pays for a ticket, but the inventory update fails due to a network partition?
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.