Lambda container reuse
In high traffic environments lambda reuses the same container to serve multiple requests. The lambda adapter appears to create a new Context inside the handler for each request. Is there any way to keep things like database connections and s3 clients in the global scope outside of the handler? We sometimes see lambdas fail due to running out of file descriptors when many connections are spawned from the same container.
4 Replies
Also facing the same issue. Did you figure this out @swammer ?
No, I implemented a temporary workaround. I'll keep digging eventually and let you know if I figure out how to fix the root cause
Any hint in terms of your workaround?
what high traffic are you experiencing?
are you declaring your connections outside the handler?