DEV Community

Discussion on: Build a RESTful API with the Serverless Framework

Collapse
 
anirudhr95 profile image
Anirudh Ramesh

Hey, Thank you very much for the post!
I had a quick question - Considering lambdas are short lived (3 or 5 mins if I am not wrong) - do we benefit from keeping a ConnectionPool?

Once the lambda lifecycle ends, would we not need to create this connection pool again?

If we keep creating this connection pool, isn't the purpose of pooling defeated?

Thanks!

Collapse
 
sagar profile image
Sagar

Hi Anirudh, if we create a connection pool for each lambda then we're not reusing pool code. For code reusability, I have defined dbConfig.js file.