Hotel reservation is not a joke.
Let’s build an example.
Your system needs to support:
• Search for rooms
• View room details
• Booking a room
• View confirmation details
Do all four features need the same response time?
The answer is NO. The search should be faster, but only about 10% of users will click on view details after a search.
And from there, we can assume that only 3% will reach the next page and book a room.
Search and Details services need low latency, which should be their priority.
On the other hand, your priority for the booking service is resilience, availability, and transactional.
Here is how I would design something like this:
API Gateway
• Acts as a single entry point for all client requests.
• Routes requests to the appropriate service.
Search Service
• Handles room search queries.
• Interfaces with a specialized search index.
Room Details Service
• Retrieves detailed information about a room.
• Uses caching and CDNs for static content.
Booking & Confirmation Service
• Manages room booking transactions and provides booking confirmation details.
• Sends confirmation emails and stores confirmation data reliably.
TL;DR
Search and View Details: Focus on low latency and fast access using caching and indexing.
Booking and Confirmation: Focus on high resilience, transactional integrity, and reliability.
What will you add to make this design better?