Design Discord's Message Storage, stage 7 of 9: change it
Move trillions of messages, live
Messages keep arriving throughout. The old cluster must stay correct until the very end.
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 2 checks done
A live migration follows the same shape every time. See Online data migrations:
- Capture new writes in both places, so the new store never falls further behind.
- Backfill the past, which has now stopped changing.
- Verify by comparing reads from both.
- Move reads to the new store, keeping a way back.
- Stop writing to the old store.
Check
Why start dual writes before copying the old data?Think first
Copying trillions of rows takes days. Why checkpoint each token range?