I have a lambda function that will be called infrequently in Production, but it will be public-facing, so I want to avoid cold-starts. So I thought I could use provisioned concurrency to avoid this issue. My Cloudformation template looks as follows:
QuoteLinkServiceFunction:
Type: AWS::Serverless::Function
Properties:
# other lambda properties...
ProvisionedConcurrencyConfig:
ProvisionedConcurrentExecutions: 1
When I create this stack in my Test environment though (where I am the only user, and so there are no other calls happening concurrently), I still experience cold starts when returning to use this function after a few hours. Subsequent calls immediately after the first call run faster as the lambda is now warmed up.
The lambda console shows that the alias for this function has actually been set up with a provisioned concurrency of 1, and I have verified the ALB target group is pointed at the alias. So why am I still getting cold starts?
REPORT RequestId: 3c0d1c43-4dc3-4059-9e51-203ed4387756 Duration: 492.12 ms Billed Duration: 493 ms Memory Size: 256 MB Max Memory Used: 101 MBInit Duration: 4831.59 ms. Other calls don't have Init Duration. Because of the provisioned concurrency I should never see Init Duration in cloudwatch. Any ideas? Do you have Init Duration in cloudwatch? - Rafi