Connections are over connection limit
I deployed my NextJS + Prisma on a dedicated server then I noticed that the connections on my Postgres database is higher than the connection limit.
I set my connection limit to 30 (
And, here is how I initiate the Prisma client.
Another weird thing is that I extracted metric from the Prisma to Statsd but The data doesn't match with data from Postgres database. The Prisma idle connection is less than data from Postgres. You can see from the graph.
So, all I want to know is
1. How can connections go over limit?
2. Why are Prisma metric and Postgres data different?
I set my connection limit to 30 (
?connection_limit=30) but the connections go to around 70 - 80. You can see it from the graph. I already made sure if the data from the graph is correct by using this query.And, here is how I initiate the Prisma client.
Another weird thing is that I extracted metric from the Prisma to Statsd but The data doesn't match with data from Postgres database. The Prisma idle connection is less than data from Postgres. You can see from the graph.
So, all I want to know is
1. How can connections go over limit?
2. Why are Prisma metric and Postgres data different?


Solution
In the end, it's not problem with Pisma. It's problem with our PM2 config. We set instances to "max" which is too much. I reduced the instances number and it works now. Thank you for support. @Nurul (Prisma)