0
0
LLDsystem_design~12 mins

Why booking tests availability and concurrency in LLD - Architecture Impact

Choose your learning style9 modes available
System Overview - Why booking tests availability and concurrency

This system manages booking tests for users, ensuring that test slots are available and preventing double bookings. It must handle many users trying to book at the same time without errors or conflicts.

Architecture Diagram
User
  |
  v
Load Balancer
  |
  v
API Gateway
  |
  v
Booking Service <-> Cache
  |
  v
Database
  |
  v
Message Queue
  |
  v
Notification Service
Components
User
client
Person or system requesting to book a test slot
Load Balancer
load_balancer
Distributes incoming requests evenly to prevent overload
API Gateway
api_gateway
Handles routing, authentication, and request validation
Booking Service
service
Processes booking requests, checks availability, and manages concurrency
Cache
cache
Stores frequently accessed availability data for fast reads
Database
database
Stores persistent booking data and test slot information
Message Queue
queue
Handles asynchronous tasks like sending booking confirmations
Notification Service
service
Sends booking confirmation messages to users
Request Flow - 11 Hops
UserLoad Balancer
Load BalancerAPI Gateway
API GatewayBooking Service
Booking ServiceCache
CacheBooking Service
Booking ServiceDatabase
DatabaseBooking Service
Booking ServiceCache
Booking ServiceMessage Queue
Message QueueNotification Service
Notification ServiceUser
Failure Scenario
Component Fails:Database
Impact:New bookings cannot be saved; availability data may become outdated; users may see stale availability or booking failures.
Mitigation:Reads can still be served from cache for availability; implement database replication and failover to reduce downtime; queue booking requests for retry when DB recovers.
Architecture Quiz - 3 Questions
Test your understanding
Why does the Booking Service check the Cache before the Database?
ABecause the cache stores user personal data
BTo get availability data faster and reduce database load
CTo avoid sending notifications
DBecause the database is only for backups
Design Principle
This design uses caching to speed up availability checks and reduce database load. Concurrency control in the Booking Service ensures no double bookings happen even with many simultaneous requests. Asynchronous messaging decouples booking confirmation notifications, improving system responsiveness and reliability.