---
title: "Keeping it 100(x) with real-time data at scale"
description: "Figma rebuilt LiveGraph, its real-time GraphQL-like subscription service over Postgres, to scale reads and database update load 100x as the database moved from one instance to vertical and horizontal shards."
url: "https://swe.quest/articles/keeping-it-100-x-with-real-time-data-at-scale-3b49e279c5a600f2"
canonical: "https://www.figma.com/blog/livegraph-real-time-data-at-scale/"
source: "Figma"
published: "2024-05-17"
difficulty: "medium"
kind: "Case study"
reading_minutes: 19
tags: ["caching","realtime","scalability","postgres","system-design"]
---

# Keeping it 100(x) with real-time data at scale

A post on [Figma](https://swe.quest/sources/figma.md), published 2024-05-17, 19 min read, Case study. Original: [https://www.figma.com/blog/livegraph-real-time-data-at-scale/](https://www.figma.com/blog/livegraph-real-time-data-at-scale/)

## Summary

Figma rebuilt LiveGraph, its real-time GraphQL-like subscription service over Postgres, to scale reads and database update load 100x as the database moved from one instance to vertical and horizontal shards. The old design tailed a single globally ordered replication stream into per-server mutation-based caches, which caused excessive fan-in and fan-out, fragmented caches, thundering herds on deploy, and stalled optimistic updates whenever any shard blipped. Two traffic findings drove the redesign: most data is delivered by initial reads rather than live updates, and most queries can be invalidated directly from a row mutation. The result is a three-tier Go system: an edge that expands views, a read-through cache sharded by query hash, and stateless invalidators sharded like the databases that tail the replication streams and send invalidations only to the relevant cache shards.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Caching](https://swe.quest/tags/caching.md) (Backend & APIs)
- [Real-time systems](https://swe.quest/tags/realtime.md) (Backend & APIs)
- [Scaling](https://swe.quest/tags/scalability.md) (Distributed systems)
- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [System design](https://swe.quest/tags/system-design.md) (Architecture & design)

## Prerequisites

- Postgres replication and WAL ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))
- cache invalidation ([easy posts on Caching](https://swe.quest/tags/caching.md?difficulty=easy))
- database sharding ([easy posts on Databases](https://swe.quest/tags/databases.md?difficulty=easy))
- GraphQL basics ([easy posts on GraphQL](https://swe.quest/tags/graphql.md?difficulty=easy))

## Keywords

LiveGraph, Figma, PostgreSQL, GraphQL, Go, dbproxy

## Related posts

- [GraphQL, meet LiveGraph: a real-time data system at scale](https://swe.quest/articles/graphql-meet-livegraph-a-real-time-data-system-at-scale-0852462beb79152e.md): Figma · 2021-10-14 · Medium · 11 min read · Real-time systems, GraphQL, PostgreSQL, System design, Event-driven architecture
  LiveGraph is Figma's real-time data layer on Postgres: frontend code declares GraphQL-like live queries via a React useSubscription hook, and the server keeps results updated by tailing the Postgres write-ahead log distributed over Kafka instead of polling.
- [How Figma’s databases team lived to tell the scale](https://swe.quest/articles/how-figma-s-databases-team-lived-to-tell-the-scale-5117114294b188fe.md): Figma · 2024-03-14 · Medium · 19 min read · PostgreSQL, Distributed databases, Scaling, Query engines
  Figma horizontally sharded its RDS Postgres stack after vertical partitioning ran out of room.
- [Speeding up file load times, one page at a time](https://swe.quest/articles/speeding-up-file-load-times-one-page-at-a-time-6f46ca8213350490.md): Figma · 2024-05-22 · Medium · 13 min read · Web performance, Real-time systems, Data structures, System design
  Figma extended dynamic page loading from view-only files and prototypes to editable files, cutting load times for the slowest 5% of loads by 33% and reducing client memory.
- [Distributing Global State to Serve over 1 Billion Daily Requests](https://swe.quest/articles/distributing-global-state-to-serve-over-1-billion-daily-requests-65554ed0d12e6461.md): Render · 2024-05-23 · Medium · 11 min read · Caching, Scaling, PostgreSQL, Load balancing, System design
  Render's request routers evolved from per-instance in-memory caches with 5-minute TTLs and database lookups on miss, which overloaded PostgreSQL on every redeploy and failed during database downtime, to push-based caching using PostgreSQL LISTEN/NOTIFY so routers never query the database in the hot path.
- [100x Faster: GraphQL Hive migration from Elasticsearch to ClickHouse](https://swe.quest/articles/100x-faster-graphql-hive-migration-from-elasticsearch-to-clickhouse-57650bfdbf95d1a8.md): ClickHouse · 2022-11-03 · Easy · 4 min read · Analytics & OLAP, Observability, GraphQL, Databases, Performance engineering
  GraphQL Hive replaced Elasticsearch with ClickHouse for storing per-request GraphQL monitoring data (consumer, requested fields, latency, request body) after query latency degraded with data growth and one large tenant slowed queries for smaller ones.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
