I was wrong. CRDTs are the future

I was wrong. CRDTs are the future - Seph / Joseph Gentle (26 Sept, 2020)

  • former Google Wave developer picks up on CRDTs
  • made a test based on automerge in Rust to benchmark (github)

I still wasn’t completely convinced by the speed argument, so I made a simple proof of concept CRDT implementation in Rust using a B-tree using ideas from automerge and benchmarked it. Its missing features (deleting characters, conflicts). But it can handle 6 million edits per second. (Each iteration does 2000 edits to an empty document by an alternating pair of users, and that takes 330µs. So, 6.06 million inserts / second). So that means we’ve made CRDTs good enough that the difference in speed between CRDTs and OT is smaller than the speed difference between Rust and Javascript.

All these improvements have been “coming soon” in automerge’s performance branch for a really long time now. But automerge isn’t the only decent CRDT out there. Y.js works well and kicks the pants off automerge’s current implementation in the Y.js benchmarks. Its missing some features I want, but its generally easier to fix an implementation than invent a new algorithm.
[snip]
I mourn all the work I’ve done on OT over the years. But OT is no longer fits into the vision I have for the future. CRDTs would let us remake Wave, but simpler and better. And they would let us write software that treats users as digital citizens, not a digital serfs. And that matters.

The time to build is now.

40 Likes

I should have pushed this much harder in-house. I think we could have been launched 2-3 years ago. The number of times I heard oh data can conflict so it’s impossible, we need total order serialization and linearization, etc. would drive anyone nuts. We live and learn though.

43 Likes

If only we knew the answers before we know the answers!

Speaking for myself there, you’ve made some great calls David and that’s why this project is getting there. You’ve done an amazing job. Thanks for showing us how.

35 Likes

Don’t be hard on yourself. You have implemented and are testing stuff (inside a frankly revolutionary framework) that really smart people who have worked on this specific problem for a decade and more are just coming around to. You’ve kept a vision, updated the tech as real world testing showed the limits of other approaches, and made the hard calls. No regrets, don’t look back.

21 Likes

At least we now know what does not work! :slight_smile:

14 Likes

Read the article. It often seems that these CRDT experts are quite aligned with the vision of Safe Network. Do they know that Safe Network project exists? Would they be willing to contribute? (If that is necessary / desired at this point.)

9 Likes

Yes some of them do, when we have more proof points then we will reach out to more of them. We are working on a critical datatype to hold network section membership and that needs to be byzantine fault-tolerant. We have 2 impls right now, both look to work, so a nice place.

The great thing here is we can fully test the data, no need for the network to exist. Then we test the messages and a huge part of the codebase is in a state we can be sure is correct. So simplifies testing as much as it simplifies the codebase. Intersting counter to crdt though is the link @JPL posted Workers Durable Objects Beta: A New Approach to Stateful Serverless I see their point, but not sure I agree with the conclusion. It feels like these durable objects maintain all state forever (like crdt with tombstones). It’s very intersting to see this progress though.

19 Likes

I shared the link to Maidsafe’s Github repository crdt_tree in the comments a few times and received some responses if anybody wants to join in the conversation.

EDIT:Just got a chance to check the comments and author of the blogs responding in the comments also. https://www.reddit.com/r/rust/comments/j1hb3a/i_was_wrong_crdts_are_the_future/g71et1k?utm_source=share&utm_medium=web2x&context=3-

Not sure who TheNamelessKing is, but I think I like him. :wink:

13 Likes

A while back I encountered the following retrospective of an effort to use CRDT in xi (an editor with a backend written in Rust) for collaborative editing. I don’t know much about the subject, but it seems to me it could be an interesting read:
https://github.com/xi-editor/xi-editor/issues/1187#issuecomment-491473599

2 Likes

Here is another great resource about CRDTs. They have a huge list of papers and blog posts. Welcome to the CRDT rabbit hole! :rabbit2: :hole:

16 Likes

Cheers @janriemer I have never seen this, nice one.

8 Likes

It’s such a great resources. I will study CRDT through interest materials. Thx @janriemer

6 Likes

@dirvine @anon23746431 This might be of interest to you as well :wink:

Diamond Types - The world’s fastest CRDT. WIP.

And the corresponding blog post:

https://josephg.com/blog/crdts-go-brrr/

Running this editing trace, Automerge (a popular CRDT, written by a popular researcher) takes nearly 5 minutes to run. I have a new implementation that can process the same editing trace in 56 milliseconds. Thats 0.056 seconds, which is over 5000x faster.

15 Likes

That is a fantastic article.

3 Likes