too many db connections on Prisma Accelerate
Hello!
hope you are all well.
I am using prisma accelerate to avoid this issue, but funny enough im running into it now im using accelerate (wasnt before i switch to prisma accelerate, (all just dev, not production yet))
I attached image of the error im running into. I for sure have prisma accelerate connected correctly, today i did like 30k queries.
So my initial thought is the prisma singleton i have in my monorepo isnt working with hot reloading, but i still assumed should be okay because shouldnt be connecting directly, unless i do prisma migrate or similar, but i havent used that today.
This is my current prisma singleton, but remember its in monorepo (turbo), idk if that changes anything.
any help would be awesome, thank you! also if anyone is from philippines, id love some dev help on fulltime basis (just chucking that out there too)
12 Replies
Hey 👋
Do you mind sharing your GitHub handle with me so that I can take a look at logs from our end?
Only other thing i am thinking of, but i cant find information to confirm this.
I am using prisma on edge, but also still have some lambda functions, as at the moment i am just using the same prismaClient edge for both edge and lamdba. I am thinking i should create two separate prisma singletons for each enviroment?
Just a quick add on to this:
current db limit is 100 connections. 90% of connections are coming from one ip, which im guessesing is prisma accerlate because its not any ip i have under control.
@Nurul (Prisma) I am sorry to @ you, i was just hoping if you had any sort of update from your end? i am needing to kill all connections often just for myself testing basically.
Hey! Can you let me know if you have added any connection_limit parameter in your database connection string as mentioned here:
https://www.prisma.io/docs/accelerate/connection-pooling#configuring-the-connection-pool-size
Accelerate: Connection Pooling | Prisma Documentation
Learn about everything you need to know to use Accelerate's connection pooling.
thank you for the reply.
Ive increase the db connction limit which helped. im guessing prisma accerlate defaults to 100 connections. which is all good just was causing issues iwth my dbeaver and so on connections.
Ive done the conneciton limit now, set to 10. however prisma is still using over 10 connections, currnetly 19. but for now its good enough and will keep an eye on it. thank you nurul
No worries! 🙏
Just a small update, its up to about 60 connnections now.
@Nurul (Prisma)
sorry i am tagging you.
i sent a db conneciton limit in string, i believe i set 30. My max connections is 200 on db. However prisma accerlate alone is taking up 102 connections, i am quite sure that this stage that prisma accerelate is going to run into conneciton limit. Are you able to have a look on your end? otherwise i think im better off going else where for pooling
Do your connections go over the limit? I'm facing a similar issue. I don't know if they are related.
https://discord.com/channels/937751382725886062/1269957438497493042
@Hinky I see you have 4 projects. Can you let me know in which project and environment are you facing this?
Is it in project named "ie-live"?
yeah that is correct.
its okay, im in middle of moving to neon db serverless adaptor, seems to have fixed it.
yeah that well over. I am going to neon db with their serverless adaptor and seems to be going well so far.