AWS Lambda provisioned concurrency vs EC2

  • I am looking to host an intensive computation app on AWS, and can't afford to wait for Lambda cold starts. The app needs to be able to handle up to 300 users without losing in performances, but it won't be having 300 users at all time, so it needs to be able to scale up and down. I've been benchmarking both Lambda with provisioned concurrency and EC2, and here are my first conclusions :

    Lambda is giving me very satisfying response times when configured with high memory (resulting in more vcpu resources)

    EC2 is giving me ok results (with c5a.large)

    It's more interesting for me to have lots of small EC2 instances rather than a big instance (ideally I am looking for one instance per active user)

    Now here is the big question : it'd be less expensive to have as many EC2 instances as the number of Lambda I plan to provision (since my lambdas are configured with 10GB of memory), but I'm not really sure if that would cause any problems with AWS, and I feel that provisioned concurrency on lambda would be more suited despite being more expensive. So what would you do in this situation ? Are there other parameters that I should consider ?

    PS :I thought about pinging my functions myself to keep them warm,but that feels very insecure to me when trying to warm around 300 lambda at the same time (even if this would be much cheaper).

  • Thanks for posting your issue and hopefully someone will answer soon.

    This is an automated bump to increase visibility of your question.

  • If the apps/scripts you are running are under 10 minutes execution then AWS Lambdas would be ideal. I mean, anything really short duration shouldn't be on an EC2 unless there is a security feature you cannot get with AWS Lambda that you need with an EC2. The idea of running VM's is a huge cost, both in time and money. I would stay away from EC2's as much as possible unless you really have to use em. Serverless 100%

    If you have some heavy scripts, consider breaking them apart into multiple Lambdas using AWS Step Functions.

    • This reply was modified 1 year, 8 months ago by  glenswan.
  • This was removed by the editor as SPAM

  • This was removed by the editor as SPAM

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply