There have been plenty of articles written on the ways to optimize your AWS Lambda functions to run quicker and to avoid the dreaded “cold boot” scenario. This is despite the fact that it was reported by Amazon tech advocates that an extreme minority of function invocations are actually cold booted (approximately 0.2%). That said, there are a number of scenarios I’ve encountered where you’re definitely going to hit a lot of cold boots and it’d really be better to avoid them:
With these fairly lightweight scenarios in mind, let’s dive into a simple, straightforward approach to warming your Lambdas.
Simply stated, a “cold boot” is the slow first time startup of a Lambda function.
After the function initially “boots”, it is available on a much faster basis until the Lambda goes unused for an extended period of time (or the data center is struck by an asteroid). After this extended period of time (or unfortunate wrath of the heavenly bodies), the Lambda function is destroyed so the whole cold boot process has to start up again.
#aws-lambda #python #serverless #cloudwatch