Lambda cold start possible solution?

前端 未结 6 1882
青春惊慌失措
青春惊慌失措 2021-01-03 23:42

Is scheduling a lambda function to get called every 20 mins with CloudWatch the best way to get rid of lambda cold start times? (not completely get rid of)...

Will

6条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-04 00:29

    Starting from December 2019 AWS Lambda supports Reserved Concurrency (so you can set the number of lambda functions that will be ready and waiting for new calls) [1]

    The downside of this, is that you will be charged for the reserved concurrency. If you provision a concurrency of 1, for a lambda with 128MB being active 24 hrs for the whole month, you will be charged: 1 instance x 30 days x 24 hr x 60min x 60sec x (128/1024) = 324,000 GB-sec (almost all of the capacity AWS gives for the lambda free tier) [2]

    From above you will get a lambda instance that responds very fast...subsequent concurrent calls may still suffer "cold-start" though.

    What is more, you can configure application autoscaling to dynamically manage the provisioned concurrency of your lambda. [3]

    Refs:

    1. https://aws.amazon.com/blogs/aws/new-provisioned-concurrency-for-lambda-functions/
    2. https://aws.amazon.com/lambda/pricing/
    3. https://docs.aws.amazon.com/lambda/latest/dg/configuration-concurrency.html

提交回复
热议问题