customer can search hotel room by type
customer can reserve hotel room
admin can create/update/delete room/hotel
system needs to be consistent, no double booking
system needs to be scalable
system needs to be highly available
do we allow certain percentage of over booking?
do we support hourly booking?
total hotels: 5000
total rooms: 5000 * 200 = 1M
70% booked, 3 days average,
1M * 0.7 / 3 = 230,000
230,000 / 100,000 = 2.3 < 3 TPS
3 / 10% / 10% = 300 QPS
hotel:
GET /v1/hotels/{hotel_id}
POST /v1/hotels/
PUT /v1/hotels/{hotel_id}
DELETE /v1/hotels/{hotel_id}
room:
GET /v1/hotels/{hotel_id}/rooms/{room_id}
POST /v1/hotels/{hotel_id}/rooms
PUT /v1/hotels/{hotel_id}/rooms/{room_id}
DELETE /v1/hotels/{hotel_id}/rooms/{room_id}
room_type:
GET /v1/hotels/{hotel_id}/room_type/{room_type}
reservation:
GET /v1/reservations/{reservation_id}
GET /v1/reservations/
POST /v1/reservations/
DELETE /v1/reservations/{reservation_id}
payment:
POST /v1/payments/
hotel:
hotel_id: INT PK, city: VARCHAR(100), name: VARCHAR(50), addr: VARCHAR(255)
room:
room_id: INT PK, room_number: VARCHAR(10), hotel_id: INT, room_type_id: INT, status: ENUM
reservation:
reservation_id: BIGINT, hotel_id: INT, room_type_id: INT, start_date: DATE, end_date: DATE, total_amount: VARCHAR(20), status: ENUM, guest_id: BIGINT
inventory:
hotel_id:INT, room_type_id: INT, date: DATE,
total_rooms: INT, remaining_rooms: INT
rate:
hotel_id:INT, room_type_id: INT, date: DATE, price: VARCHAR(20),
customer client -> CDN, API gateway -> reservation service -> reservation db, inventory db
customer client-> CDN, API gateway -> hotel service -> inventory db, inventory cache
customer client-> CDN, API gateway -> rate service -> rate db
customer client-> CDN, API gateway -> payment service -> payment db
admin client -> CDN, API gateway -> hotel service -> hotel db
admin client -> CDN, API gateway -> room service -> room db
admin client -> CDN, API gateway -> reservation service -> reservation db
customer client -> CDN, API gateway -> reservation service -> reservation db, inventory db
customer client-> CDN, API gateway -> hotel service -> inventory db, inventory cache
customer client-> CDN, API gateway -> rate service -> rate db
customer client-> CDN, API gateway -> payment service -> payment db
admin client -> CDN, API gateway -> hotel service -> hotel db
admin client -> CDN, API gateway -> room service -> room db
admin client -> CDN, API gateway -> reservation service -> reservation db
scalability:
concurrency:
caching:
Explain any trade offs you have made and why you made certain tech choices...
redundancy on API gateway passive/active
server nodes: N + 1
db: N + 1
allow hourly booking
dynamic pricing
recommendation