flâneur — a map of the web's best reading

How to solve Lambda and RDS database connection issues for Nodejs Application | by Faiq Ahsan | Medium

faiqahsan.medium.com · 1,087 words · saved by 1 readers

Going serverless with Lambda frees your from the pain of managing and scaling related tasks on your own and also saves you a-lot of money but only running when it needs to but it does come with some issues of its own. One of it is the database connection management as the lambdas are stateless. Let’s see how do we solve it. Let’s address the major issue when invoking a lambda thousand of times concurrently, when a request invokes a lambda it creates a container having the runtime and all the dependencies then it runs the lambda function inside it. Now if it’s processing the request and another request comes like during peak hours, then it creates another container having its own isolated environment. Hence each new container having its own environment opens up a new connection with the database without sharing the existing environment with other lambda containers.. Hence our concurrent open RDS db connection exceeds very fast which are limited e.g around 800 for t3.large instance. It i

How to solve Lambda and RDS database connection issues for Nodejs Application Faiq Ahsan 5 min read · Jul 14, 2021 -- Listen Share Press enter or click to view image in full size “In the name of Allah most beneficent and merciful” Going serverless with Lambda frees your from the pain of managing and scaling related tasks on your own and also saves you a-lot of money but only running when it needs to but it does come with some issues of its own. One of it is the database connection management as the lambdas are stateless. Let’s see how do we solve it. Let’s address the major issue when invoking

Explore this link on the map →

related reading