Yan Cui
1 min readMar 14, 2019

--

Hi Karina, I‘m pretty sure the long delay you’re seeing is not for creating the RDS connection, but the ENI for running inside the VPC, which on its own takes around 10s in my experience.

I think the first thing you should do to debug where the time is taken is to enable X-Ray tracing, and put a segment around RDS connections to see how long that takes. Also, since an instance of your function would process one request at a time (there’s no concurrency inside an invocation) you only need one connection. Most libraries would try to initialize multiple connections, which is redundant in this case.

If you haven’t read his post already, I recommend giving Jeremy Daly’s post a read on how to manage RDS connections with Lambda: https://www.jeremydaly.com/manage-rds-connections-aws-lambda/

--

--

Yan Cui
Yan Cui

Written by Yan Cui

AWS Serverless Hero. Follow me to learn practical tips and best practices for AWS and Serverless.

No responses yet