3 ms·
Since Figma has documents, and each document only has a limited amount of users working (writes) on them, it makes a lot of sense to horizontally shared those.
by whazor 3y ago
Since Figma has documents, and each document only has a limited amount of users working (writes) on them, it makes a lot of sense to horizontally shared those. Whereas other tables, for authentication and other user logic, it makes more sense to be vertically sharded. Though it could also make sense to horizontally shard them over regions.
- vmfunction 3y ago> Though it could also make sense to horizontally shard them over regions. that is assuming the user who are editing the document are in the same geo region. How one shard the db, would depending on some internal stats of figma and how the applications are used.
- CoastalCoder 3y agoMaybe I missed it from the article, but did they consider having multiple, independent instances of the entire document database for different clusters of users? I would think that most documents tend to have a small-ish set of users.
- paulgb 3y agoFrom an earlier blog post[1], the system for synchronizing file/document state is independent from their database. As I understand it, their database is for metadata rather than actual document content. > It’s worth noting that we only use multiplayer for syncing changes to Figma documents. We also sync changes to a lot of other data (comments, users, teams, projects, etc.) but that is stored in Postgres, not our multiplayer system, and is synced with clients using a completely separate system that won’t be discussed in this article. Although these two systems are similar, they have separate implementations because of different tradeoffs around certain properties such as performance, offline availability, and security. This post[2] goes into more detail on how they spin up backend processes to serve as the source of truth while documents are open (we took heavy inspiration from it when building https://plane.dev https://plane.dev, which aims to be an open-source implementation of that architecture.) [1] https://www.figma.com/blog/how-figmas-multiplayer-technology-works/ https://www.figma.com/blog/how-figmas-multiplayer-technology... [2] https://www.figma.com/blog/rust-in-production-at-figma/ https://www.figma.com/blog/rust-in-production-at-figma/