PrismaP
Prisma2y ago
19 replies
Mohammad Orabi 🇱🇧

Setting Connection limit in gcp cloud run and cloud sql

What is the best practice when setting the connection limit of prisma in gcp cloud run?

* I am using postgres from cloud sql
* I have a master database with 14 cpu and 20GB ram
* 3 replicas each with 10 cpus and 20GB ram , each can handle 500 connections
* cloud run with multiple instances , each instance with 2 GiB memory and 2 cpus

how can I know what is the best connection limit to set , as I noticed increasing them is disconnecting cloud run from the sql sometimes

ps : I am using replicas extension
const prisma = new PrismaClient().$extends(
  readReplicas({
    url: DATABASE_URL_REPLICAS
  })
);
Was this page helpful?