System Design: How Slack Works?
How Slack Delivers One Message to Thousands of People!
When someone posts in a big Slack channel, two separate things happen. First, Slack saves the message so people can read it later. Slack splits its data across many MySQL databases, called shards, and each shard stores a group of channels. A layer called Vitess checks which shard holds the channel and sends the message there.
Second, Slack delivers the message live. When you open the Slack app, it connects to the nearest gateway server and keeps that connection open. Each gateway asks the channel servers to send it updates for the channels its users are in. When a new message comes in, the channel server sends one copy to each gateway, and the gateway passes it on to all of its users. If your app is closed, you get the message from the database the next time you open it.
Did you expect saving and delivering to be two separate jobs? Comment below.
#SystemDesign #Slack #WebSockets #DistributedSystems #BackendEngineering #RealTime #MySQL #DatabaseSharding #Vitess #SoftwareEngineering #DevOps #KodeKloud #Shorts
KodeKloud
...