<aside>
ππ»ββοΈ Solution A β http://blog.gainlo.co/index.php/2016/04/19/design-facebook-chat-function/ (kinda sucks)
Solution B β https://eileen-code4fun.medium.com/design-facebook-messenger-438d76639985
</aside>
1. Outline problem, use cases and constraints
Gather requirements and scope the problem.
Design a system very much like Facebook messenger.
Use cases
- User can see who in contacts list is online/offline (if other users make that visible)
- User can send messages to any contact and recipient can get immediately notified
- messages displayed in chronological order
- User can receive messages from any contact in near real-time
- User can participate in group chats
Out of scope
- Searching through a chat history
- Read reciepts
- User sees βnow typingβ notifications for other chat participants
- User deletes messages
- User sends image or video or GIFs
- User authentication/authorization
Constraints and assumptions
- Traffic is not evenly distributed. Some users are heavy users, and some are basically churned.
- Heavy users may send 5,000-10,000 messages a day. Light users 10 or fewer.
- 2,000,000,000 - 2 billion users
- Say 1,000,000,000 active users. 50%.
- Average messages sent per day 100