How to solve cold start in AWS Lambda function
People alway rave about how good serverless is but avoid a key problem which is the cold start.
Cold Start occurs when aws lambda function has not been invoked for about 10 minutes. As a result, it needs a few hundred milliseconds to come online.
This can really affect performance.
To resolve this there are 2 solutions:
-
Have a cloudwatch rule that hits your lambda every 10 minutes.
This way it will be active no matter what. This can incur some cost. -
Have all your api run through your lambda(something like graphql) so your lambda is always warm.
If you want to talk more about this, you can book a time with me at http://manaknightdigital.com/codementor.html