Design WhatsApp or Wechat Flashcards
What questions to ask interviewer?
Ask about features: want service available on phones, 1:1 messaging with just text (baseline)
1) One : One text
2) Sent/received/read
3) Push notifications
One to One design/bottleneck
Bob -> Server -> Alice (three components can be asynchronous). Storage optimization = only store in server what is in progress of being delivered
Server architecture
Server has number of queues, used to store messages. Once message is received, its removed from queue. Problem is first message goes to server 1 but Bob is offline, second message goes to server 2 (if server 1 queue is full or something) so Bob may get messages in wrong order
Sent/received/read feature
Server replies to Alice with “sent” notification. Same with “received” when Bob receives message. Bob could send acknowledgment “message” with ID -> doesn’t matter which server it goes through for “read”
Push notifications feature
push notifications are fire / forget. Once server gets ack from Bob that he got push notification, server can delete it. Possibly have separate server just to log push notifications?