8 ms·
What are some real world apps using CRDTs that have really good experiences? IIRC Notion was supposed to be one of them but realistically taking notes with two
by jzelinskie 2y ago
What are some real world apps using CRDTs that have really good experiences?
IIRC Notion was supposed to be one of them but realistically taking notes with two people in Notion is almost unusable compared to Google Docs.
- danielvaughn 2y agoFigma uses a CRDT-ish approach. I'm working on one at the moment, but it'll be a while before it's publicly available. At the moment, I'm using Loro: https://loro.dev https://loro.dev
- spacecadet 2y agoNot a public high bandwidth example, but a consulting team I was on implemented CRDTs in a private mobile app used for a compliance documentation use case. More of a precaution, the actual number of end-users editing a record at any given time is expected to be 1, but while reviewing their system, we found that the clients system can support multiple and sometimes their employees don't communicate/follow procedures. We first tried to convince them to make changes on their end, but their development team straight up refused.
- yazaddaruvala 2y agoIn practice, Git Some CRDT purists would say "its not perfectly conflict free so its not a CRDT". Sure[0], but for the rest of us that are pragmatic about best effort conflict resolution Git is likely the most successful CRDT application. [0] https://en.wikipedia.org/wiki/No_true_Scotsman https://en.wikipedia.org/wiki/No_true_Scotsman
- kiitos 2y agoCRDT literally means Conflict-free Replicated Data Type. Expecting CRDTs to be conflict-free isn't purism, it's simple validation. Git is, inarguably, not a CRDT.
- yazaddaruvala 2y ago> CRDT literally means Conflict-free Replicated Data Type. Git could be "conflict-free" with a simple `rand(ours, theirs)`. It would be useless, but technically "conflict-free". Is the addition or removal of that rand function really, pragmatically the difference in the answer to "what is a CRDT?"
- Groxx 2y agoAdding extra rules on top of git to try to turn it into a CRDT doesn't make git one, even if you succeed (and rand would not succeed). You can do that with a pencil and paper, but that doesn't make paper a CRDT.
- jakelazaroff 2y ago`rand` wouldn’t work because all peers must reach the same state without coordination.
- kiitos 2y agoThis is definitely not true. Are you open to understanding why this isn't true? If so, I'm happy to help you come to the correct understanding; please ask whatever questions are necessary. Otherwise, then, well, okay!
- LAC-Tech 2y agoThere are CDTS that have "multiple versions", which look an awful lot like conflicts to me, ie, the Multi-Value Register in this paper: https://inria.hal.science/inria-00555588/ https://inria.hal.science/inria-00555588/
- kiitos 2y agoMulti-value registers are CRDTs for sure. Conflict-free doesn't mean that values can't have concurrent histories (or, as you say, "multiple versions") -- it means that the merge operation always succeeds.
- 2y ago
- vlovich123 2y agoThis comes up every time but there’s three criterion for CRDTs and git fails 2 of them. Even ignoring the requirement for automatic conflict resolution (which git can’t meet since automatic resolution fails as a matter of course) and ignoring that the conflict resolution algorithm has to be part of the data type (it’s not), it fails the requirement that separate different copies must eventually converge when brought online but that’s demonstrably false as people may use different conflict resolution mechanisms AND the commit graph of a resolved conflict may itself then be different resulting in different histories from the process of brining git online. This is because the commit graph itself isn’t CRDT. If I commit A and then B but someone’s clone only has B applied, you can’t synchronize even automatically; different git histories don’t resolve in any way automatically at all and once you pick a solution manually your copy will not have the same history as anyone else that tries to redo your operations. No true Scotsman doesn’t apply here because there is a very precise definition of what makes a CRDT that is a clear delineating line.
- yazaddaruvala 2y ago> 1. The application can update any replica independently, concurrently and without coordinating with other replicas. > 2. An algorithm (itself part of the data type) automatically resolves any inconsistencies that might occur. > 3. Although replicas may have different state at any particular point in time, they are guaranteed to eventually converge. [0] Again, in theory it fails 2 and 3. However, in practice 3 is a normal part of working with git in a team. Barring a hard fork in git - which is equivalent to a deep copy of a CRDT. Like any deep copy of a data type, a CRDT's deep copy can be used in non-conformant manners (forks are VCS specific jargon for a CRDT deep copy; or shallow copy sometimes). > If I commit A and then B but someone’s clone only has B applied, you can’t synchronize even automatically; different git histories don’t resolve in any way automatically Maybe I don't understand your point specifically, but this example seems entirely solved by --rebase. In practice --rebase is typical, and best described as "do your best to automatically resolve histories; I'll handle any of the complex conflicts". All that said, I already agreed: "academically Git is not a CRDT". However, and I'm happy to disagree with you, in practice Git is the most popular CRDT. [0] https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type https://en.wikipedia.org/wiki/Conflict-free_replicated_data_...
- deleted 2y ago[deleted]
- josephg 2y agoI really wish someone would make a git-like tool on top of CRDTs. I want conflicts when merging commits like git does, but I also want the crdt features - like better cherry-picking and cleaner merging when merging several branches together. And of course, live pair programming. CRDTs store a superset of the information git stores - so we should be able to use that information to emit git style conflicts when we want. But I think nobody has implemented that yet. (Pijul probably comes closest.)
- Groxx 2y agoI suspect a major reason why CRDTs haven't been a clear dominator in VCSes is that the "conflict free" decision is not necessarily the correct decision. It's merely a consistent one. When editing is relatively "live", those are small enough that they're probably also correct. But adding your month of changes to a dozen other people's month of changes doesn't mean it's going to build correctly (or even look sane) when you change the same file. Manually seeing the issue and fixing it gives you a chance to correct that, at the time it's relevant, rather than "it all changed, good luck". --- If you're interested in distributed-VCS systems that have some different semantics than git, https://pijul.org/ https://pijul.org/ might be interesting. And Jujutsu is... complicated, as it abstracts across a few and brings in a few things from multiple VCSes, but it's mostly git-like afaict: https://github.com/martinvonz/jj https://github.com/martinvonz/jj No doubt there are others too (if anyone has favorites, please post! I'm curious too)
- nrr 2y agoFossil (https://fossil-scm.org https://fossil-scm.org) is actually a proper grow-only set from what I can tell: merge conflicts upon synchronization are encoded in the DAG as forks of the history at the conflicting points in time. If no action is taken after a fork, all clones will eventually see the exact same view of the history. The tooling will normally bail with a "would fork" message if a `fossil update` (and, hence, local resolution of those conflicts) wasn't undertaken before pushing, but this is not at all necessary to preserve useful operation.
- josephg 2y ago
- iced_beverage 2y agoThe code editor Zed uses them for collaboration. It was discussed in a Developer Voices episode - https://youtu.be/fV4aPy1bmY0?si=0O6fCmK8NziFf9Hi https://youtu.be/fV4aPy1bmY0?si=0O6fCmK8NziFf9Hi
- maccard 2y agoDoesn’t google docs use crdt?
- surfmike 2y agoI believe it uses Operational Transforms
- EGreg 2y agoOT vs CRDT: https://stackoverflow.com/questions/26694359/differences-between-ot-and-crdt https://stackoverflow.com/questions/26694359/differences-bet... In my opinion, the problem with CRDTs is they don't really have a great concept of access control and enforcing rules. Since everyone's a peer, you can only do things like "last write wins" etc. In a video game, for instance, I could disconnect and then spam the peers with tons of updates, claiming they were all done in the past, and they'd have to accept them all. PouchDB and IPFS lets nodes sort of make decisions about who to replicate from, but it's rudimentary: https://pouchdb.com/guides/replication.html https://pouchdb.com/guides/replication.html Hypercore is much better because it is an append-only log where every chunk is signed: https://docs.pears.com/how-tos/replicate-and-persist-with-hypercore https://docs.pears.com/how-tos/replicate-and-persist-with-hy... However, it's still not enough, because hypercore only supports a single-writer. There has been some work on hypercore multiwriter in the last few years (which I followed with interest) but none of it is Byzantine fault-tolerant, and it was ultimately dropped. In fact, if you leak the key, anyone you can probably corrupt a hypercore rather easily and prevent it from making forward progress. This is why at the end of the day, you still go back to the ideas of preventing forks. The problem is that blockchains do it via global consensus, which is hugely wasteful and overkill. But you do need something to run essentially "smart contracts", i.e. software that runs "in the cloud" which is infeasible to tamper with. Like Internet Computer's canisters for example... https://internetcomputer.org/docs/current/concepts/canisters-code https://internetcomputer.org/docs/current/concepts/canisters... Ultimately, these architectures will end up being far more reliable and resilient than the Web, because the Web is based around hosting and location ("where" something is) rather than content ("what" something is). IPFS and cids are a step towards that future, but other projects like ICP and Freenet are leapfrogging them... they have smart contracts based around WebAssembly. Incidentally, I interviewed Ian Clarke about the original freenet, and he recently announced the new freenet, which is based around webassembly, and the swarming is done using "small-world topology" instead of kademlia DHT: https://www.youtube.com/watch?v=yBtyNIqZios https://www.youtube.com/watch?v=yBtyNIqZios (Here is my interview with him a couple years ago: https://www.youtube.com/watch?v=JWrRqUkJpMQ https://www.youtube.com/watch?v=JWrRqUkJpMQ)
- jitl 2y agoToday Notion is a last-write-wins system with limited intention-preserving operations for list data (like block ordering). Text is last-write-wins, each block text or property is a last-write-wins register. We're working on a new CRDT format for block text.
- felipefar 2y agoDo you use last-write-wins using the received order of operations on the server or using a logical clock? I believe that for Notion the collaboration use case is more important than async editing, so a CRDT makes more sense, but for text editing apps that favor asynchronous collaboration maybe explicit conflict resolution is more reasonable.
- jitl 2y agoNo clocks on the write side
- minkles 2y agoMost of iCloud's services use CRDTs underneath I believe. That includes Notes, Reminders and possibly Photos as well. FoundationDB is some of the backend as well. I was told this by a drunken former Apple SRE in a bar :)
- mweidner 2y agoIndeed, Apple Notes has a reasonably sophisticated CRDT, including support for tables: https://github.com/dunhamsteve/notesutils/blob/master/notes.md https://github.com/dunhamsteve/notesutils/blob/master/notes....
- octopoc 2y agoThe other day I saw a bug in it, when editing a Note that another person was also editing. We were editing separate paragraphs. My cursor kept resetting to the beginning of a word after each letter I typed (and the Swype-style keyboard had the same problem). My point is, even Apple Notes doesn't get it quite right.
- MarkMarine 2y agoone would hope that is what they are using it for, since they bought one of the best foundations for a db to exist: https://news.ycombinator.com/item?id=9418255 https://news.ycombinator.com/item?id=9418255
- jdvh 2y agoThymer[1] uses CRDTs for everything. It's an IDE for tasks and planning. It's a multiplayer app, end-to-end encrypted and offline first, optionally self-hosted, and an entire workspace is a single graph. So CRDTs were the logical choice. All operations in Thymer get reduced to a handful of CRDT transformations. It doesn't matter whether you are moving or copying text, changing "frontmatter" attributes, dragging cards, uploading files, or adding tags. It's all done with the same handful of CRDT operations. Although this was a lot of extra work up front (we're not using any libraries) the benefits make it totally worth it. When your application state is a single graph you can move text between pages, link between pages (with backlinks), have transclusions, and do all sorts of cool stuff without having to worry about synchronization. CRDTs guarantee that all clients converge to the same state. And because CRDTs are by their nature append-only you get point-in-time versioning for free! We did end up having to make a couple of compromises for performance, though. Version history is not available offline (too much data) and in some cases we resort to last-writer-wins conflict resolution. On balance I think CRDTs are very much worth it, especially if you design an app with CRDTs in mind from day one. I probably wouldn't use CRDTs if I had to retrofit multiplayer in a more conventional AJAX app. Mutations in CRDTs are first applied optimistically, and then when the authoritative sequence of events is determined all clients need to revert their state to the last shared state and then re-apply all events in the correct order (thereby guaranteeing that all clients end up in the same state). Sometimes your app might need to revert and re-apply days worth of changes if you've been offline for a while. This all happens behind the scenes and the user doesn't know how many tree transformations are happening in the background but I guess my point is that CRDTs affect the design of the entire application. Most apps that are popular today were designed back when CRDT transformations were not yet well understood. [1] https://thymer.com https://thymer.com (almost ready for beta)
- pnw 2y agoThis looks really cool, signed up for the beta!
- ndr 2y agoLinear: https://linear.app/ https://linear.app/ See their Local First Conf talk: https://youtu.be/VLgmjzERT08 https://youtu.be/VLgmjzERT08
- yazaddaruvala 2y ago> What are some real world apps using CRDTs that have really good experiences? Since people loved my other hot take :) I suppose "good experience" can be subjective, but Blockchains are also in practice a distributed trust-less CRDT that is used by a LOT of people. - With redundant validation, across more than 2 nodes, used to solve for conflict resolution. - and proof of work/stake used to solve for distributed trust. Again, academically, maybe not a CRDT because they will not "always converge". Hard forks can happen. However, pragmatically, Blockchains are a CRDT.
- EGreg 2y agoI think blockchains are overkill because they're trying to get a global consensus about every transaction in the world, which is very expensive (with electricity, stake etc.). They're trying to solve the additional problem of preventing "forking" of a history. Whereas if you allow forks then CRDTs are more lightweight. Internet Computer canisters, Merkle DAGs (like IOTA), Hashgraphs and Holochains are probably a better architecture than Blockchains. Having said that, I think Merkle Trees are the future, for minimizing the amount of sync. They let you see exactly what changed, and so on. https://joelgustafson.com/posts/2023-05-04/merklizing-the-key-value-store-for-fun-and-profit https://joelgustafson.com/posts/2023-05-04/merklizing-the-ke... https://github.com/canvasxyz/okra-js https://github.com/canvasxyz/okra-js There's already great software done by Dat (later called Hypercore, now called Holepunch) that has an append-only log based on the SLEEP protocol. That's essentially all you need, in my opinion. They've built everything from key-value databases (hyperbee) to full-scale file systems (hyperdrive) on top of it. Beaker browser has been built on top of it. I mean, merging state-based CRDTs is cool, but you may as well just use operation-based CRDTs with something like Hypercore or the older PouchDB.
- EGreg 2y agoIf anyone is familiar, I would like to ask: How does Okra compare to something like Quadrable: https://github.com/hoytech/quadrable-solidity https://github.com/hoytech/quadrable-solidity
- _vufv 2y ago
- LAC-Tech 2y agoI think a lot of things. CRDTs predate the term "CRDT", they seem to be a mathematical construct/pattern found in the wild, that smart people codified and formalised. IME CRDTs just lay out the rules you need to follow for syncing eventually consistent nodes properly, ie without weird surprises or data loss. As for concrete examples: - in the famous Amazon Dynamo Whitepaper, they perfectly describe a CRDT in section 4.4. (https://www.allthingsdistributed.com/files/amazon-dynamo-sosp2007.pdf https://www.allthingsdistributed.com/files/amazon-dynamo-sos...), though I don't think this made it to modern Dynamo DB - I believe CouchDB follows all the CRDT laws - TomTom uses them I think the TL:DR is if you're going to sync two data stores that can be written to without coordination, learn the CRDT laws and make sure you follow them. They're fairly simple mathematical properties at the end of the day.
- leonseled 2y agoMuse. I love how I can write something on my iPad with the pencil and see the strokes real time on the mac app. I then switch to my mac to drag images and screenshots and see it synced to the ipad in real time. Then i annotate w the apple pencil. One of the best “whiteboarding” tools I’ve used.
- yazaddaruvala 2y agoThinking about it more, I’ll provide another that people will not immediately appreciate. Any and all networked video games with some form of rollback or correction. Best effort with a fallback to Rollback might actually be the “best” ie ergonomic experience for CRDTs that are most widely used. Again, not academically a CRDT because technically game state is not perfectly replicated to every client. Each client only gets partial game state. Additionally, game clients require low latency syncing, which could academically be considered “coordinating”. Even tho the client actually accepts and renders the input’s results locally probabilistically before any conflict resolution / rollback is returned to the client for correction. Again people are likely going to be pedantic but with three post now, I’d like to hope, people might see the common theme: The most popular, highly ergonomic, best implementations of CRDTs actually break the academic rules of CRDTs. This is a relatively typical trap of an overly academic mental model. Most real world algorithms and data types are actually more creative than their academic “rulesets”. eg Timsort. Especially if you’re building a product for actual use (as apposed to for review in a paper), then don’t fall into the over engineered/academic trap. Be creative, learn the academic rules, then intentionally break those rules, build what actually adds value and make it ergonomic rather than try to perfectly implement a concept that academics defined so stringently it’s only useful for other academics.
- sorrythanks 2y ago> The most popular, highly ergonomic, best implementations of CRDTs actually break the academic rules of CRDTs. There's a popular, highly ergonomic implementation called Automerge[0] that would beg to disagree with you. [0]: https://automerge.org/ https://automerge.org/
- yazaddaruvala 2y agoFWIW, never heard of it before but I like it. Meanwhile, a lot of people on these threads would say Automerge is not a CRDT. By definition Automerge.getConflicts means Automerge has conflicts and is not conflict-free. I on the other hand prefer and applaud Automerge for breaking the rules! I hope it continues to see more success.
- tlarkworthy 2y agoIt's not a CRDT, it's LWW at the cell level, transmitted pretty much a typing speed so conflicts are low
- tin7in 2y agoSaga: https://saga.so https://saga.so is a collaborative workspace with a strong focus on speed/simplicity.
- WolfOliver 2y agoI'm the creator of MonsterWriter. MonsterWriter uses a very simple CRDT for JSON payload (references index, export config). For the collaboration on the actual text it uses OT. When I started to implement this 7 years ago. CRDT weren't a thing.
- chipdart 2y ago> What are some real world apps using CRDTs that have really good experiences? Google Wave and Google Doc's use CRDTs. There's a fun blog post or two on how an academic paper completely botched it's benchmarks on the underlying algorithms by putting together a piss-poor implementation of Google Wave's algorithm and proceeding to claim the algorithm itself sucked even though the piss-poor implementation was such a mess it outperformed everything from every angle..
- fauigerzigerk 2y agoWaved used OT not CRDTs: https://josephg.com/blog/crdts-are-the-future/ https://josephg.com/blog/crdts-are-the-future/
- vlovich123 2y agoGoogle docs also uses OT not crdt. OT is easier to develop by an order of magnitude and even offline mode is possible to implement in a good enough way.
- rokicki 2y agoNice blog post, but I really wish the author knew how to use apostrophes. (Or the difference between its and it's, if it's not the typographical character he doesn't like.) It's just so jarring to be reading along and be tripped up all the time with grammatical mistakes.
- tkone 2y agoGoogle docs was originally ot based as well. I'm not sure about the current state of it.
- darby_nine 2y agoI mean, two people contending over one piece of state is never going to be a good experience. Thankfully this is mostly not useful in the first place.
- chickensong 2y agoLegendKeeper[1] seems like a pretty slick worldbuilding app that's local-first with a CRDT sync layer. They have a free demo, but I haven't used it enough to fully vouch for it being a really good experience. [1] https://www.legendkeeper.com/ https://www.legendkeeper.com/