marcus1987
New Member
- Messages
- 66
- Reaction score
- 0
- Location
- Sydney, NSW
Been running a side project on a $12 VPS with Postgres and I keep hitting max_connections errors the second traffic ticks up. Spent last weekend digging into pgbouncer configs and honestly half the docs read like they were written by someone who hates people.
The annoying part is everyone online just says "use pgbouncer lol" like it's one line. Then you get into transaction mode and suddenly your prepared statements explode, your session-level temp tables vanish, and your app throws weird "prepared statement already exists" errors that Google has like 3 results for, all from 2016.
I ended up going transaction mode with max_client_conn=200 and default_pool_size=20. Which feels completely made up. It works now but I have zero confidence it'll survive an actual traffic spike. My longest running query sits around 400ms so transaction mode was basically forced on me, session mode kept running out.
For people actually running pgbouncer in prod: do you just tune this once and forget it, or is it a constant moving target? And does anyone here bother with the newer native pooling in things like Supavisor or pgcat vs old faithful pgbouncer? Kinda tempted to rip out pgbouncer and try pgcat but I don't want to rebuild this whole thing for the fourth time this year.
Also mildly ranting: why is connection pooling still this painful in 2024. Feels like it should be a config flag by now.