In general I would prefer Lambda over Fargate for the following reasons:
- Scaling is handled for you. This can be particularly important if your traffic is very spiky and unpredictable.
- At low volume you might not have to pay anything
- It's easier to deploy and configure
Fargate does have some advantages, however.
- At a higher load you may find that Fargate is cheaper.
- A single Fargate task may be able to handle quite a few requests, so you might not need a lot of scaling. This depends a lot on language and what the code does.
- No cold starts. Whilst provisioned concurrency in Lambda helps with this it doesn't deal with traffic spikes. If you have consistent/known spikes in traffic you can probably handle it with autoscaling in Fargate.
There is more that goes into it that what I've stated, and I've certainly over simplified some of my statements, but it's a good starting place.
Answer from Jason Wadsworth on Stack OverflowMedium
rajaswalavalkar.medium.com › aws-lambda-reserved-concurrency-v-s-provisioned-concurrency-scaling-db8e93703b02
AWS Lambda Reserved Concurrency v/s Provisioned Concurrency Scaling | by Rajas Walavalkar | Medium
January 4, 2022 - When a function has being with a reserved concurrency configuration then no other lambda function within the same AWS account and region can use that concurrency. There is no charge for configuring reserved concurrency for a function.
AWS re:Post
repost.aws › questions › QUoK1sk8CUTyGN7VESAcjlgA › why-cold-starts-of-a-lambda-with-provisioned-concurrency-are-much-slower-than-cold-starts-of-on-demand-instances
Why cold starts of a lambda with provisioned concurrency are much slower than cold starts of on demand instances? | AWS re:Post
July 30, 2023 - I think you do not get the boost during Provisioned Concurrency initialization. You can prove this by increasing your function's memory to 1.7GB. In this case you will get approximately the same amount of CPU as the boost you get. ... Thank you for confirming. Tested and with more CPU On-Demand instances are still a bit faster but the difference is not that visible (10-20%) ... Hi, If you look at the diagrams of https://aws.amazon.com/blogs/compute/operating-lambda-performance-optimization-part-1/, you will notice that the so-called "Execution Initialization Code" in the post happens as part of lambda execution itself in a cold start while it happens as part of initialization phase with provisioned concurrency.
Having trouble with the difference between reserved and provisioned concurrency
Imagine you are going to rent 5 cars and they have 1000 cars and a delivery time of around 30 min Reserved concurrency means that even if 1000 people shows to rent a car, the rental will only be able to rent 995 because you reserved the other 5, however, you will have to wait the usual 30 minutes to get a car the moment you want it. A Provisioned concurrency of 1 means that in addition to have 5 cars reserved for yourself, the car rental hired someone to follow you around in one car like a creep all the time, so whenever you want to rent a car, you just hop in and skip the 30 minute wait time More on reddit.com
AWS Fargate vs Lambda with Provisioned concurrency - Stack Overflow
I want to support a light-weight functionality (a DDB lookup and forward the request to backend service) supporting around peak 50 TPS with an acceptable latency More on stackoverflow.com
Lambda provisioned concurrency for $LATEST, or, updating API gateway to refer to version
Dear Experts, I have API gateway and Lambda working happily, without using any versions or aliases. I'd now like to enable provisioned concurrency. It seems that I cannot configure provisioned co... More on repost.aws
AWS Lambda provisioned concurrency vs keeping a lambda warm with events?
For events, keep in mind that pinging your lambda function with scheduled events will probably only keep one container warm, so if multiple requests are made to the function in parallel by users then some requests may still incur a cold start. If you want to keep more containers warm, you can invoke a separate lambda function on a schedule which concurrently makes multiple requests to your service. More on reddit.com
Videos
17:51
How does AWS Lambda Concurrency Work? - YouTube
13:02
AWS Lambda Concurrency - Provisional & Reserved - YouTube
13:09
AWS Lambda Concurrency Explained - YouTube
02:14
Provisioned vs Reserved Concurrency - YouTube
08:23
How to achieve Concurrency Control in AWS Lambda - YouTube
16:11
65. Solving SQS and Lambda concurrency problems - YouTube
Amazon Web Services
docs.aws.amazon.com › aws lambda › developer guide › understanding lambda function scaling › configuring reserved concurrency for a function
Configuring reserved concurrency for a function - AWS Lambda
Reserved concurrency acts as both a lower and upper bound - it reserves the specified capacity exclusively for your function while also preventing it from scaling beyond that limit. Configuring reserved concurrency for a function incurs no additional charges. Provisioned concurrency – This is the number of pre-initialized execution environments allocated to your function...
Medium
aws.plainenglish.io › aws-lambda-reserved-vs-provisioned-concurrency-choosing-the-right-strategy-676294bc7e74
AWS Lambda Reserved vs. Provisioned Concurrency: Choosing the Right Strategy | by Ekant Mate (AWS APN Ambassador) | AWS in Plain English
January 15, 2024 - AWS Lambda, Amazon Web Services’ serverless compute service, is a popular choice for running code without the need to manage servers. However, when it comes to managing the performance of your Lambda functions, you have two essential options: Reserved Concurrency and Provisioned Concurrency.
Amazon Web Services
docs.aws.amazon.com › aws lambda › developer guide › understanding lambda function scaling › configuring provisioned concurrency for a function
Configuring provisioned concurrency for a function - AWS Lambda
The maximum provisioned concurrency you can assign to a specific function version is the function's reserved concurrency minus the provisioned concurrency on other function versions. To configure provisioned concurrency with the Lambda API, use the following API operations.
Reddit
reddit.com › r/awscertifications › having trouble with the difference between reserved and provisioned concurrency
r/AWSCertifications on Reddit: Having trouble with the difference between reserved and provisioned concurrency
November 14, 2020 -
If someone could describe it in a different way it would be helpful!
Top answer 1 of 4
13
Imagine you are going to rent 5 cars and they have 1000 cars and a delivery time of around 30 min Reserved concurrency means that even if 1000 people shows to rent a car, the rental will only be able to rent 995 because you reserved the other 5, however, you will have to wait the usual 30 minutes to get a car the moment you want it. A Provisioned concurrency of 1 means that in addition to have 5 cars reserved for yourself, the car rental hired someone to follow you around in one car like a creep all the time, so whenever you want to rent a car, you just hop in and skip the 30 minute wait time
2 of 4
4
Have you read this? aws I think this explains it but curious if you’ve read it or not and still have questions.
Top answer 1 of 6
1
To summarise:
- It's correct that you can't have provisioned concurrency for $LATEST.
- You need to publish new versions after each update.
- You can create an alias, which you need to update to refer to the newest published version each time.
- The alias can have provisioned concurrency.
- In API Gateway, you can paste the ARN of the alias in the integration target. (You may also be able to type lambda-name:alias, but I've not tried that.)
Thanks for the comments everyone.
2 of 6
1
Thanks for the answers everyone.
I've just noticed that in the "create alias" form, I appear to be able to create an alias that refers to $LATEST. If I do this, will I be able to configure provisioned concurrency for that alias? Will it continue to refer to the new $LATEST when I upload a new version?
Amazon Web Services
docs.aws.amazon.com › aws lambda › developer guide › understanding lambda function scaling
Understanding Lambda function scaling - AWS Lambda
You use reserved concurrency to define the maximum number of execution environments reserved for a Lambda function. However, none of these environments come pre-initialized. As a result, your function invocations may take longer because Lambda must first initialize the new environment before ...
HubPages
discover.hubpages.com › technology › reserved-concurrency-versus-provisioned-concurrency-aws-lambda
AWS Lambda Reserved Concurrency Versus Provisioned Concurrency - HubPages
March 29, 2024 - You can reserve concurrency for AWS Lambda functions ... To better understand provisioned concurrency, think of operating a restaurant that offers food delivery. Each afternoon between 2 pm and 4 pm is a slow period for your business. You only get a few orders per month between these hours, so you don't schedule any delivery people.
Dashbird
dashbird.io › home › knowledge base › aws lambda › provisioned concurrency
AWS Lambda Provisioned Concurrency | Dashbird
June 29, 2021 - With this example, we can see that using provisioned concurrency can greatly increase the costs of running serverless workloads on AWS Lambda. In light of that, developers should plan and anticipate costs carefully before using it. The Provisioned Concurrency level counts to the function’s Reserved Concurrency4 limit and also to the account regional limits5.
Stack Overflow
stackoverflow.com › beta › discussions › 78231813 › difference-between-aws-lambda-reserved-and-unreserved-concurrency
Difference between AWS Lambda Reserved and Unreserved Concurrency - Stack Overflow
March 27, 2024 - When you apply a provisioned concurrency of 10 to a lambda function it keeps 10 lambda runtimes always prepared which will process your request. This would incur extra charge as you have 10 idle lambda environments always running.