List functional requirements for the system (Ask the chat bot for hints if stuck.)...
List non-functional requirements for the system...
Estimate the scale of the system you are going to design...
Number of rooms available rooms = 100 approx
Number of users = 1500 approx
Max num of bookings per day per room (considering 30 min meetings with 8 hour workday) = 16
Max total number of bookings per day = 16 * 100 = 1600
Total number of users per day = 150 approx, estimating that 1/10th of the total employees reserve a room
Number of concurrent requests to the system = 5 max. Conference room booking system is not used concurrently.
Read and write volumes are not high. Amount of data stored is also not high as stale data can be moved to tape backup.
Define what APIs are expected from the system...
GET https://
Returns:
{
room id:
room name:
capacity:
}
GET https://
Returns:
{
room name:
location:
capacity:
}
POST https://
Returns:
201 OK with reservationId for successful response
40x if room is unavailable
PUT https://
{
startTime:
endTime:
roomId:
}
Returns:
201 OK if successful
40x if there is a conflict
DELETE https://
Returns:
200 OK if successful
GET https://
Returns JSON array:
{
startTime:
endTime:
reservedBy:
},
{...},
{...}
}
Admin APIs
===========
Add or Remove a room(maintenance or other reasons)
POST https://
{
name:
location:
capacity:
status:
}
Returns: 201 Ok with roomId
DELETE https://
Defining the system data model early on will clarify how data will flow among different components of the system. Also you could draw an ER diagram using the diagramming tool to enhance your design...
As the amount of data is low and read/write load is less, SQL DB like MySQL, Postgres, Oracle etc. are suitable.
Transaction semantics are required and data schema is well-defined so SQL DB must be used.
Rooms DB
==========
Room Id -- Primary Key
Name
Location
Capacity
Status -- available/offline etc. set by admins
Room Availability DB (used for conflict detection for concurrent overlapping booking)
==============
Room Id (Primary Key)
Start
End
ReservationId
Reservation DB
============
Reservation Id
Room Id
Date
Start
End
Reserved By
You should identify enough components that are needed to solve the actual problem from end to end. Also remember to draw a block diagram using the diagramming tool to augment your design. If you are unfamiliar with the tool, you can simply describe your design to the chat bot and ask it to generate a starter diagram for you to modify...
Reservation and Room Service can be microservices for scalability
Explain how the request flows from end to end in your high level design. Also you could draw a sequence diagram using the diagramming tool to enhance your explanation...
Reservation and Room Service can be microservices for scalability
Dig deeper into 2-3 components and explain in detail how they work. For example, how well does each component scale? Any relevant algorithm or data structure you like to use for a component? Also you could draw a diagram using the diagramming tool to enhance your design...
Database design and conflict resolution is an important aspect of this system.
Optimistic Concurrency Control is used in this database. This means that conflicting reservations are rejected at commit time. If 2 requests try to book a room concurrently and the times overlap, the 1st request succeeds and the 2nd fails at commit time. The Room Availability DB is not locked(pessimistic concurrency control) when the 1st request tries to access it.
Explain any trade offs you have made and why you made certain tech choices...
Optimistic Concurrency Control allows only 1 request out of all conflicting requests to go through at a time. It also does not avoid conflict.
However, this approach is used for following reasons:
Try to discuss as many failure scenarios/bottlenecks as possible.
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?