CRDTs: Convergence without coordination
21 comments
·October 16, 2025cbm-vic-20
The article sets up a scenario where two people are editing a document, but have conflicting changes: "If Alice fixes a missing letter in a word while Bob removes the whole word, that’s a conflict."
The article then goes into some examples of CRDTs and their merge operation, and the examples are pretty straightforward: take the maximum of two values, or take one with a more recent timestamp, etc.
But what about the motivating example? What should a merge function do with the inputs "change the third word from 'affect' to 'effect'" and "delete the third word"? In other words, how does the function know which of these operations "wins"? It could ask a user for a manual resolution, but is there a reasonable way for a function to make this determination itself? Maybe deletes are more powerful than word changes, so the delete wins.
staplung
The "conflict-free" part of the name is misleading. The conflict "resolution" means having some deterministic algorithm such that all nodes eventually converge to the same state, but it won't necessarily mean that the end state looks like it's conflict-free to a human. The algorithm you choose to implement will determine what happens in the editing case imagined; various answers are possible, perhaps most of which would be classified as conflicting changes by a human who looked at the final result. The pitch for CRDTs is "we won't trouble you with the replication details and will eventually converge all the changes. The tradeoff is that sometimes we'll do the wrong thing."
That tradeoff is fine for some things but not others. There's a reason why git et al require human intervention for merge conflicts.
The article is doing a classic bait-and-switch: start with a motivating example then dodge the original question without pointing out that CRDTs may be a very bad choice for collaborative editing. E.g. maybe it's bad for code and legalese but fine for company-issued blog posts.
dkarl
I think people who haven't worked on problems like this have much higher expectations than people who have.
If you have worked on problems like this, you're very happy to converge on the same state and have no expectation that multiple concurrent editors will be happy with the result. Or even that one of them will be happy with the result.
You wouldn't use this in a situation like version control where you have to certify a state as being acceptable to one or multiple users.
aaronblohowiak
to add on to that, it is that the resolution is the same regardless of the order in which the nodes get the information that led to the conflict so there is no "out of sync". your resolution strategy could involve considering the potential conflict unresolved until a resolution element is created (but then you have to figure out what to do if you get more than one of those.. its conflicts all the way down!)
swid
There is no objectively correct way to do the merge, but there are ways that are obviously wrong.
scotty79
I think it's your job as a designer to encode which update should win. In case of equivalent updates like writing to a field they suggest 'last update wins" strategy.
For words, if a word is a single unit in your system, delete obviously beats amendment.
SkiFire13
This only works for very simple cases where there is already an existing strategy, but I have yet to see strategies for more complicated cases, especially ones where you also need to preserve some kind of consistency. Ultimately this boils down to "write your own CRDT", where CRDT is no longer a tool but just a definition to satisfy.
ffsm8
> suggest 'last update wins" strategy.
Hmm, last update as it's received by a central server? Last update according to the time on the device doing committing the update? The rabbit hole just keeps going, for each decision you get multiple new edge cases with unintended behavior...
gregoriol
CRDTs mostly have a time notions like Lamport clocks, vector clocks, ... not actual device time => see more here: https://adamwulf.me/2021/05/distributed-clocks-and-crdts/
bux93
Sounds like a job for a block chain!
heromal
It's most likely causality-based time, not the time per an atomic clock.
jongjong
Yes, it's impossible for a distributed system to figure out the collaborative intent when it sees conflicting changes... Even the people who made the changes may not 'know' what is the correct way to resolve the conflict... For that to happen, people involved would have to communicate and agree on either option or they would have to agree on a compromise. This problem cannot be solved automatically because computers cannot read minds (yet).
This is why I like using granular data structures where each value can be updated in an all-or-nothing manner and if one person's change overwrites another, the person whose change was overwritten will just assume that the other person made an update shortly after and the amount overwritten is minimal.
fellowniusmonk
I mean your example is a classic case.
And there are different algos, for diamondtypes:
Once a character is seen by clients any delete of it wins, algos like diamond types reconstruct each clients stream.
So in the case of DT, effect is absolutely gone, two clients deleting the e and one client deleted the ffects, and they both started at the same causal slice, but the A is a good question. You might just end up with an A.
In the case of multiple inserts in the same position dt uses the client ids lexical sort for ordering to reduce text interleaving.
Other crdt approaches may be positional or last write wins, in which case you may end up with nothing.
Besides being an amazing project loro crdts documentation and blog covers a lot of this stuff and names the specific algos they use.
deepanwadhwa
Does anyone know if there is anything like CRDT with end to end encryption?
sotomski
AFAIK, Automerge people work pretty hard on Beehive and Keyhive. Once released, that’ll be exactly what you asked for: https://www.inkandswitch.com/keyhive/notebook/05/ You can also use Yjs over Matrix (which has e2e encryption): https://github.com/YousefED/Matrix-CRDT
Retr0id
In theory, you can exchange CRDT update information over any channel you like (say, MLS) https://martin.kleppmann.com/2019/05/15/encrypted-crdts.html
marcusestes
Fireproof implements a CRDT and implements E2E. https://use-fireproof.com/docs/welcome/
schainks
You mean something like this? https://jakelazaroff.com/words/homomorphically-encrypted-crd...
It is slow and inefficient, but can be done.
iwontberude
The toy example with two nodes incrementing and decrementing likes independently and then sharing the delta with each other would require an increasing amount of backend requests (n^2) for every like. If you had 10000 nodes and they were all sending 9999 requests to eachother for a single request, obviously that's not the best model. It did somewhat remind me of MySQLs active-active replication scheme but that has some locking to make sure drift isn't too bad. MySQL Group Sync also doesn't scale beyond 9 nodes.
fellowniusmonk
Loro is the open source project I am most excited about, their documentation is also stellar as an intro to the subject.
As an aside, I find FugueMax to be amazing to solve interleaving issues.
I've found for collaborative editing fuguemax for resolving intraline edits and h-lseq for the lines themselves has been amazing.
Shameless plug: I'm betting that a lot of applications could use some form of CRDT as a Database, which would allow a fully decentralized backend/database for local-first apps. So I've been building one.
Still working on good blog posts to explain and introduce it though.
https://github.com/arcuru/eidetica