理解同步引擎:Figma、Linear 和 Google Docs 的工作原理

Understanding sync engines: How Figma, Linear, and Google Docs work

Two users edit a rectangle in your design tool while offline. Alice moves it to position [100, 200]. Bob changes its color to red. When they reconnect, what should happen? This is easy to answer—show the rectangle at [100, 200] in red. Both changes survive.

两个用户在离线时编辑您设计工具中的一个矩形。Alice 将其移动到位置 [100, 200]。Bob 将其颜色更改为 red。当他们重新连接时,应该发生什么?这个问题很容易回答——显示位于 [100, 200]red 颜色矩形。两个更改都保留。

Now the hard questions:

现在是棘手的问题:

  • What if they both moved it to different positions?
  • 如果他们都移动了它到不同的位置呢?
  • What if Alice deleted the rectangle while Bob moved it?
  • 如果 Alice 删除了 矩形,而 Bob 移动了它呢?
  • What if they're both typing at the same position in a text field?
  • 如果他们在文本字段的同一位置同时输入呢?

Your answers to these questions determine your entire sync architecture. Choose wrong, and you're looking at 3-6 months of refactoring when you realize users are losing data.

您对这些问题的回答决定了您的整个同步架构。 选择错误,当您意识到用户正在丢失数据时,您将面临 3-6 个月的重构。

Every modern app is adding “realtime collaboration” to their feature list, and you've probably heard CRDT thrown around like it's a silver bullet. The reality is far more nuanced: Figma’s collaborative canvas works fundamentally differently than Google Docs’ text editing, which works differently than Linear's issue tracking. They’re all “realtime” and “collaborative”, but the underlying sync mechanisms solve different problems.

每个现代应用都在功能列表中添加“realtime collaboration”,您可能已经听说 CRDT 被当作万能药一样被到处提及。现实要复杂得多:Figma 的协作画布在根本上与 Google Docs 的文本编辑不同,后者又与 Linear 的问题跟踪不同。它们都是“realtime”和“collaborative”的,但底层同步机制解决的是不同的问题。

As someone who’s built realtime systems at scale—from social media platforms with offline-first sync to event-driven microservice architectures—I've seen how critical this architectural decision becomes. This guide synthesizes what production systems actually do and why.

作为一名构建过大规模实时系统的人——从 具有离线优先同步的社交媒体平台事件驱动的微服务架构——我见过这个架构决策多么关键。本指南综合了生产系统实际做法及其原因。

Every realtime collaborative system must be able to handle multiple users editing the same data simultaneously, with network delays and offline periods. Changes can arrive in any order, an...

开通本站会员,查看完整译文。

ホーム - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.1. UTC+08:00, 2026-04-13 15:02
浙ICP备14020137号-1 $お客様$