박연호
박연호
PPrisma
Created by 박연호 on 3/5/2025 in #help-and-questions
How do you manage the Prisma Client in Express and NestJS, GraphQL (Not Next.js) ??
We are using GraphQL with Apollo Server and injecting the Prisma Client into the resolver’s context. However, this approach requires passing the Prisma Client to service classes within the resolver. As the depth increases, the need to pass Prisma throughout the application becomes more frequent. It seems better to use a singleton and import the Prisma Client directly in the service class, as described in the article below. How do you manage the Prisma Client in your projects ?? 🤔 https://github.com/prisma/prisma/issues/5139
3 replies
PPrisma
Created by 박연호 on 1/3/2025 in #help-and-questions
About recommended connection pool size
vm cpu: 15 prisma: 6.1.0 mysql 8.0.18 mysql max_connections: 4030 I have a question because I have a different opinion with my colleague regarding the connection_limit value. I am running 15 servers as a cluster with the express app on docker on a gcp vm instance. Docker is running on the gcp vm , and 15 (number of CPUs) express apps are running on docker. The questions are as follows: 1. What should be the connection_limit value of each express app? 2~3(15*2+1/15) or 31 2. Why is the number of CPUs relevant when calculating the number of connection pools? (My guess is to make as many connections as the CPU can handle?) 3. If one express server processes many query requests, a pool timeout is likely to occur if the connection_limit value is set to 2~3. In this case, should I increase the pool timeout value or connection_limit? (while testing)
3 replies