Connection pooling postgres using typeorm for multiple app instances

Viewed 13

Our architecture: We have multiple app instances running on k8s -> a total of 8 NestJS applications and using typeorm for all DB side of things. It seems we can pass max to extra option of Datasource https://github.com/typeorm/typeorm/issues/3388#issuecomment-673242516. That is passed down to node-postgres the underlying library for postgres connection.

Question:

  1. If our connection pool size is 20 do those 20 connections are shared between 8 apps or do we get a total of 160 connections?
  2. What are the best practices for setting pool size limit?
0 Answers
Related