Why Affine uses CRDT not OT to build a collaborative real-time editor
Posted 张驰Zhangchi
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Why Affine uses CRDT not OT to build a collaborative real-time editor相关的知识,希望对你有一定的参考价值。
As a collaborative real-time editor, Affine aims to resolve problems in three situations:
- Multi-master replication: the synchronization of data between equipment and applications;
- Eventual consistency: the consistence of data regardless of network latency and outage;
- Conflict resolution: the resolution of conflict between simultaneous edits.
To achieve these aims, a proper collaborative algorithm should be used. There are hundreds of collaborative algorithms being invented over the past three decades, but they usually fall into two categories: either operational transformation (OT) or conflict-free replicated data type (CRDT). We think CRDT is a better choice.
What does CRDT do
CRDT is capable of discovering and resolving conflicts while ensuring the effective distribution and merge of date. It may sound like magic, but think about historical study, it is very possible to discover the truth from scattered evidence.
For CRDT, every piece of data is like a “historic fragment”. We keep collecting the fragments from other clients and then restore the truth by excluding repeated data and correcting false information.
Why CRDT is better
In contrast to OT, CRDT possesses three big advantages:
Flexibility
CRDT supports more data types. For example, Yjs supports Array, Map, and Treelike, and therefore applies to more business scenarios.
Performance
CRDT tolerates higher latency and can wait longer for solving conflicts, whereas the calculation of OT in the same condition may become too overwhelming for a server to sustain.
Extensibility
Because CRDT supports more data types and editor elements, it is more extensible.
Conclusion
Collaborative algorithm is still a foreign concept for many developers. There are some introductions to it, but as to how it shall be used, there is still lack of clear explanation. I hope this article helps. If you also work for a startup company developing an editor and want some suggestions. CRDT, especially Yjs, should be a better choice for you.
Reference:
Title Picture From: two person standing on gray tile paving photo – Free Image on Unsplash
Why Affine uses CRDT not OT to build a collaborative real-time editor - AFFiNE Blog
以上是关于Why Affine uses CRDT not OT to build a collaborative real-time editor的主要内容,如果未能解决你的问题,请参考以下文章
Why Affine uses CRDT not OT to build a collaborative real-time editor
Why SignalR does not use WebSockets?
javascript 基地:https://reactjs.org/docs/context.html#why-not-to-use-context
The AFFiNE live demo is here (with 15 reasons from the team why you should try)
The AFFiNE live demo is here (with 15 reasons from the team why you should try)
The AFFiNE live demo is here (with 15 reasons from the team why you should try)