Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Figma 15 min read Case study mediumAdept

Figma's next-generation data caching platform

FigCache is a stateless Go proxy that speaks the Redis RESP wire protocol. Figma built it as a unified data plane in front of its ElastiCache Redis fleet, together with first-party client wrappers in Go, Ruby and TypeScript. It multiplexes many client connections onto a bounded pool of Redis connections, which protects Redis from thundering herds when client services scale up. It also centralizes routing across clusters and adds consistent observability. Internally, the in-house ResPC framework handles streaming RESP parsing and schema-driven command parsing, feeding a configuration-driven tree of filter and data engines that does things like scatter-gather fanout to resolve cross-slot pipelines. Figma chose to build rather than adopt an open-source proxy to get protocol extensibility, Redis Cluster emulation and custom commands such as Redlock-based locking, and the caching layer has reached six nines of uptime since rollout.

Related posts

  • Postmortem: Service disruptions on June 6 & 7 2022

    Figma mediumAdept

    Four Figma outages over June 6–7, 2022 were caused by Engine CPU saturation on a Cluster-Mode Enabled AWS ElastiCache Redis node, triggered by Pub/Sub traffic flowing over the Redis Cluster Bus. The Cluster Bus's outgoing buffer grows exponentially when sends fall behind any node, and each partial send truncates it via sdsrange/memmove, whose cost scales with the remaining buffer size, creating a self-reinforcing CPU spiral. Scaling up to a larger cluster made things worse because more nodes lowered the trigger threshold. Figma recovered by partitioning Redis workloads into separate clusters and moving Pub/Sub to Cluster-Mode Disabled instances, and recommends avoiding Pub/Sub on cluster-mode Redis until the bug is fixed.

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

    Figma mediumAdept

    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.

  • How Figma manages sandboxes at scale

    Figma mediumAdept

    Nimbus is Figma's internal platform for running tens of thousands of sandboxes for AI-generated code across multiple cloud providers. Teams declare a namespace config (image, resources, health checks, warm pool bounds, allowed hosts), and a control plane picks providers, enforces egress policy and manages lifecycle through GetOrCreate, Get and Delete APIs. Security comes from read-only egress to untrusted hosts, enforced by provider controls or a proxy sidecar, plus encrypted credentials that are swapped for real ones only at the intended destination. Demand-sized warm pools with Postgres skip-locked claiming, health-weighted provider routing and Redis-scheduled health checks cut provisioning latency by 90% and raised availability from 99% to 99.95%. A control-loop simulator exposed a feedback bug where slow-but-successful providers kept receiving work.

  • How Figma’s databases team lived to tell the scale

    Figma mediumAdept

    Figma horizontally sharded its RDS Postgres stack after vertical partitioning ran out of room. Multi-terabyte tables were hurting vacuum reliability and approaching RDS IOPS limits. Instead of moving to CockroachDB, TiDB, Spanner, Vitess or NoSQL, the team built sharding on its existing Postgres fleet using several pieces: colocated table groups ("colos") that share a shard key such as UserID, FileID or OrgID; hash-based routing to avoid hotspots from auto-incrementing and Snowflake IDs; logical sharding via views, kept separate from physical shard splits; and a DBProxy query engine that parses and routes queries and also does load-shedding and request hedging. Deliberate tradeoffs included dropping atomic cross-shard transactions, accepting slower range scans, keeping rollback possible, and using full logical replication. Sharding the first table took nine months.

  • Making multiplayer more reliable

    Figma mediumAdept

    Figma added a write-ahead journal to its in-memory multiplayer service, which previously persisted files only via full checkpoints to S3 every 30–60 seconds. Incremental changes are now batched and written to DynamoDB with sequence-number ranges. File ownership is enforced with a lock table and conditional writes to prevent split-brain corruption. Cross-region durability comes from guaranteeing a checkpoint within 30 minutes, since DynamoDB global tables would have cost about 6x more. After ~400K byte-identical replay validations during a dark launch, the journal handles over 2.2B changes per day, persists 95% within ~600ms, and removes checkpoint write spikes during deploys.

The quest for software engineering knowledge.

Look:
Layout: