Here's a clean, concise summary of the key steps to design a Ticket Booking System (like BookMyShow or Ticketmaster) in a system design interview:
- Functional: Browse/search events by city/date/category → View seat map → Select & hold seats → Make payment → Confirm booking → View/cancel bookings.
- Non-Functional: Handle high concurrency (flash sales), prevent double-booking (strong consistency for seats), low latency, high availability (99.99%), scalability to 10k–100k+ RPS at peak.
- Ask about scale, payment integration, cancellation rules, admin features.
Estimate:
- Daily active users, peak RPS during sales.
- Number of events, seats per show.
- Storage needs (bookings, media).
- QPS for seat availability vs booking.
- Microservices approach: User Service, Event/Catalog Service, Inventory/Seat Service, Booking Service, Payment Service, Notification Service.
- API Gateway + Load Balancer in front.
- Use event-driven design with Kafka/SQS for async communication.
- Separate read path (availability) and write path (booking) → often using CQRS.
Key endpoints:
GET /events?city=...&date=...GET /events/{id}/shows/{showId}/seats(seat map)POST /seats/hold(temporary seat lock)POST /bookings+ payment flowPOST /bookings/{id}/confirmor webhook
- PostgreSQL/RDS (ACID transactions): Tables for Users, Venues, Events, Shows, Seats, Bookings, Booking_Seats, Payments.
- Redis/ElastiCache for fast seat availability and temporary holds (TTL-based).
- DynamoDB for high-scale read/write on inventory if needed.
- Indexes on
show_id + seat_number.
- User views seat map (read from cache/DB).
- User selects seats → Atomically hold seats (temporary reservation with 10–15 min expiry).
- Create pending booking.
- User proceeds to payment.
- On payment success → Confirm booking, mark seats as booked, release other holds.
- On timeout/failure → Auto-release holds via background job.
Concurrency Handling (critical part):
- Optimistic locking (version column)
- Pessimistic locking (
FOR UPDATE) - Redis Lua scripts or distributed locks
- Idempotency keys
- Horizontal scaling of services + Auto Scaling.
- Caching (Redis) + CDN (CloudFront) for static assets/seat maps.
- Sharding by
show_idor city. - Circuit breakers, retries, Saga pattern for distributed transactions.
- Rate limiting & virtual waiting room for flash sales.
- API Gateway + ALB
- ECS/EKS or Lambda for services
- RDS PostgreSQL (Multi-AZ) + DynamoDB
- ElastiCache Redis
- SQS/MSK (Kafka) for background jobs
- S3 + CloudFront for images/tickets
- Step Functions for orchestration
- CloudWatch + X-Ray for monitoring
- Background Jobs: Release expired holds, send notifications (email/SMS/push), generate e-tickets, aggregate analytics.
- Analytics: Real-time (Kinesis) + batch (Redshift/Athena) for sales, revenue, user behavior.
- Notifications & Payments: Integrate Stripe/Razorpay + SNS/SQS.
- Consistency vs Availability (strong consistency only for booking path).
- Handle edge cases: Payment failure, partial booking, network issues, bots/fraud.
- Improvements: Search with Elasticsearch, recommendations, multi-region.
Pro Tip for Interview: Always structure your answer as: Requirements → Estimation → High-Level Design → API + DB → Deep Dive (especially concurrency & booking flow) → Scalability → Trade-offs.
This covers the end-to-end design efficiently in 45–60 minutes.
Would you like me to expand any single step (e.g., only concurrency handling, or only AWS setup), or provide a visual text diagram of the architecture? Let me know!
If time permits, explain following also