DEV Community

Cover image for CRDTs vs Operational Transformation for Collaborative Editing
gxqwb
gxqwb

Posted on

CRDTs vs Operational Transformation for Collaborative Editing

Two people typing in one paragraph is a distributed systems problem in an editor's clothes. Operational transformation send each edit to a central server that rewrites it against everything concurrent, so every client applies the same sequence. CRDT-based synchronisation give each character a unique position and let replicas merge without asking anyone. Convergence without a server sounds strong until you count the metadata; a small document sounds strong until the server must never fail.

Operational transformation keeps the document small but needs a central server to order every operation, and its transform function grows with the number of concurrent editors.

Metadata and server load per editor

Part One: What is being compared

These are sold as two implementations of one capability, but they are two answers to where uncertainty is allowed to live.

Both let concurrent edits converge to one document, both preserve cursor positions, and both ship in production editors used by millions of people.

Part Two: The arithmetic

The arithmetic is metadata against coordination. Operational transformation keep a document of characters and send operations that reference positions, so payloads are small and the server holds the canonical order. The cost is a transform function that must handle every pair of concurrent operations, and the work grows with the number of simultaneous editors. CRDT-based synchronisation attach an identifier and a tombstone to every character, which makes merging local and order-independent but inflates the document and needs garbage collection.

Merge behaviour after a partition

The slowest link decides the outcome, and a component win applied to the wrong term in the sum is invisible to the user.

Part Three: Where the model breaks

Intent is where users notice the difference. When two people insert at the same position, operational transformation decide by server order and rewrite the later operation, which usually matches what a person expects. CRDT-based synchronisation order by identifier, which converges but can interleave two concurrent insertions character by character, producing garbled words. Modern implementations add heuristics to avoid interleaving, and those heuristics are where the complexity hides.

CRDTs merge without a coordinator and survive offline edits, at the cost of an identifier and tombstone per character and a garbage-collection problem that never quite ends.

Part Four: The later cost

The operational bill follows the architecture. Operational transformation need a server in the path, a single point of failure and a latency floor, but also a natural place for permissions, history and rate limiting. CRDT-based synchronisation tolerate offline edits, peer-to-peer sync and end-to-end encryption, because no participant needs plaintext to merge. That property is why local-first software keeps choosing CRDTs despite the metadata tax.

Adoption is not a single flip: early movers sit where the variable is extreme, the middle follows once tooling exists.

Part Five: Outside the team

For the person editing on a train, the difference is whether the paragraph merges when the connection returns or whether the editor asks them to pick a version. For the team, it is whether collaboration works inside a boundary where no server may read the text. The daily-life version is a shared notebook versus a scribe in the middle.

People notice reliability, not architecture: whether a screen updates, a bill arrives on time, a service still works in two years.

A fair comparison fixes the editing pattern, the number of concurrent editors and the offline requirement, then prices metadata, merge latency and the server's failure domain. Two clients on a fast link test neither hard case.

Market sizing check

If local-first and encrypted collaboration keep spreading into design and code tools by 2029, the market for CRDT libraries and sync infrastructure is plausibly $500M to $2B a year. The driver is whether plaintext may leave the device.

Treat the numbers as a scale model: the ranking survives the rounding, the exact threshold does not.

The comparison that matters

The comparison that matters is between a small document that needs a sequencer and a larger document that needs nobody. Operational transformation wins for server-trusted, high-concurrency editing; CRDTs win for offline, peer-to-peer and end-to-end encrypted collaboration. Choose by where the truth may live.

A change in regulation, supply or tariffs could invalidate this overnight; it is a snapshot of prices, not a law.

Decide by where the truth may live: a sequencer for server-trusted editing, CRDTs where the text must never be readable by the server.

SOL: HCqPmPJM3NVtS6YrmVaTZYnuP8XZ2PFgQZKT94VK1LkS
If this saved you time, a tip is appreciated.

Top comments (0)