DEV Community

loading...

Discussion on: Solution to multiple connections with knex while using Next.js

Collapse
barelyhuman profile image
Reaper Author

I'd use the memoize on a general monolith using something express but with Next the micro server drops the connection variable and for me, i didn't go deep into figuring out why the connection was being left on idle and hence the destroy solution came into play.

No it's not that slow but obviously if you have a million people connecting at once to your service, that'd be bad, but since TillWhen's max usage is 15-20 people at any given time so it works for now but the solution can be improved, the only reason it doesn't kill the db in my case is because the functions are pretty concise and I don't make more than 1 query or 1 insertion/updation query per request, so it's pretty quick in my case but as I said,
will need better connection cache handling in case of very heavy usage

Forem Open with the Forem app