Multi-user Chat
Materials — open to everyone, no sign-in
Topic: Multi-user Chat
Interviewer: ken
Level: L5 (Senior)
Additional Resources:
System Design Interview - Design Uber
9/11/2024
YouTube for the event:
Coach Ken LinkedIn:
https://commitway.com/linkedin
WeChat QRCodes
| | | 职场提升俱乐部 |
Multi-user chat system
[41]
Send and receive messages
Group management
[39]
[38]
[21 TB?]
[35]
Pubsub,
Long polling - wait 5 seconds, poll, and backout
Web socket
Web socket - is better and faster. Reduce handshake. Live conversation. Reduce the round trip.
[33]
Device service
Group manager
Message service is stateful
63k connections per server
Use a hash of user ID, by 10
[ in-house device service. ]
[ Use Or zookeeper ]
[30]
How to discover the message service
App -> device service
App -> message service
[26]
Not sure how to manage web socket
Remove device service
Supporting group
1-1 chat
[can we not use 3rd party?]
First connect to device service
Device connects to a message service
[14:38]
Message will contain sender ID and receiver ID
Message service finds receiver’s message service
Add message queue
Kinesis
Topic = same topic for
One reader per shard
[6]
[3]
Use receiver ID as the sharding key
For each shard we have one consumer
[2]
Does the number of shards need to be the same as message service
Yes
No shard number limit
===
Interviewee self review:
Not clear about websocket
Can manage using zookeeper
How to make a stateless system