Daily Shaarli

All links of one day in a single page.

June 6, 2023

Lambda Cold Starts and Bootstrap Code

tl;dr:

  • AWS Lambda execution environment is a micro virtual machine (or microVM) based on Firecracker
  • the init code will execute faster than your handler code
  • at 3008 MB [...] the Lambda function handler gets two unthrottled vCPUs
  • Conclusion: by following best practices and moving as much code as possible to the Lambda's bootstrap, these functions will run more efficiently (and thus cheaper) in two ways:
    1. The bootstrap code will only execute once per (hopefully) many Lambda invocations.
    2. When the bootstrap code gets executed, it will run faster than it would in the handler (for Lambda memory configurations up to 3 GB).