DEV Community

Discussion on: Why We Moved From Lambda to ECS

Collapse
 
taylorreece profile image
Taylor Reece

That's what surprised us, too - we thought every Lambda got a new environment in a new container. It turns out if you invoke a Lambda that you haven't in a while, it "cold starts", so you get a new environment. Then, that Lambda sits around "warm" waiting for more invocations. That same environment might be used several times before it gets removed from the pool.

That's usually fine, since Lambdas tend to be stateless for most use cases, but in our case state could potentially be mucked with by a user's custom code that we execute.

Collapse
 
kayis profile image
K

Did you try a custom runtime?

Thread Thread
 
taylorreece profile image
Taylor Reece

We didn't. What has your experience been with custom runtimes in Lambda?

Thread Thread
 
kayis profile image
K

I don't have much, but as far as I understood it a custom runtime is basically a HTTP API that passes event data to a "function" whatever that may be.

I'd guessed that you could have used a customer ID in the event data and have the custom runtime spin up isolated "functions" for every customer.