My team is running a PostgreSQL database on an AWS RDS t3.micro instance with 2 vCPUs and 1GB of RAM. When we deploy our backend (NestJS with Prisma ORM) on ECS, we notice the following log:
prisma:info Starting a postgresql pool with 3 connections.
However, when running locally on my M1 MacBook, Prisma initiates 21 connections.
From what I understand, having only 3 concurrent connections means that any additional connection requests will have to wait until an existing connection is released. This limitation is causing us to encounter the following error:
Timed out fetching a new connection from the connection pool. More info: http://pris.ly/d/connection-pool (Current connection pool timeout: 10, connection limit: 3)
We applied a temporary fix by increasing the connection pool timeout, but this is not a viable long-term solution as it can lead to delays in query execution.
I’m trying to understand what dictates this connection limit of 3. Is it directly tied to the number of vCPUs? The CPU load and memory usage metrics do not appear to be a bottleneck.
Any insights or recommendations on how to increase the connection pool size effectively would be greatly appreciated. Thanks!