0
0
LLDsystem_design~12 mins

Hotel, Room, Booking classes in LLD - Architecture Diagram

Choose your learning style9 modes available
System Overview - Hotel, Room, Booking classes

This system manages hotel room bookings. It allows users to view hotels, check room availability, and make bookings. The key requirements are to handle multiple hotels, rooms, and bookings efficiently and ensure data consistency.

Architecture Diagram
User
  |
  v
Load Balancer
  |
  v
API Gateway
  |
  v
Booking Service <-> Hotel Service <-> Room Service
  |                 |                 |
  v                 v                 v
Database           Database         Database
  |                 |                 |
  v                 v                 v
Cache              Cache            Cache
Components
User
client
End user interacting with the system to book rooms
Load Balancer
load_balancer
Distributes incoming user requests evenly across API Gateway instances
API Gateway
api_gateway
Routes requests to appropriate services and handles authentication
Booking Service
service
Manages booking creation, updates, and cancellations
Hotel Service
service
Manages hotel information and details
Room Service
service
Manages room details and availability
Database
database
Stores persistent data for each service
Cache
cache
Speeds up read operations by storing frequently accessed data
Request Flow - 12 Hops
UserLoad Balancer
Load BalancerAPI Gateway
API GatewayBooking Service
Booking ServiceRoom Service
Room ServiceCache
CacheRoom Service
Room ServiceDatabase
DatabaseRoom Service
Booking ServiceDatabase
Booking ServiceCache
Booking ServiceAPI Gateway
API GatewayUser
Failure Scenario
Component Fails:Database
Impact:Booking writes fail, new bookings cannot be saved; reads may still succeed from cache but data may be stale
Mitigation:Use database replication for failover; rely on cache for read operations temporarily; alert system admins for quick recovery
Architecture Quiz - 3 Questions
Test your understanding
Which component first receives the user's booking request?
ALoad Balancer
BAPI Gateway
CBooking Service
DRoom Service
Design Principle
This design uses a layered approach with load balancing, API gateway routing, and dedicated services for hotel, room, and booking management. Caches reduce database load and improve response times. The system separates concerns and ensures scalability and fault tolerance.