sylvester stallone
sylvester stallone
PPrisma
Created by sylvester stallone on 8/13/2024 in #help-and-questions
why does prisma never read from main db and always from replicas?
we're barely seeing any traffic on our main db, but both replicas have 80% cpu utilization. why is the load not getting spread? I just reset both replicas at the same itme and for some reason the entire website went down, which sshouldn't happen if prisma were reading from main ```import { PrismaClient } from '@prisma/client'; import { readReplicas } from '@prisma/extension-read-replicas'; declare const global: Global & { prisma?: ReturnType<typeof createPrismaClient>; }; export let prisma: ReturnType<typeof createPrismaClient>; function createPrismaClient() { return new PrismaClient().$extends( readReplicas({ url: [ process.env.DB_REPLICA_URL_1 ?? '', process.env.DB_REPLICA_URL_2 ?? '', ], }), ); } if (typeof window === 'undefined') { if (process.env['NODE_ENV'] === 'production') { prisma = createPrismaClient(); } else { if (!global.prisma) { global.prisma = createPrismaClient(); } prisma = global.prisma; } }
2 replies
PPrisma
Created by sylvester stallone on 8/6/2024 in #help-and-questions
how many connections do bulk queries eat up?
hi, is it safe to assume that since bulk queries are done in a transaction, that only one db connection will be taken up by the query? (as opposed to, for example, doing a bunch of individual inserts and promise.all'ing them). https://www.prisma.io/docs/orm/prisma-client/queries/query-optimization-performance#using-bulk-queries
3 replies
PPrisma
Created by sylvester stallone on 4/24/2024 in #help-and-questions
optionally adding an $extends clause to prisma export
how can I accomplish the following fuctionality: basically I want to be able to access db replicas only in my production instance and not in any other environment. what I'm trying to do export default process.env.DB_REPLICA_URL_1 && process.env.DB_REPLICA_URL_2 ? prisma.$extends( readReplicas({ url: [process.env.DB_REPLICA_URL_1, process.env.DB_REPLICA_URL_2], }), ) : prisma; but obviously this has ltos of typing errors. what can I do in this case?
2 replies
PPrisma
Created by sylvester stallone on 4/23/2024 in #help-and-questions
is there any way we could get in touch with someone from the accelerate team?
someone in the sales/management team? our product shat the bed spectacularly today and we're about to lose one of our major customers because accelerate couldn't scale to handl 100 connections. we're ready to throw money at the problem but this is super urgent and we've been locked into the ecosystem and can't switch out right now
7 replies
PPrisma
Created by sylvester stallone on 3/28/2024 in #help-and-questions
is there still no option to manually invalidate the cache?
with accelerate, is this even in development?
11 replies