Quick question; I have a standard database on Digi...
# orm-help
r
Quick question; I have a standard database on Digital Ocean with a connection pool of size 11 + pgBouncer in front of it. How am I supposed to configure the DB URL for Prisma? I have
<URL>/pool?sslmode=require&pgbouncer=true
However this causes me a lot of trouble. I very often get an
Error: P1002
during build time on Vercel (while running
prisma migrate deploy --preview-feature
) and when using my app often get hit with a
Copy code
Timed out fetching a new connection from the pool. Please consider reducing the number of requests or increasing the `connection_limit` parameter (<https://www.prisma.io/docs/concepts/components/prisma-client/connection-management#connection-pool>). Current limit: 5.
Granted I execute quite a few queries, but nothing crazy... and this is only 1 user! What if I have 10 active users? Or 100? I thought setting
pgbouncer=true
should be enough? Should I set connection limit to 11? Or to 5000? I'm very confused! What am I doing wrong? 😅
d
Dont run the migration through the bouncer. Run the migration directly through the database url.
plus one +1 1
Normal requests will run fine through the bouncer
if you have doubts over the ability to scale, maybe try some load testing with artillery or k6
r
Hmmm ok so I'd have to set 2 database urls. That works...
d
yeah its annoying, we do the same for integration tests, hook directly into the database rather than the proxy
r
I'll do some testing with the load of the "normal" requests... it seems like it's working fine now and I only get errors a couple minutes after deployments... as if the DB/pool is overloaded by the deployment
Anyway thanks for the tips!
d
Hey Robert, You can set a different DATABASE_URL for build time using the
vercel.json
config and point it directly to the DB and continue using PgBouncer during the Lambda run-time.
💯 1