Skip to content

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
12345CLIENTMembersSERVICEAPI serversSERVICEGatewaySERVICEMessagedata serviceDATABASEMessage cluster

Select a component to see what it is responsible for and which state it owns.

  1. 1Members → API servers: Send, load history, jump
  2. 2API servers → Gateway: New message event
  3. 3Gateway → Members: Push to online members
  4. 4API servers → Message data service: Query by channel (hash-routed)
  5. 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
  1. A live migration follows the same shape every time. See Online data migrations:

    1. Capture new writes in both places, so the new store never falls further behind.
    2. Backfill the past, which has now stopped changing.
    3. Verify by comparing reads from both.
    4. Move reads to the new store, keeping a way back.
    5. Stop writing to the old store.
  2. Check

    Why start dual writes before copying the old data?