以实时数据规模保持100(x)

At Figma, multiplayer collaboration is central to everything we do—from file canvas editing to features like comments and FigJam voting sessions. Keeping data up-to-date across product surfaces is critical for effective team collaboration and core to what makes Figma feel magical. LiveGraph, Figma’s real-time data-fetching service, is the foundation that makes this possible.

在Figma中,多人协作是我们所做的一切的核心,从文件画布编辑到评论和FigJam投票会议等功能。保持产品各个界面上的数据实时更新对于有效的团队协作至关重要,也是使Figma具有魔力的核心。Figma的实时数据获取服务LiveGraph是实现这一目标的基础。

LiveGraph provides a web API for subscribing to GraphQL-like queries and returns the result as a JSON tree. Like other GraphQL backends, we have a schema describing the entities and relations that make up our object graph, along with views that allow querying a subset of that graph. Through our custom React Hook, the front-end automatically re-renders on update with no additional work from engineers.

LiveGraph 提供了一个 Web API,用于订阅类似于 GraphQL 的查询,并将结果返回为 JSON 树。与其他 GraphQL 后端一样,我们有一个描述组成我们对象图的实体和关系的模式,以及允许查询该图的子集的视图。通过我们的自定义 React Hook,前端在更新时会自动重新渲染,无需工程师进行额外的工作。

A flowchart on a yellow background featuring geometric shapes and arrows indicating connections and flow. A prominent blue circle with a recycling arrow symbolizes a cyclical process, and directional arrows guide the flow between elements.

Software Engineers Rudi Chen and Slava Kim share an inside look at how we empower engineers to build real-time data views, while abstracting the complexity of pushing data back and forth.

软件工程师Rudi Chen和Slava Kim分享了我们如何使工程师能够构建实时数据视图,同时抽象出推送数据的复杂性。

At the end of our earlier exploration of LiveGraph, we predicted that our next bottleneck would be ingesting all database updates on each LiveGraph server. While this was certainly a factor, it was just one of the many scaling challenges we’ve faced with LiveGraph. Figma’s expanding user base and increasing LiveGraph usage mean more client sessions, each of which is increasingly expensive. The number of sessions has tripled since 2021, with view requests growing 5x in just the last year. Conversely, this growth is leading to large changes in the underlying infrastructure: From a single Postgres instance to many vertical and horizontal shards, the database below LiveGraph is shifting and we have to keep up.

在我们对Live...

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

Accueil - Wiki
Copyright © 2011-2024 iteam. Current version is 2.137.1. UTC+08:00, 2024-11-15 12:56
浙ICP备14020137号-1 $Carte des visiteurs$