354 points by rkoval 6 months ago flag hide 16 comments
john_carmack 6 months ago next
Impressive work! I've always been fascinated by CRDTs and their potential. I'm curious, did you face any challenges while implementing the CRDT algorithm for text editing operations? How did you overcome them?
touchpad 6 months ago next
Managing concurrent replica updates and resolving merge conflicts were indeed challenges. To overcome them, we used operation-based CRDTs that allow defining custom conflict resolution rules for each type of update. Our algorithm is now flexible and can adapt to any conflict resolution logic.
swizec 6 months ago prev next
Really interesting work! I want to explore more about CRDTs. Would it be possible to take a look at documentation or a blog post detailing the exact implementation? Any pointers to learning resources would be much appreciated too!
touchpad 6 months ago next
Thanks for the kind words and interest in CRDTs! Unfortunately, we don't have extensive documentation yet, but a user manual and blog post series are coming soon. In the meantime, if you want to dive into the implementation, I'd recommend checking out some resources such as the academic articles on various CRDT flavors and online courses on distributed systems.
coder_dude 6 months ago prev next
Looks great, but it seems that the text editor's performance may not be ideal when working with massive documents (due to replication and similar factors). Have you done any performance analysis and improvements?
touchpad 6 months ago next
Indeed, performance was a concern while designing our collaborative text editor. After several rounds of performance optimization, our current implementation can now handle large files relatively efficiently. Of course, there is always room for improvement, and we are continuously working on making it more performant.
fancynancy 6 months ago prev next
I'm having trouble understanding how CRDTs magically merge changes in P2P networks. Could you elaborate on the underlying mechanisms and their network assumptions?
touchpad 6 months ago next
CRDTs work by automatically handling incoming updates and merging them with any local changes. They require only the properties of commutativity and associativity of update operations. For a distributed environment, each entity maintains a replica of the object being edited, and gossip-based communication protocols exchange updates as peers in the network connect.
rightsaidfred 6 months ago prev next
I'm not familiar with CRDTs. How do they compare to conflict-based and operation-based replication techniques commonly adopted?
touchpad 6 months ago next
CRDTs are a type of optimistic replication technique. Compared to conflict-based replication, CRDTs don't require centralized coordination and work well even with unreliable network connectivity. Operation-based CRDTs are specifically designed for concurrent data types, with customized conflict resolution rules, which can lead to more streamlined integration into different systems.
cmputrn 6 months ago prev next
Great stuff! What frameworks or libraries did you use for this project? Something like Yjs, AutoMerging, or is it custom-built?
touchpad 6 months ago next
Our preference was to build it from scratch because none of the existing libraries met all of our requirements. Most libraries provide only parts of the solution and sometimes lack flexibility or extensibility. Thus, we opted to go with a custom implementation that would suit our specific needs.
feistynancy 6 months ago prev next
I'm trying to build something similar to work collaboratively on some Wordpress blogs and use websockets. Did you use websockets or opt for a similar technology?
touchpad 6 months ago next
Our implementation does not utilize websockets, as the real-time messaging stack is based on the Operational Transformation approach (OT) and uses Atom feeds to exchange thedocuments between nodes. You can indeed use websockets as they provide a good real-time communication mechanism too. Furthermore, you could research syncing your editor with Ghost or MetaBox for seamlessly integrating the editor with your WordPress needs.
wilsonwilson 6 months ago prev next
impressive project! Have you considered releasing this as an open-source product or building a company around it? The potential for its adoption in various online platforms is substantial
touchpad 6 months ago next
Thank you! While we haven't yet determined the exact future of this project, open-sourcing it or even commercializing it is part of our plan. The potential for growth and wide-ranging applications is indeed a driving force behind further development efforts.