Detailed Component Design
Deep dive into 2-3 key components. Explain how they work, how they scale, discuss tradeoffs, capacity, and any relevant algorithms or data structures.
Room search microservice:
- Room and meeting are indexed for search (e.g., room location, meeting start and end time).
- Search index can be refreshed by scheduler.
- Search index is created from read replica of the database.
- When finding an available room, the service will query search index to find existing meetings for the given start and endtime. So the room of these meetings cannot be select. By querying the total rooms and minus the occupied rooms, the remaining rooms are available to book.
Meeting microservice:
- It handles meeting lifecycle: create, update, delete.
- Only meeting owner can update/delete his/her meetings.
- It writes directly to primary database which is reserved for write operation.
- For concurrent writes, it uses meeting room+starttime+endtime lock. Only the caller who acquires the lock can write to DB on the given room and time slot. The later caller operation will fail due to the meeting for the room of a given slot has been occupied.
- Once a meeting is booked. it will raise an event to message queue for async notifications (email to participants)
Room mgr service:
- It handles room inventory and settings.
- Only admin can perform the operation.
- Once a meeting room is offline, it will invalid related meetings for the room within a given time slots and raise events to message queue for notification.
High availability
- Read is the hot path of the system. By enabling search index and separate read and write operations against different DB, we ensure the read/search operations has high throughput.
- When peak traffic happened, it will first be gated by API gateway with token bucket mechanism - end users will be throttle based on IPs.
- Besides, meeting is partition by roomId. Room is partition by location. it can make query faster.