Coconote
AI notes
AI voice & video notes
Try for free
🏨
Designing a Hotel Booking System
Oct 9, 2024
Hotel Booking System Design
Introduction
Presenter: Sandeep from CodeKarle
Topic: High-level architecture of a hotel booking system, similar to Booking.com or Airbnb.
Functional Requirements
Hotel Manager Functionality
Onboarding onto the platform.
Updating property information (e.g., adding rooms, changing pricing, uploading images).
Viewing bookings and revenue insights.
User Functionality
Searching for properties in specific locations with filters (e.g., price range, property type).
Booking hotels.
Viewing existing bookings.
Analytics
Design should allow for analytics capabilities.
Non-Functional Requirements
Low latency.
High availability.
High consistency: Immediate visibility of booking status.
Scale Considerations
500,000 hotels globally, ~10-12 million rooms.
Hotels can have many rooms; most will not face simultaneous booking of all rooms.
System Design Overview
Components
UI for Hotel Managers
: Website/mobile app for onboarding and property management.
Load Balancer
: Distributes traffic to hotel service.
Hotel Service
: Manages hotel data (CRUD operations).
Database
: Uses clustered MySQL with one master and multiple slaves for scalability.
CDN
: Stores hotel images, with URLs referenced in the database.
Kafka
: Handles event streaming for updates in hotel data.
Search Service
: Uses Elasticsearch for fuzzy searching and filtering.
Booking Service
: Processes bookings and interacts with the Payment Service.
Notification Service
: Sends notifications for bookings and changes.
Booking Management Service
: Allows users to view their bookings, interacting with MySQL and Cassandra.
Analytics
: Uses Hadoop for event log analysis.
Data Flow
Hotel Changes
: Changes flow through Kafka to update search databases.
Search
: User queries are handled by Search Service with Elasticsearch.
Booking Process
: Requests flow through Booking Service, interacting with MySQL and Payment Service. Bookings update available room statuses via Kafka.
Archival
: Completed or canceled bookings stored in Cassandra.
Caching
Redis cache on booking data to reduce load on MySQL.
Detailed Component Overview
Hotel Service
CRUD functionality for hotel data.
APIs include POST (create hotel), GET (retrieve hotel info), PUT (update hotel info).
Database schema includes hotel details, room details, facilities, etc.
Booking Service
Handles bookings through MySQL.
Tracks available rooms and booking statuses (reserved, booked, canceled, completed).
Implements payment handling with timeout for payment processing using Redis TTL.
API Signatures
Book API for creating bookings, checking availability, and managing statuses.
Alternative Approaches
Use of different databases (Postgres, SQL Server) for relational data.
Caching alternatives (Memcache).
Event streaming alternatives (Active MQ, Rabbit MQ).
Monitoring and Alerts
Monitor CPU, memory, and disk usage across services.
Use tools like Grafana for setting up alerts.
Geographic Distribution
Proposed a multi-data center approach for improved latency and availability.
Data centers can be split by region, allowing users to connect to the nearest server.
Conclusion
Overall design aims to meet both functional and non-functional requirements while ensuring scalability, availability, and ease of maintenance.
📄
Full transcript