Hi Everyone, I am trying to understand the charac...
# orm-help
p
Hi Everyone, I am trying to understand the characteristics of connection pooling for Prisma running on Cloud Run. I understand that the default connection size is
2n+1
and our services operate with 4 vCPU . We currently have 20 instances of our service initialized and running; yet the steady state "# active connections" for our production database shows
320
active connections. Is there any information on how to debug why this may be occuring? I can't think of any other reason we would have so many connections open.
n
Hey Pranav 👋 Which database are you using? Are you using any external connection pooler like PgBouncer? One way to mitigate this issue would be to explicitly specify the number of connections PrismaClient can make with the database. You could use connection_limit in your connection string to define the maximum number of connections. After this you could check if the active connections are still remaining too high.
p
Hi Nurul, I apologize I just saw this. We are not using any external connection pooler and we are connecting to PostgreSQL 12 running on Cloud SQL. Is there a recommendation to set the connection limit? If not, it's still deterministic though no? As in for 20 4-core machines, the math is 20*(2*4 + 1) = 180 connections.