Merging concurrent edits
When two devices hold copies of the same data and both change it before they can talk, the copies must be merged. Four methods are in use: conflict-free replicated data types (CRDTs), last-writer-wins, operational transformation (OT) and server reconciliation. Each trades a guarantee against a cost.
The main disputes concern three questions. How much memory do CRDTs cost? Can text edits from different people merge without interleaving their words? Does an app with a central server need CRDTs at all?
This article covers the merge methods. For the idea of keeping the primary copy of data on the user’s device, see Local-first software; for browser storage and offline caching, see Offline web apps.
Four methods and what they guarantee
Each method gives a different guarantee and charges a different price. Reconciling optimistic replication, where replicas accept edits before they synchronise, is generally complex, and ad-hoc approaches are error-prone (Shapiro et al., 2011).
| Method | Guarantee | Cost |
|---|---|---|
| CRDT | Replicas converge without foreground synchronisation | Metadata can grow without bound; text can interleave |
| Last-writer-wins | A total order without consensus | Some updates are lost |
| Operational transformation | Concurrent operations are transformed against each other | Restricted operation types; decentralised algorithms often wrong; server load |
| Server reconciliation | The server’s order is final | Undoable data structures; costlier remote updates |
CRDTs
A CRDT is a data type designed so that replicas of a shared object converge without foreground synchronisation (Shapiro et al., 2011). Replicas can proceed independently, stay available during network partitions and converge deterministically (Almeida, 2023). Their costs are metadata that some designs let grow without bound, and garbage collection that needs weak synchronisation (Shapiro et al., 2011).
Last-writer-wins
Last-writer-wins keeps the most recent write and discards the rest. It gives a total order without consensus, but some updates are inherently lost (Shapiro et al., 2011).
Operational transformation
In OT, operations do not commute by design, so the order in which they are applied matters. A replica that receives an operation transforms it against concurrent updates before applying it (Shapiro et al., 2011). Oster and colleagues showed that most OT algorithms for a decentralised architecture are incorrect (Shapiro et al., 2011). OT also restricts the operations a system can use, and the number of transformation cases grows quadratically with the number of operation types. With many simultaneous active users it can struggle, and the server keeps an operation log (Weidner, 2024).
Server reconciliation
Server reconciliation lets a client apply its own edits at once and then defer to the server’s order. The client undoes its pending local operations, applies the remote ones, then redoes the pending ones (Weidner, 2024). It needs special support from the local data structures, and the undo and redo make remote updates costlier (Weidner, 2024). Replicache, a sync library, rebases pending mutations onto the server’s patch and treats the server as authoritative (Rocicorp LLC, n.d.).
Interleaving in shared text
Both CRDTs and OT can merge concurrent insertions at the same position into interleaved, unreadable text (Weidner & Kleppmann, 2025). The authors of the Fugue algorithm say most existing replicated-list algorithms have this flaw and that the problem went unnoticed for decades. They define a property called maximal non-interleaving and prove that their FugueMax algorithm satisfies it. Fugue performs comparably to state-of-the-art CRDT libraries (Weidner & Kleppmann, 2025).
Metadata growth and cleanup
Studies disagree on whether CRDT memory cost is a serious problem. For many CRDT types, the metadata that orders operations and handles removals grows without bound, and this is an open issue (Bauwens & Gonzalez Boix, 2019; Bauwens & Gonzalez Boix, 2020). The local-first authors report that Automerge performance and memory and disk use became a problem because CRDTs store all history (Kleppmann et al., 2019).
Cleaning up the metadata is not coordination-free. Garbage collection by causal stability, meaning knowing that every replica has seen an update, can start only after causal information has arrived from every node. If one replica performs no operation, no metadata can be removed (Bauwens & Gonzalez Boix, 2019; Bauwens & Gonzalez Boix, 2020). To the best of the authors’ knowledge, only one earlier work proposed a general scheme for removing CRDT metadata. It assumed a fixed network with a known number of replicas (Bauwens & Gonzalez Boix, 2019).
The Fugue authors argue the reverse for text. On a real editing trace, a text CRDT used about 23 bytes per character, or 13 counting tombstones (markers left for deleted characters). They say this refutes the common criticism of excessive per-character overhead. Simpler variants used 618 and 685 bytes per character (Weidner & Kleppmann, 2025).
A newer algorithm, Eg-walker, targets the same problem from another side. Its authors report an order of magnitude less memory than existing CRDTs in the steady state, and merges of long-running branches orders of magnitude faster than OT. They describe CRDTs as slow to load and memory-hungry, and OT as slow to merge files that diverged during offline editing (Gentle & Kleppmann, 2025). In their evaluation, their own OT implementation took 6 seconds on one asynchronous trace and 1 hour on another (Gentle & Kleppmann, 2025).
Whether a central server needs CRDTs Weak evidence: few or small studies support this
Authors disagree on whether CRDTs are needed when a central server exists. The 2019 local-first paper says CRDTs have the potential to be a foundational technology for local-first software (Kleppmann et al., 2019). Weidner argues that with a central server, CRDTs and OT are only optimisations over server reconciliation, and calls such architectures likely overkill (Weidner, 2024). He adds that the hard parts of CRDTs and OT remain useful for decentralised collaboration (Weidner, 2024). A CRDT is not required, he says, for optimistic local updates in collaborative text editing with a central server (Weidner, 2025).
The dispute is also part of the question of whether server-authoritative apps count as local-first software.
Developer experience and invariants Weak evidence: few or small studies support this
Evidence on whether CRDTs make collaborative apps easier to build is thin. Slides from a study of CRDT libraries state that no known user study had evaluated whether CRDTs help create multi-user apps (Zhang et al., n.d.).
Merging without conflicts does not keep application rules true. The authors of LoRe say existing local-first tools leave developers to reason about concurrent interactions without automated safety guarantees. Their model verifies developer-supplied safety properties and uses strong consistency through coordination only where required (Haas et al., 2023). The authors of ConLoc likewise say enforcing application-level invariants over replicated data is a challenge that developers handle by manual synchronisation (Köhler et al., 2025).
Further reading
- Shapiro and colleagues (2011), the foundational study of CRDTs, which also compares them with last-writer-wins and OT (Shapiro et al., 2011).
- Weidner (2024), a practitioner’s comparison of architectures for apps with a central server (Weidner, 2024).
- Weidner and Kleppmann (2025), on interleaving and the Fugue algorithm (Weidner & Kleppmann, 2025).
- Bauwens and Gonzalez Boix (2020), on why CRDT metadata is hard to remove (Bauwens & Gonzalez Boix, 2020).
- Gentle and Kleppmann (2025), the Eg-walker memory and merge benchmarks (Gentle & Kleppmann, 2025).
First published ; last updated .
Known gaps
What this article cannot tell you yet.
- The original operational transformation paper and later work on the correctness of OT algorithms were not researched.
- No independent benchmark of CRDT memory on long-lived documents was found; the memory figures come from the authors of the algorithms.
- Results of the programmer-experience study of CRDT libraries are not covered beyond one statement in its slides.
- No peer-reviewed study of data loss or complexity cost in deployed local-first web apps was found; the evidence on costs concerns algorithms.
- The full text of the Simba paper on consistency in mobile sync was not available.
References
- Solid source
- Rated highly trustworthy by the research, and every passage taken from it was found in it.
- Weak source
- Rated low, or a passage taken from it was not found in it.
- Medium trust
- Rated medium by the research.
- Not checked
- Rated high, but its passages could not all be checked against it.
Show all 13 references
- Almeida, P. S. (2023). Approaches to conflict-free replicated data types. ACM Computing Surveys (arXiv:2310.18220). https://arxiv.org/abs/2310.18220 Medium trust Peer-reviewed, abstract only.
- Bauwens, J., & Gonzalez Boix, E. (2019). Memory efficient CRDTs in dynamic environments. Proceedings of the 11th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (VMIL '19). https://soft.vub.ac.be/~jibauwen/publications/splash19-memory-efficient-crdts-dynamic-env.pdf Solid source Peer-reviewed, read in full.
- Bauwens, J., & Gonzalez Boix, E. (2020). From causality to stability: Understanding and reducing meta-data in CRDTs. Proceedings of the 17th International Conference on Managed Programming Languages and Runtimes (MPLR '20). https://soft.vub.ac.be/~jibauwen/publications/mplr20-from-causality-to-stability-jimbauwens.pdf Solid source Peer-reviewed, read in full.
- Gentle, J., & Kleppmann, M. (2025). Collaborative text editing with Eg-walker: Better, faster, smaller. Proceedings of EuroSys '25 (ACM); arXiv:2409.14252. https://arxiv.org/abs/2409.14252 Medium trust Peer-reviewed, read in large part.
- Haas, J., Mogk, R., Yanakieva, E., Bieniusa, A., & Mezini, M. (2023). LoRe: a programming model for verifiably safe local-first software. arXiv:2304.07133. https://arxiv.org/abs/2304.07133 Medium trust Peer-reviewed, abstract only.
- Kleppmann, M., Wiggins, A., van Hardenberg, P., & McGranaghan, M. (2019). Local-first software: you own your data, in spite of the cloud. Ink & Switch; Onward! 2019, ACM, pp. 154-178. https://www.inkandswitch.com/essay/local-first/ Medium trust Peer-reviewed, read in full.
- Köhler, M., Zakhour, G., Weisenburger, P., & Salvaneschi, G. (2025). Consistent local-first software: enforcing safety and invariants for local-first applications. IEEE Transactions on Software Engineering. https://doi.org/10.1109/TSE.2024.3477723 Solid source Peer-reviewed, abstract only.
- Rocicorp LLC (n.d.). How Replicache works. Replicache Docs. https://doc.replicache.dev/concepts/how-it-works Solid source Documentation, read in large part.
- Shapiro, M., Preguiça, N., Baquero, C., & Zawirski, M. (2011). A comprehensive study of convergent and commutative replicated data types. INRIA Research Report RR-7506. https://inria.hal.science/inria-00555588 Solid source Read in full.
- Weidner, M. (2024). Architectures for central server collaboration. mattweidner.com. https://mattweidner.com/2024/06/04/server-architectures.html Medium trust Blog post, read in large part.
- Weidner, M., & Kleppmann, M. (2025). The art of the Fugue: Minimizing interleaving in collaborative text editing. IEEE Transactions on Parallel and Distributed Systems (arXiv:2305.00583). https://arxiv.org/pdf/2305.00583 Solid source Peer-reviewed, read in full.
- Weidner, M. (2025). Collaborative text editing without CRDTs or OT. mattweidner.com. https://mattweidner.com/2025/05/21/text-without-crdts.html Medium trust Blog post, read in large part.
- Zhang, Y., Weidner, M., & Miller, H. (n.d.). Programmer experience when using CRDTs to build collaborative webapps: Initial insights. Slide deck, Composable Systems Lab, Carnegie Mellon University. https://docs.google.com/presentation/d/1VQWwEWXjaZF21AcTbrsOa1Bq5lEdFxTx/htmlpresent Weak source Read in full. A passage taken from it was not found in it.