Design Discord's Message Storage, stage 9 of 9: defend it
Defend the design
Your interviewer pushes back: "This is a lot of machinery. Why not shard Postgres by channel and be done? And isn't the data service just an extra hop that adds latency?"
System so far· 5 parts
Select a component to see what it is responsible for and which state it owns.
- 1Members → API servers: Send, load history, jump
- 2API servers → Gateway: New message event
- 3Gateway → Members: Push to online members
- 4API servers → Message data service: Query by channel (hash-routed)
- 5Message data service → Message cluster: Read and write one partition
- Request / response
- Asynchronous
- Server push
What you need to know
0 of 1 checks done
"Postgres doesn't scale" isn't true and isn't a defence. A convincing answer names the conditions under which the alternative wins (slower growth, a need for relational queries, more people to run it) and shows which of those conditions doesn't hold here.
Check
"The data service is just an extra hop." What does the hop buy?