Hello people Is it possible to make several micro...
# orm-help
c
Hello people Is it possible to make several micro-services communicate with a single instance of the Prisma Client? I'm asking this because the Prisma Client is consuming some considerable memory in each microservice, something that can be prevented if a single instance of the Prisma client is consumed. Instead of: M1 -> Prisma Client 1 M2 -> Prisma Client 2 M3 -> Prisma Client 3 M4 -> Prisma Client 4 I want to get something like: M1 -> Prisma Client 1 M2 -> Prisma Client 1 M3 -> Prisma Client 1 M4 -> Prisma Client 1
d
Hey Carlos, not quite sure this would help, but this is how I instanciate prisma in my serverless applications with nextJS import { PrismaClient } from "@prisma/client"; declare global {   namespace NodeJS {     interface Global {       prisma: PrismaClient;     }   } } let prisma: PrismaClient; if (!global.prisma) {   global.prisma = new PrismaClient({     log: ["info"],   }); } prisma = global.prisma; export default prisma;
j
If you deploy your micro services to different environments, no this does not exist yet. If they all run in the same app and "container", then something like Daniel posted might be a viable direction.