有人在不使用 PgBouncer 的情况下运行 Postgres 吗?
Does anyone run Postgres without PgBouncer?

原始链接: https://brandur.org/fragments/postgres-without-pgbouncer

在撰写关于 Postgres 连接管理文章的十年后,作者指出情况几乎没有改变:Postgres 依然难以应对高连接数,使得 PgBouncer 等工具成为必需品。 对托管 Postgres 服务提供商的调查证实,几乎所有服务商都包含某种形式的连接池。然而,作者认为当前的“售后”式做法(即提供商将 PgBouncer 作为单独且往往复杂的插件进行捆绑)效率低下。这不仅迫使提供商重复构建基础设施,也让用户不得不面对特定的技术限制,例如对 `LISTEN/NOTIFY` 的支持局限。 作者将其与汽车行业进行类比:销售没有集成连接管理的数据库,就像销售没有挡风玻璃的汽车。他主张这应该是一项核心且无缝的功能,类似于 MySQL 或 MongoDB 环境中的体验。尽管关于 Postgres “每个连接一个进程”模型的架构争论长期以来阻碍了进展,但作者认为,转向原生的“一个 URL,一个端口”体验,将是该数据库生态系统中最具影响力的运营改进之一。

Hacker News 最新 | 过往 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 有人在不使用 PgBouncer 的情况下运行 Postgres 吗? (brandur.org) 24 点 | abelanger 发布于 4 小时前 | 隐藏 | 过往 | 收藏 | 1 条评论 alexthedigger 3 分钟前 | 下一条 [-] 有。 回复 准则 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文

I got a nice shout-out from Ben Dicken over the weekend on an old article I’d written on managing database connections. (This guy is apparently the Mick Jagger of databases, because I can’t remember having gotten so many inbound LinkedIn invitations in one day before.)

Something that hit hard is that I wrote this article almost ten years ago.

Just as striking is that as I was reading back through it, I realized that despite being a decade old, it’s still pretty much up to date. Postgres is still, shall we say, not great at managing lots of connections, so you want to use local connection pools, short-term checkouts, and a pooler like PgBouncer.

It got me wondering: how standard is it to use a pooler, exactly? To answer that question, I made a table of all managed Postgres providers with household notoriety and whether they support PgBouncer, something close to PgBouncer, or no connection pooling at all.

Provider Pooler? Implementation Availability / caveat
Aiven PgBouncer Startup plans and above
Alibaba RDS PgBouncer
AWS RDS / Aurora RDS Proxy Separate managed proxy service
Azure PG PgBouncer
Crunchy Bridge PgBouncer
DigitalOcean PgBouncer
EDB Postgres AI PgBouncer
Fly.io MPG PgBouncer
Google Cloud SQL PgBouncer / managed pooling Requires Enterprise Plus
Heroku PgBouncer Some plans only
IBM Cloud Self-managed only
Neon PgBouncer
OCI (Oracle) No managed pooler
PlanetScale PgBouncer
Railway PgBouncer Added as separate service
Render PgBouncer On paid databases
Supabase PgBouncer or Supavisor PgBouncer or Supavisor (proprietary pooler) for serverless
Tiger Cloud PgBouncer

Not only is PgBouncer support widespread, but we see above that the overwhelming majority of providers bundle it out of the box. I’d go a step further – since neither IBM nor Oracle is a service that any self-respecting person not part of an enterprise sales cycle would actually use, one hundred percent of plausible managed Postgres providers bundle a pooler.

In some ways, it could be argued that this status quo is okay. Users that need a connection pooler have access to one, and can use it to keep prod stable.

But there’s undoubtedly a lot of wasted effort here. Every provider has had to come up with their own homegrown mechanism for getting multiple components set up and configured and establish a convention for where to find Postgres versus its bouncer. Every user needs to reference a guide explaining PgBouncer’s limitations (e.g. don’t listen/notify) and read about its pooling modes and tradeoffs.

Imagine if you went to your local car dealership and they sold you a car without a windshield. On the way over you’d noticed that 100% of vehicles on the road did in fact have windshields, and for good reason because it turns out to be pretty dangerous to drive without one. Since you were the one that bought the car, it’d be hard to argue that it’s not your responsibility now to outfit it with a windshield before it’s roadworthy, but it’d also be fair to later be pissed off at the dealer for selling a vehicle that can’t just be driven off the lot.

What if there was a world where you went to your favorite Postgres provider and you got one database URL, one port, and no extra configuration or caveats to worry about? Your managed provider doesn’t need to add an aftermarket windshield because one came with the car already. We know a place like this can exist because that’s already how things work in MySQL and Mongo-land.

There are reasons it doesn’t happen, like reviving the age-old processes versus threads debate, which very few contributors are venerated enough to push for progress on, but given the developer-years’ worth of effort in working around Postgres’ lack of connection pooling, it’s hard to argue this wouldn’t be one of the highest-impact operational improvements possible.

联系我们 contact @ memedata.com