Skip to content

Design a Collaborative Editor (Google Docs), stage 1 of 12: model

Size the problem

Real-time systems fail in ways that depend on numbers: message rates, fan-out factors, connection counts. Work some out before you choose anything. Useful figures: 20,000 connections at peak, about a tenth of users typing at any moment, 5-10 operations per second per typist, and one document with 30 editors and 200 viewers.

System so far· 2 parts
CLIENTEditor clientDATABASEPostgres op log

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

What you need to know

0 of 3 checks done
  1. "Last write wins" on the whole document means: whoever saves second replaces whatever the first person wrote. With two people typing in the same second, someone's sentence disappears.

    Collaborative editing has to merge operations (insert "x" at this point, delete these characters), not replace whole documents.

  2. Work it out

    20,000 people connected, a tenth of them typing at about 7 operations a second. About how many operations a second arrive?
    ops per second