Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use with PgBouncer #3112

Open
Kearsan opened this issue Dec 20, 2023 · 0 comments
Open

How to use with PgBouncer #3112

Kearsan opened this issue Dec 20, 2023 · 0 comments

Comments

@Kearsan
Copy link

Kearsan commented Dec 20, 2023

Hello there,

I use node-postgres since months and now my project is evolving so I migrated on a more robust setup.

I was using node-postgres pooling to manage the pool at app level, but now I'm running my app on an auto-scale k8s and my postgres db on multiple nodes, so it makes sense to manage a centralized external pool between my app and my db, here comes PgBouncer.

First of all, am I getting the logic right? Does it make sense to use a pool outside the app logic since I can't anticipate the number of clusters running, and so the maximum clients per app instance? Or should I still create pools inside my app? Maybe PgBouncer fit better for other languages like PHP where you can't keep a pool instance opened?

And if it make sense to use PgBouncer, what are the good practices with node-postgres? Do I have to use a Client instance instead of a Pool instance? Will I be able to get several clients in the same app instance? Will I still be able to run transactions? Will there be a drop in performance? Will Andrew marry Laura?

I saw that PgBouncer was mentioned several times here but I can't get the answers I'm looking for unfortunately. It sounds to me that it's better to use a pool at app level but I'm not sure, and it feels better to handle the pool logic at the same place to get perfect control on the number of connections.

Thank you for you help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant