PGKeeper:构建我们为 Postgres 所需的 bouncer
PGKeeper: Building the bouncer we needed for Postgres
PGKeeper:为 Postgres 构建我们需要的 bouncer

Lihao HeSoftware Engineer
Lihao He
软件工程师

Tim GohSoftware Engineer
Tim Goh 软件工程师

Mehant BaidManager, Software Engineering
Mehant Baid,软件工程经理

Figma has grown a lot over the past few years in terms of both features and users, which means our database layer has to contend with an onslaught of novel workloads and increased traffic. It was clear we were outgrowing PgBouncer, a lightweight and widely adopted PostgreSQL connection pooler. That led us to build PGKeeper, a new connection and load management service that replaces PgBouncer in front of our Postgres fleet. In this post, we walk through how we designed and rolled it out.
Figma 在过去几年中无论是功能还是用户数量都增长了很多,这意味着我们的数据库层必须应对海量新颖工作负载和流量激增。很明显,我们已经超出了 PgBouncer 的能力范围,PgBouncer 是一个轻量级且广泛采用的 PostgreSQL 连接池器。这促使我们构建了 PGKeeper,一个新的连接和负载管理服务,用来取代 Postgres 集群前面的 PgBouncer。在本文中,我们将介绍我们如何设计并推出它。
10,000-foot view of the database stack
数据库技术栈的 10,000 英尺视图
PostgreSQL serves as the foundation of Figma's OLTP system. As Figma grew, we implemented horizontal
PostgreSQL 是 Figma 的 OLTP 系统的基石。随着 Figma 的增长,我们实施了 horizontal
How Figma’s databases team lived to tell the scale
Figma 的数据库团队如何活下来讲述规模化

Our nine month journey to horizontally shard Figma’s Postgres stack, and the key to unlocking (nearly) infinite scalability.
我们九个月的旅程,将 Figma 的 Postgres 堆栈水平分片,以及解锁(几乎)无限可扩展性的关键。
and [vertical
和 [vertical

The growing pains of database architecture
数据库架构的成长阵痛
How the Figma infrastructure team reduced potential instability by scaling to multiple databases.
Figma 基础设施团队如何通过扩展到多个数据库来减少潜在的不稳定性。
](https://www.figma.com/blog/how-figma-scaled-to-multiple-databases/)sharding across our database fleet.
](sharding 跨越我们的数据库集群。

We built a request routing system called DBProxy to hide the sharding complexity from application code. It parses and analyzes the query, selects the appropriate target Postgres instances, and rewrites the query into one or more queries for each designated instance. From there, the re...