8 ms·
CRDT Benchmarks
- deleted 3y ago[deleted]
- deleted 3y ago[deleted]
- kevinjahns 3y agoAuthor of Yjs here. I'm all for faster data structures. But only benchmarking one dimension looks quite fishy to me. A CRDT needs to be adequate at multiple dimensions. At least you should describe the tradeoffs in your article. The time to insert characters is the least interesting property of a CRDT. It doesn't matter to the user whether a character is inserted within .1ms or .000000001ms. No human can type that fast. It would be much more interesting to benchmark the time it takes to load a document containing X operations. Yjs & Yrs are pretty performant and conservative on memory here because they don't have to build an index (it's a tradeoff that we took consciously). When benchmarking it is important to measure the right things and interpret the results somehow so that you can give recommendations when to use your algorithm / implementation. Some things can't be fast/low enough (e.g. time to load a document, time to apply updates, memory consumption, ..) other things only need to be adequate (e.g. time to insert a character into a document). Unfortunately, a lot of academic papers set a bad trend of only measuring one dimension. Yeah, it's really easy to succeed in one dimension (e.g. memory or insertion-time) and it is very nice click-bait. But that doesn't make your CRDT a viable option in practice. I maintain a set of benchmarks that tests multiple dimensions [1]. I'd love to receive a PR from you. [1]: https://github.com/dmonad/crdt-benchmarks https://github.com/dmonad/crdt-benchmarks
- lynxaegon 3y agoGreat work! Looking forward to the CRDT
- yboris 3y agoDirect link to GitHub: https://github.com/streamich/json-joy https://github.com/streamich/json-joy
- jasonjmcghee 3y agoWhat’s the future of this work? Is it planned to be entirely standalone? Planning to build integration with popular editors? Planning a websocket server implementation with hooks etc / a hosted solution?
- streamich 3y agoEverything: full JSON CRDT, rich-text CRDT, specification, Reactive RPC, UI toolkit, hosted solution. Subscribe on Substack for updates.
- MrOwnPut 3y agoThat's crazy. But the main draw of Y.JS is how easy it is to use. It has many providers, easy persistence, and many integrations. Maybe make a compatibility layer to use the Y.JS ecosystem?
- johncalvinyoung 3y agoVery interested in seeing progress, JSON CRDTs benchmarked with JS objects and arrays, I currently have an implementation based on Automerge but it's borderline nonviable on our largest data structures.
- josephg 3y agoHey! Author of diamond types and the (linked) editing traces repository here. Would it be possible to make & share an editing trace or two from your application? Even a single user editing trace would be super helpful - like a big list of which objects were replaced by what values, in order. I really want json based CRDTs to be fast, but one of the problems we have optimising this stuff is that there aren’t a lot of real world data traces around to use as baselines for benchmarking. I don’t know which parts of automerge are slow, and without that knowledge I can’t make them fast. If we have some data from your application, most upcoming json based CRDTs will almost certainly work well for your use case. If you’re up for it, flick me an email or just open a PR on https://github.com/josephg/editing-traces https://github.com/josephg/editing-traces
- simonw 3y agoI'm still hoping for a CRDT implementation with robust, thoroughly tested libraries for both Python and JavaScript that can talk to each other - I want to run Python on the server and JavaScript in the client and keep the two in sync with each other. Closest I've seen to that is automerge but the Python version doesn't appear to be actively maintained or packaged for PyPI yet: https://github.com/automerge/automerge-py https://github.com/automerge/automerge-py UPDATE: It looks like this might be what I'm after: https://github.com/y-crdt/ypy https://github.com/y-crdt/ypy
- digdugdirk 3y agoThat ypy library looks very interesting. Do you have any idea what considerations would need to be kept in mind when trying to implement CRDTs? I'm thinking about something relatively basic, let's say a shared markdown document and/or shared dataframe view of a database table?
- tantaman 3y agoWouldn't any of the Rust implementations be what you need (Yrs, Diamond Types or the Automerge rust re-write)? Given you can bind to a Rust implementation in JS or Python or whatever else.
- simonw 3y agoI want someone else to write the Rust-to-Python bindings for me because I'm lazy! More importantly, I prefer not to be the only user of something like this - a Rust-Python wrapper that someone else has already tried running in production is a lot more trustworthy than something I knock together myself.
- josephg 3y agoBindings are relatively easy to write, test and run. The hard part is usually just keeping them up to date with API changes.
- josephg 3y agoThis is certainly the direction most crdt libraries are headed. A fast, well tested rust implementation with native bindings to Python, go, c, java, etc. And a wasm bundle to run the same algorithm in the browser. Yjs (well, yrs), automerge and my own diamond types are all in rust and moving in this direction. Webassembly support amongst javascript bundlers has been getting a lot better lately. And having only one codebase to optimize and test cuts down immensely on work.
- fnordsensei 3y agoI think the idea of the Rust implementations of Y and A is portability, primarily. A JS implementation alone is very opinionated about, for example, what your backend should look like. A Rust ditto will be less opinionated and more accessible in a variety of environments. I don’t think the main point is the supposed superiority of WASM vs JS in terms of performance, as the article surmises.
- syncerr 3y agoThe death stroke for these types of projects seems to be lack of funding. This project is sponsored by nlnet[0] providing between 5k - 50k EU per year. Let's hope this gets additional resources. As a note, it appears to use Elastic's 2.0 license preventing selling software that includes this library [1] [0] https://nlnet.nl/project/JSON-Joy/ https://nlnet.nl/project/JSON-Joy/ [1] https://github.com/streamich/json-joy/blob/master/LICENSE https://github.com/streamich/json-joy/blob/master/LICENSE
- johncalvinyoung 3y agoApache 2.0 as of... 18min ago?
- hankman86 3y ago[1] is a bummer. Turns this project into a technology showcase without any practical use.
- deleted 3y ago[deleted]
- samwillis 3y agoI need to dig into this more, but I'm sceptical of only benchmarking ops/second, that's not really a problem that needs solving, the existing toolkits are fast enough. Also, this benchmark doesn't show document size and growth, that is something where more research is needed. Always excited for any CRDT innovations though, and I'm sure there is stuff to learn from this work.
- johncalvinyoung 3y agoNot always fast enough. Automerge with 32MB of JSON to parse is... painfully slow.
- alserio 3y agoWhat I have not understood yet is how do you preserve invariants over a merge of JSON crdt. What do you do when a document has a structure that can be represented as a json, but not every valid json is a valid document? How do you avoid merges producing valid jsons but invalid documents?
- fnordsensei 3y agoGeneral CRDTs will guarantee valid data structures, but not schema/domain model validity. Kind of like how CRDTs applied to text will guarantee a string, but not valid English.
- paulgb 3y agoThis is a great analogy for something I've struggled to put into words. I’ll add: if you have invariants, you almost by definition have conflicts. The C in CRDT is for conflict-free, so if you can have conflicts in the data domain you probably want something that can preserve them (like state machine synchronization) rather than a CRDT.
- josephg 3y agoA CRDT (well, an operation based crdt) has all the information it needs to tell that conflicts have occurred, and which operations caused them. Something I’ve wanted for awhile is a crdt which can use that information to place the data in a “conflict” state. We can do this today with keys / values pretty easily with “MV (multi value) Registers”. If two writers concurrently set the value, the next read can see both values and decide what to do about that. But nobody (as far as I know) has yet made a crdt for code editing which uses this same trick to mark & annotate editing conflicts. And that seems like a missing piece if we want to replace git with something better.
- fnordsensei 3y agoI’m having trouble visualizing how a conflicted state might work. We still have to produce a valid state for the next edit to work on. Do you mean supplying conflict resolution handlers? Also, do you mean a conflict from the perspective of “malformed data structures” or “domain invariant violated”?
- tin7in 3y agoGreat to see this comparison! I haven't heard about Json-joy yet, so I'm curious to learn more. We are using Yjs in production and it works like magic!
- refulgentis 3y agoHoly s***.
- josephg 3y agoAuthor of Diamond types (and the data sets you’re using) here! Congratulations on getting this insane performance. I’d love to know how you’re doing it - that’s truly excellent work. I didn’t know it was even possible to get javascript to go that fast on this problem. And I say that as someone who has thought about crdt / text performance way more than is reasonable. RIP my morning. I’m going to have to pour through your code to see how you’ve pulled this off. Do you have anything you recommend I read to understand how your algorithm works?
- streamich 3y ago> Do you have anything you recommend I read to understand how your algorithm works? Not really, you should already know those. It is just Block-wise RGA with a tree for blocks and a tree for identifiers, also, with split link and insert-in-between optimization from Briot et. al (2016).
- streamich 3y agoA sneak peak to some future blogpost, this is what happens when "OOD " is inserted into "GG WP" to get "GOOD G WP": https://appsets.jsonjoy.com/blogposts/list-crdt-internals/with-identifier-table.png https://appsets.jsonjoy.com/blogposts/list-crdt-internals/wi...
- bxff 3y agoCan't wait for the future blogpost! I got the Rope text data structure both from the pic, and from the data structure in AbstractRga, but am unsure of the identifier table, I am guessing thats the ID -> Chunks binary tree.