News for hackers. Stuff that matters.
Re:AWS Lambda – Best practices by gamache on Thursday March 02, 2017 @08:11AM (#13773749)
AWS will sometimes reuse the container in which your Lambda runs, so if you set up e.g., database pools during load time, they're often still there the next time.

Related: https://aws.amazon.com/blogs/compute/container-reuse-in-lamb...

Re:AWS Lambda – Best practices by pastaking on Thursday March 02, 2017 @11:45AM (#13775523)
Yes, but there's no guarantee that lambda will reuse a connection / won't continue to request new connections against your database :( Currently, it seems like there's no "concurrency limit" or "per-function throttling". It would be amazing if requests are just magically queued up in SQS and lambda just processes them... like a traditional queue-worker system except now we don't have to manage the infra.
Re:AWS Lambda – Best practices by giaour on Thursday March 02, 2017 @12:22PM (#13775969)
That's essentially how asynchronously invoked (e.g., triggered by an event in S3 or DynamoDB) lambda tasks work. They're retried if the original invocation doesn't execute successfully, and if the third try fails, the triggering event is sent to a dead letter queue in SQS.
Re:AWS Lambda – Best practices by alexvy86 on Thursday March 02, 2017 @10:28AM (#13774686)
I'm not familiar at all with Amazon's cloud, so I might be misinterpreting... but when you say "sometimes reuse..." and "they're often still there..." it sounds to me like they might as well not be? How would that be a good foundation for an app deployed in Lambda?
Re:AWS Lambda – Best practices by kevan on Thursday March 02, 2017 @11:45AM (#13775532)
Think of Lambdas like autoscaling containers. If you're operating with decent load, there's a good chance your container will stay up and be reused for multiple requests. But if load drops, your containers might be shut down so they aren't taking up resources while they're not being used. When load increases again, more instances will be spun up.

It's the same approach as autoscaling VMs, but at a function level.

Re:AWS Lambda – Best practices by asdfasdfa11112 on Thursday March 02, 2017 @11:34PM (#13780753)
If the pool is still there, it gets reused. If not, a new one is created.

It should help with overhead, but not always. There's benefits to partial solutions sometimes, if you can avoid the side effects.

Re:AWS Lambda – Best practices by scarhill on Thursday March 02, 2017 @09:49AM (#13774306)
Right, but only one request can be in progress against a container at a time, correct? So there's no reason for your pool to allow more than one connection. Of course, that might still be useful for retry, etc. if the connection went away while the container was frozen.
Re:AWS Lambda – Best practices by throwaway2016a on Thursday March 02, 2017 @10:17AM (#13774573)
It would be a pool of just one connection per database endpoint. So pool in the sense that once a stateless function is done with it it becomes available again for another function to take it. But you don't need multiple connections of the same type in the pool.