← Lessons

quiz vs the machine

Platinum1780

System Design

The Google Docs Collaboration

Operational transforms reconcile concurrent edits into one consistent document.

6 min read · advanced · beat Platinum to climb

Many cursors, one document

Several people type in the same document at once. Their edits arrive out of order and overlap. The system must converge everyone to the same final text without losing keystrokes.

Operational transformation

Each edit is an operation like insert at position five or delete three characters. When two operations were made against the same starting state, the server transforms one against the other so applying both in any order yields the same result.

  • Edits are modeled as operations with positions
  • Concurrent operations are transformed to account for each other
  • Every client converges to one identical document

A server that orders

A central server assigns a global order to operations and rebroadcasts transformed ops. Clients apply incoming ops against their local state, transforming as needed, and the document stays consistent.

Convergence does not require locking the document. Instead it rewrites concurrent operations so their effects compose cleanly.

Key idea

Model edits as operations and transform concurrent ones against each other through an ordering server, so every collaborator converges to one identical document without locks.

Check yourself

Answer to earn rating on the learn ladder.

1. What does operational transformation accomplish?

2. What role does the central server play?

3. Why is locking the document a poor fit for this product?