Google Calendar Design | Expertifie - sulabh84/SystemDesign GitHub Wiki
- Create an event on the calendar
- Send invite to the users for meeting event
- Look other calendars if they are shared with you or publicly available
- Cancel the meeting
- Modify meeting details and time
- Send notification before at time of the scheduling the meeting, 15 mins before the meeting and 1 min before the meeting -> event creation/Updation
- Send a single notification on meeting cancellation
- Display Holidays on the Calendar -> Good to have
- High Availability (achieve 99999)
- Eventually Consistent with in few seconds
- Latency -> Low Latency
- Reliability -> Maintain Calendar meetings for all the users
- Assumptions
- 100M - DAU (Daily active users)
- 1B Users in total
- on an avg, user will schedule 2 meetings in a day
- on an avg, user will receive 4 meetings in a day
- on an avg, a meeting will be between 3 people
- 100K new users signing up on daily basis
- Capacity
- Users
- Every row in the user table take around 1000 bytes
- 110^91000
- 10^12 bytes = 1 TB
- Calendar Invites
- 300 bytes of data to be stored for every invite
- 100M * 2 * 300 * 365
- 200M * 300 * 400
- 24 * 10^12
- 24 TB
- Users
- QPS
- Read Apis
- 10M login everyday
- GetUserCalendar -> 100M * 2 * 3(Users)
- GetMeetingDetails -> 100M * 4(Meeting in a day) * 3(users in a meeting) * 2(Times user will check in a day)
- 10M + 600M + 2500M
- ~3200M per day
- 3200 * 10^6 / 86400
- 32 * 10^8 / 10^5
- 32000 QPS
- Write Apis
- Register -> 100K
- CreateEvent -> 100M * 2(Meetings in a day)
- UpdateEvent -> 100M * 1(Update of a meeting in a day)
- 100K + 200M + 100M per day
- 300M/86400
- 3 * 10^8 / 10^5
- 3000 QPS
- Read Apis
- APIs
- RegisterUser(UserProfile) -> Write
- LoginUser(UserName, Password) -> Read
- CreateEvent(EventDetails) -> Write
- UpdateEvent(EventDetails, UpdateType) -> Write
- GetUserCalendar(UserId or EmailId) -> Read
- GetMeetingDetails(MeetingId) -> Read
- Tables
- Users
- UserId(PK)
- UserName
- Password -> Encrypted
- CreationTimestamp
- Index on email
- Events
- EventId(PK)
- UserId -> Owner
- CreationTimestamp
- UpdatetTimestamp
- EventDetails
- EventTimestamp
- EventDuration
- List -> Invitees
- MeetingLink
- EventStatus -> (Active, Deleted)
- Index on UserId (Owner)
- EventInvitees
- UserId -> Invitee
- EventId
- PK -> (UserId, EventId)
- Index on UserId
- Notification
- NotificationId
- EventId
- NotificationTime
- EventTimestamp
- Users