I recently went on a journey to deeply understand connecting from serverless functions to SQL databases. There is a lot of FUD around serverless "needing more concurrent connections". This kind of makes no sense but as I was benchmarking I realized that sometimes the connection pool was exhausted unexpectedly. Why was that happening???? Eventually, I realized that there was a real problem with serverless. It's related to "suspended" functions effectively leaking connections. Thing is: While this is an unsolvable problem with AWS Lambda, it can be solved with modern serverless platforms like Vercel's Fluid Compute. Way more detail plus the solution in this post:
There’s a myth that serverless compute requires more database connections. We bust that myth, but reveal a real problem, and share our solution. vercel.com/blog/the-real-…