PrismaP
Prisma8mo ago
3 replies
rodgc

Prisma opening up connections for every repository query

Hey guys! My name is Rodrigo and im having some trouble with my repositories in an application taking longer times because of prisma:engine:connection.

From what I understand, Prisma has a pool of connection and it doenst need to open new connection for every query. But thats not whats Im seeing.

For better context, this application uses Node with Express and Prisma. I have a Adapter, Controller, Service and Repository architecture.

Prisma is instantiated only once, as documentation says, but i cant understand why, on a load test where I use locust to hit 250 users on 4 specific endpoints, i have "prisma:engine:connection" for every query. If there is anything more I can share so your guys better understand the problem, just ask for!

Here is a print screen of one endpoint call that took 5.7 seconds to complete from my Grafana + Tempo tracing. As shown in the picture, there are 4 prisma connection, but the entire endpoint had 7 connections with db, being all those connection almost 93% of the whole endpoint timing. This screenshot was taken when the application was overloaded by the load test.

As DB im using RDS with MySQL in a machine m7g.16xlarge, so it has very high specs. And the node server is hosted in 3 EC2 machines m6a.2xlarge. Im guessing infra aint the bottleneck. Do someone has some idea of what could be the problem?

Edit: Prisma v6.9.0 and Express v4.19.2
Screenshot_2025-06-18_at_09.07.51.png
Was this page helpful?