Better, Faster and Cheaper with AWS Lambda's new Python 3.11 runtime

· 1 min read
Better, Faster and Cheaper with AWS Lambda's new Python 3.11 runtime

If you are still running your AWS Lambda workloads on Python 3.10 or earlier versions, migrate to Python 3.11 for better performance and lower cost.

AWS Lambda has added support for Python 3.11.

On an average, Python 3.11 is 25% faster than 3.10
Faster Startup and Faster Runtime are the two main focus areas for Python 3.11.

That means,

  • Performance improvement for both cold start requests and warm start requests.
  • Faster lambda execution reduces cost as Lambda bills per millisecond.

Better, faster and cheaper - all at the same time.

Python 3.11 Release highlights
Python 3.11 is between 10-60% faster than Python 3.10. On average, we measured a 1.25x speedup on the standard benchmark suite.
:
This project focuses on two major areas in Python: Faster Startup and Faster Runtime. Optimizations not covered by this project are listed separately under Optimizations.

-- What’s New In Python 3.11

Next course of action:

  • Start using Python 3.11 runtime for new Lambda functions.
  • Migrate existing Lambda functions to Python 3.11 runtime

Set/update Python 3.11 runtime in SAM & CloudFormation template or AWS CDK. For the AWS Lambda container image, use the Python 3.11 base image (public.ecr.aws/lambda/python:3.11).

If you use the AWS Lambda console, set or edit the runtime to use Python 3.11.

References