jackc / pgx

PostgreSQL driver and toolkit for Go
MIT License
10.89k stars 848 forks source link

PGX + Conn Pool + Kube #1125

Open Jarch09 opened 2 years ago

Jarch09 commented 2 years ago

Hi, n00b question here:

What is the recommended best practice for handling connection pooling with kube (so multiple containers all using the same DB)?

pgx obviously has its own lightweight connection pool. Should DB access still be fronted with pgbouncer?

Seems somewhat clunky to have to define the application connection limits for 1 container based on your knowledge of how many other containers are also using that same DB... is there an elegant solution to this?

cloud-66 commented 2 years ago

it is not question about pgx or even kube. Every pg-user knows that because every single connection is new operation system process , connection use a lot resource. There is improvement in postgres 14 on this topic, which decreased degradation. But still, using connection pooler is recommended for production heavy load. However, for example we have postgres instance with more than 10k connections for test where performance is not important, and it works