0
votes

I am integrating lambda(Python) with RDS proxy, and for some of the examples on the web, I can see people initiating the connection outside the handler, and never closing it.

On the other hand, I have seen examples on which people initiate the connection within the handler.

So, what is the best practice? I assume if you go for the first approach, the idle client connection timeout(RDS proxy) should be short, otherwise you can surpass the connection limit.

1

1 Answers

0
votes

If we create the connection outside handler then the same connection can be used for warm starts which is good have if idle timeout is set appropriately.

If the connection is set inside handler then it'll have an overhead of creating and closing connections for each invocations.