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.
santi
santi41d ago
Also facing the same issue. Did you figure this out @swammer ?
swammer
swammer41d ago
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
santi
santi41d ago
Any hint in terms of your workaround?