6 ms·
PgBouncer is basically a requirement of any production Postgres system, but I've always wondered why it simply wasn't part of the Postgres package itself? For i
by Mizza 8y ago
PgBouncer is basically a requirement of any production Postgres system, but I've always wondered why it simply wasn't part of the Postgres package itself? For instance, it means a dedicated EC2 instances is necessary for getting the most out of AWS RDS - even the whole point of RDS is to avoid managing that server..
- dijit 8y agoPgBouncer doesn’t save you from a lot of the actual pain when dealing with connections. And that’s prepared statements, you can’t pool prepared statements so high volume transactional databases need a lot of connections. Including pgbouncer in the base package would just mask the issue because pgbouncer saves you (mainly) from the short lived connection.
- EB66 8y ago> PgBouncer doesn’t save you from a lot of the actual pain when dealing with connections. And that’s prepared statements, you can’t pool prepared statements Prepared statements work fine with PgBouncer when you have session pooling enabled (as opposed to transaction pooling). It may not save you from all the pain of dealing with connections, but PgBouncer definitely helps a lot when you're working with remote Postgres servers and high latency (i.e., > 10ms). Mitigating the delay and cost of connection initiation is pretty huge.
- dijit 8y agoOnly if your code is not connection pooling itself. In my case that is true, but for a php webapp (for example) it is a lot less true.
- akurilin 8y agoWe were big proponents of pgbouncer for years, but having one extra, sometimes capricious actor in our architecture ended up not being worth it. Especially if you're IO-heavy like we are, and that Web App -> DB pipe is the hottest path in the entire system. Removing it altogether made monitoring and debugging performance issues easier, and client-side pools were essentially "good enough" for our purposes.
- Mizza 8y agoWere you managing your own DB server instance? I don't think client side pools are possible with RDS.
- akurilin 8y agoWe're on RDS right now. We use connection pools from https://www.yesodweb.com/book/persistent https://www.yesodweb.com/book/persistent
- Mizza 8y agoOhhh, I understand. Long day. I got that backwards, I thought there was a server-side option I wasn't aware of. So you don't have a dedicated server with PgBouncer on it, you just move the pooler to where the requests originates from. I think this might be problematic in a highly elastic/distributed architecture but would work if you have a beefy dedicated application instance.
- akurilin 8y agoCorrect, you'd have to instruct your pools to resize as machines are added and removed. We haven't had to do that so far, as we're not that dramatically elastic.