2

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!

2
  • This isn't directly a programming issue. Consider posting to dba.stackexchange.com. Commented Aug 28, 2024 at 15:59
  • "but this is not a viable long-term solution as it can lead to delays in query execution." Using t3.micro has pretty much surrendered that game already. Commented Aug 28, 2024 at 17:03

1 Answer 1

1

You can manually set connection pool size by using connection_limit parameter

for example: postgresql://USER:PASSWORD@HOST:PORT/DATABASE?schema=myschema&connection_limit=5&socket_timeout=3

ref: https://www.prisma.io/docs/orm/overview/databases/postgresql#connection-url

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.