Should you use container-based Lambdas_.pptx

SamuelDurand4 13 views 12 slides Jun 07, 2024
Slide 1
Slide 1 of 12
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12

About This Presentation

This presentation delves into the benefits and constraints of opting for Docker containers over traditional packaging when deploying Lambda code. Exploring runtime options, custom binaries, and performance implications, participants will grasp the various factors to weigh before embracing this deplo...


Slide Content

C ontainer-based Lambdas Weighing the Pros and Cons of containers in Lambda deployments

Agenda ‹#› Traditional deployment Limitations Container-based deployment Benefits Downsides Other alternatives | Samuel Durand - Should you use container-based Lambda functions? Use Cases (-> Gen AI 😄 )

Traditional Packaging ‹#› Zip the code Deploy via Sam, CDK, … Run it with AWS Lambda on Firecraker MicroVMs Advantages: low management overhead full features of Lambda layers and extensions

Traditional Downsides ‹#› Limited runtimes available NodeJS, Python, Java, .NET, Ruby, Go (kinda) Only specific versions available Upgrading too late can result in CF deadlock on deployment No control on MicroVM content -> legal concerns Limited package and dependencies size -> especially for ML / Generative AI 50 Mb for the package with layers 250Mb when decompressed for the Lambda + Layers

Container-based deployment ‹#› Package the code Choose a base image with runtimes included with Lambda components only any compatible docker image Write a Dockerfile Build & push to ECR Deploy the code to Lambda

Benefits ‹#› Flexibility : any runtime or binaries, and most OS Size: 10Gb size limit on package, dependencies or dataset Full control: full content known Performance : cold starts can be faster for NodeJS and Python depending on function size

Downsides ‹#› Operational overhead: build and maintenance more complex Lambda layers: deployment required for all version changes Cold start: larger size means slower cold start (Knowledge: build and optimize Docker images)

Alternatives ‹#› Runtime unavailable: use a Runtime Lambda layer Custom binaries: use a Lambda layer Large dataset: use EFS Larger than 50Mb: if code size is <250Mb, use S3

Use Cases ‹#› Traditional Container-based Rest APIs Event-driven Data transformation Small functions Most use cases ML & Gen AI Old / unsupported runtimes Whole application Lambda Customized environment for high performance | Samuel Durand - Should you use container-based Lambda functions? © kreuzwerker 2024

‹#› Questions? Samuel Durand @Github / @Linkedin

Links ‹#› My own XW article Benchmarks performed by Aaron Stuyvenberg AWS Blog post about Lambda container limitations AWS Blog post on how to optimize Lambda containers