Practice/Meta/Design Car Rental Service System
Design Car Rental Service System
System DesignMust
Problem Statement
Design a system that enables travelers to search for hotels across thousands of cities, compare room availability and pricing, and complete reservations with instant confirmation. The platform must handle millions of daily searches and thousands of concurrent bookings during peak travel seasons, ensuring no room is double-booked while maintaining sub-second search latency.
Your system should support hotel operators uploading inventory with room types, pricing calendars, and amenities, while customers can filter by location, dates, price ranges, star ratings, and features like free WiFi or breakfast. The booking flow must coordinate inventory locks, payment processing, confirmation emails, and cancellation policies. Consider that popular destinations experience massive traffic spikes during holidays, while inventory at a single hotel is limited and highly contested during major events or conferences.
Key Requirements
Functional
- Hotel search -- Users search by city/coordinates and date range, with filters for price, amenities, star rating, and guest reviews, returning available properties with real-time pricing
- Room booking -- Users select a room type and complete a multi-step reservation including inventory hold, payment authorization, confirmation number generation, and email notification
- Reservation management -- Users view upcoming and past bookings, modify dates (subject to availability), cancel with refund per policy, and receive status updates
- Inventory management -- Hotel operators upload room types, set availability calendars, configure dynamic pricing rules, blackout dates, and manage booking restrictions
Non-Functional
- Scalability -- Support 10 million searches per day and 50,000 bookings per hour during peak periods, with horizontal scaling across regions
- Reliability -- Ensure zero double-bookings through strong consistency on inventory writes, with 99.9% uptime for booking transactions
- Latency -- Search results must return within 500ms at p99, booking confirmation within 2 seconds end-to-end including payment gateway calls
- Consistency -- Eventual consistency acceptable for search index updates, but strong consistency required for reservation commits and inventory decrements
What Interviewers Focus On
Based on real interview experiences, these are the areas interviewers probe most deeply:
1. Inventory Consistency and Double-Booking Prevention
The core challenge is preventing two users from booking the last available room simultaneously while maintaining high throughput. Naive read-then-write creates race conditions that oversell rooms.
Hints to consider:
- Use a two-phase reservation with an atomic inventory hold (optimistic locking or SELECT FOR UPDATE) followed by payment and confirmation
- Implement TTL-based temporary holds that automatically release inventory if users abandon checkout
- Consider row-level locking strategies versus distributed locks for different booking volumes
- Design compensating transactions for payment failures after inventory is decremented
2. Search Performance at Scale
With millions of properties and complex filtering requirements, a relational database alone cannot deliver sub-second search across geospatial queries, date ranges, and faceted filters.
Hints to consider:
- Separate read and write paths with a dedicated search index (Elasticsearch or similar) updated asynchronously via event streams
- Pre-compute availability snapshots for common date ranges and cache aggressively at CDN and application layers
- Partition search indexes by geographic region to reduce query scope and enable regional deployments
- Handle stale data gracefully by re-validating availability before final booking confirmation
3. Dynamic Pricing and Calendar Management
Hotels adjust prices based on demand, seasons, events, and booking lead time. Your data model must efficiently store and query pricing across millions of property-date combinations.
Hints to consider:
- Model pricing as time-series events or ranges rather than daily rows to reduce storage for unchanging periods
- Cache hot pricing lookups (next 90 days for popular hotels) with periodic refresh
- Support bulk pricing rules (weekend surcharge, holiday blackouts) that apply formulas rather than storing every date explicitly
- Consider how minimum stay requirements and advance booking windows affect search results
4. Booking Workflow Orchestration
A reservation involves sequential steps across inventory, payment gateway, email service, and loyalty systems. Failures at any stage require careful rollback or retry logic.
Hints to consider:
- Use a saga pattern or workflow engine (Temporal, AWS Step Functions) to coordinate the multi-step booking process with compensations
- Implement idempotency tokens to safely retry payment authorizations without duplicate charges
- Design for partial failures such as inventory locked but payment gateway timeout, requiring async reconciliation
- Queue confirmation emails and non-critical steps to avoid blocking the critical path to booking success
5. Geographic Distribution and Data Locality
Global travelers search for hotels worldwide, but most searches and bookings cluster around popular cities and home regions. Data placement affects latency and costs.
Hints to consider:
- Replicate hotel metadata and availability summaries globally while keeping reservation records in regional clusters for data sovereignty
- Route search queries to the nearest regional search cluster but coordinate bookings through the hotel's home region for consistency
- Use CDN caching for static hotel images, descriptions, and reviews to reduce origin load
- Handle cross-region booking scenarios where a user in Europe books a hotel in Asia, considering payment processing locality