SlideShare a Scribd company logo
1 of 20
Accelerating Serverless Performance with
AWS Lambda SnapStart
Wellington AWS User Group - April 2023
Geethika Guruge
Lead Consultant @ Mantel
APN Ambassador | AWS Community Builder
850+ team members
Offices across Australia and New Zealand
Voted Best Place to Work in 2021 and 2022
Operating at over 150 clients
Changing how the world works for the better.
Agenda
● A trip down the memory lane
● Anatomy of AWS Lambda
● Lambda Execution Lifecycle
● Let's Talk about Java
● Writing Lambdas in Java - is it as crazy as it sounds
● Lambda Snapstart
● Snapstart Pitfalls
● A bonus feature!!!!
● Demo
Changing how the world works for the better.
How Did We End Up Here
Changing how the world works for the better.
Anatomy of AWS Lambda
● The invocation request is passed by Load Balancer to a selected Frontend Invoker
● Frontend Invoker checks the request, and asks the Worker Manager for a sandboxed
function that will handle the invocation.
● Worker Manager either finds a proper Worker and a sandbox, or creates one.
● Once it's ready, the code is executed by a Worker
Changing how the world works for the better.
Anatomy of AWS Lambda
● Firecracker is an open source project that allows AWS to span hundreds and thousands
lightweight sandboxes on a single Worker.
Changing how the world works for the better.
Anatomy of AWS Lambda
● Note that we have the handler function and some code outside of it
Changing how the world works for the better.
Lambda Execution Environment Lifecycle (ColdStart)
● The code outside the handler function (init) is executed only during the cold start
Changing how the world works for the better.
Lambda Execution Environment Lifecycle (WarmStart)
Changing how the world works for the better.
When Would a Cold Strat Occur
● The first execution
● After 5-7 mins since last execution
● When lambda is horizontally scaling
Changing how the world works for the better.
Changing how the world works for the better.
The Problems Features of Java
● It's a Compiled language
● Uses JIT compiler at runtime.
○ Initial compilation is minimal.
○ Compiles additional classes on-demand.
● Allows use of reflection.
○ JVM cannot optimize the code on compilation time
● Slower on first run.
● Faster on subsequent runs.
Changing how the world works for the better.
So Why Do People Still Use Java
● Been there since 1990s
● Lots of small & big enterprises leverage Java
● Its way too complicated to rewrite decades old Applications
● Existing Team skill set
● Has a still growing community
Changing how the world works for the better.
So Why Would You Use Java in Lambdas
● No-one writes Java anymore - Well not really…..
○ There are probably between 5 and 10 million Java developers in the world,
& Java is still in the top 5 most-frequently-used programming languages
○ AWS themselves are huge users of Java
● Java is far too verbose for small Lambda functions
○ You can do a lot in 15 minutes with 6 CPU cores and 10GB memory.
● Cold Starts are terrible
○ That's why we’re here…..
Changing how the world works for the better.
When To Use Java in Lambdas
● When a team is already writing Java
● When throughput performance is important
● When writing applications and not “glue” scripts
Changing how the world works for the better.
Changing how the world works for the better.
Lambda Execution Environment Lifecycle (SnapStart)
Changing how the world works for the better.
Things to Consider….Pitfalls to Avoid
● Uniqueness
○ Random number generation (i.e DB keys, correlation IDs,
Cryptography)
○ Some commonly used libraries are “snap safe”
■ java.security.SecureRandom
■ Amazon Linux’s /dev/random and /dev/urandom
● Network Connections
○ Write resilient code to re-establish connections if necessary
● Ephemeral Data
○ Externally loaded data, may need to be refreshed.
Changing how the world works for the better.
Hang on….There's more
Lambda SnapStart - wellington meetup Apr-2024.pptx

More Related Content

Similar to Lambda SnapStart - wellington meetup Apr-2024.pptx

kranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High loadkranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High loadKrivoy Rog IT Community
 
Serverless for High Performance Computing
Serverless for High Performance ComputingServerless for High Performance Computing
Serverless for High Performance ComputingLuciano Mammino
 
Kotlin REST & GraphQL API
Kotlin REST & GraphQL APIKotlin REST & GraphQL API
Kotlin REST & GraphQL APISean O'Brien
 
Gearman: A Job Server made for Scale
Gearman: A Job Server made for ScaleGearman: A Job Server made for Scale
Gearman: A Job Server made for ScaleMike Willbanks
 
Rust kafka-5-2019-unskip
Rust kafka-5-2019-unskipRust kafka-5-2019-unskip
Rust kafka-5-2019-unskipGerard Klijs
 
Skillenza Build with Serverless Challenge - Advanced Serverless Concepts
Skillenza Build with Serverless Challenge -  Advanced Serverless ConceptsSkillenza Build with Serverless Challenge -  Advanced Serverless Concepts
Skillenza Build with Serverless Challenge - Advanced Serverless ConceptsDhaval Nagar
 
Ratpack the story so far
Ratpack the story so farRatpack the story so far
Ratpack the story so farPhill Barber
 
AWS Lambdas are cool - Cheminfo Stories Day 1
AWS Lambdas are cool - Cheminfo Stories Day 1AWS Lambdas are cool - Cheminfo Stories Day 1
AWS Lambdas are cool - Cheminfo Stories Day 1ChemAxon
 
Kubernetes Native Java and Eclipse MicroProfile | EclipseCon Europe 2019
Kubernetes Native Java and Eclipse MicroProfile | EclipseCon Europe 2019Kubernetes Native Java and Eclipse MicroProfile | EclipseCon Europe 2019
Kubernetes Native Java and Eclipse MicroProfile | EclipseCon Europe 2019Jakarta_EE
 
Kubernetes Native Java and Eclipse MicroProfile | EclipseCon Europe 2019
Kubernetes Native Java and Eclipse MicroProfile | EclipseCon Europe 2019Kubernetes Native Java and Eclipse MicroProfile | EclipseCon Europe 2019
Kubernetes Native Java and Eclipse MicroProfile | EclipseCon Europe 2019The Eclipse Foundation
 
Serverless design considerations for Cloud Native workloads
Serverless design considerations for Cloud Native workloadsServerless design considerations for Cloud Native workloads
Serverless design considerations for Cloud Native workloadsTensult
 
Serverless in java Lessons learnt
Serverless in java Lessons learntServerless in java Lessons learnt
Serverless in java Lessons learntKrzysztof Pawlowski
 
Introduction to Micronaut - JBCNConf 2019
Introduction to Micronaut - JBCNConf 2019Introduction to Micronaut - JBCNConf 2019
Introduction to Micronaut - JBCNConf 2019graemerocher
 
Introduction to AWS Big Data
Introduction to AWS Big Data Introduction to AWS Big Data
Introduction to AWS Big Data Omid Vahdaty
 
Scala like distributed collections - dumping time-series data with apache spark
Scala like distributed collections - dumping time-series data with apache sparkScala like distributed collections - dumping time-series data with apache spark
Scala like distributed collections - dumping time-series data with apache sparkDemi Ben-Ari
 
The Rise of Functional Programming
The Rise of Functional ProgrammingThe Rise of Functional Programming
The Rise of Functional ProgrammingTjerk Wolterink
 
Writing and deploying serverless python applications
Writing and deploying serverless python applicationsWriting and deploying serverless python applications
Writing and deploying serverless python applicationsCesar Cardenas Desales
 

Similar to Lambda SnapStart - wellington meetup Apr-2024.pptx (20)

kranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High loadkranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High load
 
Netty training
Netty trainingNetty training
Netty training
 
Serverless for High Performance Computing
Serverless for High Performance ComputingServerless for High Performance Computing
Serverless for High Performance Computing
 
Kotlin REST & GraphQL API
Kotlin REST & GraphQL APIKotlin REST & GraphQL API
Kotlin REST & GraphQL API
 
Gearman: A Job Server made for Scale
Gearman: A Job Server made for ScaleGearman: A Job Server made for Scale
Gearman: A Job Server made for Scale
 
Rust kafka-5-2019-unskip
Rust kafka-5-2019-unskipRust kafka-5-2019-unskip
Rust kafka-5-2019-unskip
 
Skillenza Build with Serverless Challenge - Advanced Serverless Concepts
Skillenza Build with Serverless Challenge -  Advanced Serverless ConceptsSkillenza Build with Serverless Challenge -  Advanced Serverless Concepts
Skillenza Build with Serverless Challenge - Advanced Serverless Concepts
 
Java vs. C/C++
Java vs. C/C++Java vs. C/C++
Java vs. C/C++
 
Ratpack the story so far
Ratpack the story so farRatpack the story so far
Ratpack the story so far
 
AWS Lambdas are cool - Cheminfo Stories Day 1
AWS Lambdas are cool - Cheminfo Stories Day 1AWS Lambdas are cool - Cheminfo Stories Day 1
AWS Lambdas are cool - Cheminfo Stories Day 1
 
Kubernetes Native Java and Eclipse MicroProfile | EclipseCon Europe 2019
Kubernetes Native Java and Eclipse MicroProfile | EclipseCon Europe 2019Kubernetes Native Java and Eclipse MicroProfile | EclipseCon Europe 2019
Kubernetes Native Java and Eclipse MicroProfile | EclipseCon Europe 2019
 
Kubernetes Native Java and Eclipse MicroProfile | EclipseCon Europe 2019
Kubernetes Native Java and Eclipse MicroProfile | EclipseCon Europe 2019Kubernetes Native Java and Eclipse MicroProfile | EclipseCon Europe 2019
Kubernetes Native Java and Eclipse MicroProfile | EclipseCon Europe 2019
 
Serverless design considerations for Cloud Native workloads
Serverless design considerations for Cloud Native workloadsServerless design considerations for Cloud Native workloads
Serverless design considerations for Cloud Native workloads
 
Serverless in java Lessons learnt
Serverless in java Lessons learntServerless in java Lessons learnt
Serverless in java Lessons learnt
 
Introduction to Micronaut - JBCNConf 2019
Introduction to Micronaut - JBCNConf 2019Introduction to Micronaut - JBCNConf 2019
Introduction to Micronaut - JBCNConf 2019
 
Introduction to AWS Big Data
Introduction to AWS Big Data Introduction to AWS Big Data
Introduction to AWS Big Data
 
Scala like distributed collections - dumping time-series data with apache spark
Scala like distributed collections - dumping time-series data with apache sparkScala like distributed collections - dumping time-series data with apache spark
Scala like distributed collections - dumping time-series data with apache spark
 
[AWS Builders] Effective AWS Glue
[AWS Builders] Effective AWS Glue[AWS Builders] Effective AWS Glue
[AWS Builders] Effective AWS Glue
 
The Rise of Functional Programming
The Rise of Functional ProgrammingThe Rise of Functional Programming
The Rise of Functional Programming
 
Writing and deploying serverless python applications
Writing and deploying serverless python applicationsWriting and deploying serverless python applications
Writing and deploying serverless python applications
 

More from ssuserd4e0d2

LX-COMM-XX-Streamlined-deployment to Amazon EKS (1).pptx
LX-COMM-XX-Streamlined-deployment to Amazon EKS (1).pptxLX-COMM-XX-Streamlined-deployment to Amazon EKS (1).pptx
LX-COMM-XX-Streamlined-deployment to Amazon EKS (1).pptxssuserd4e0d2
 
Bootstrapping Clusters with EKS Blueprints.pptx
Bootstrapping Clusters with EKS Blueprints.pptxBootstrapping Clusters with EKS Blueprints.pptx
Bootstrapping Clusters with EKS Blueprints.pptxssuserd4e0d2
 
CommunityDay_Aotearoa_Geethika.pptx
CommunityDay_Aotearoa_Geethika.pptxCommunityDay_Aotearoa_Geethika.pptx
CommunityDay_Aotearoa_Geethika.pptxssuserd4e0d2
 
serverless_meetup_Jan_2023_v1.0.pptx
serverless_meetup_Jan_2023_v1.0.pptxserverless_meetup_Jan_2023_v1.0.pptx
serverless_meetup_Jan_2023_v1.0.pptxssuserd4e0d2
 
akl-reInvent-recap-2022.pptx
akl-reInvent-recap-2022.pptxakl-reInvent-recap-2022.pptx
akl-reInvent-recap-2022.pptxssuserd4e0d2
 
aws_com_day_2022_Geethika_v1.0.pptx
aws_com_day_2022_Geethika_v1.0.pptxaws_com_day_2022_Geethika_v1.0.pptx
aws_com_day_2022_Geethika_v1.0.pptxssuserd4e0d2
 
Architecting for Sustainability - Community Summit v1.0.pptx
Architecting for Sustainability - Community Summit v1.0.pptxArchitecting for Sustainability - Community Summit v1.0.pptx
Architecting for Sustainability - Community Summit v1.0.pptxssuserd4e0d2
 
reInventReCap.pptx
reInventReCap.pptxreInventReCap.pptx
reInventReCap.pptxssuserd4e0d2
 
Bootstrapping Clusters with EKS Blueprints.pptx
Bootstrapping Clusters with EKS Blueprints.pptxBootstrapping Clusters with EKS Blueprints.pptx
Bootstrapping Clusters with EKS Blueprints.pptxssuserd4e0d2
 
Architecting for Sustainability
Architecting for SustainabilityArchitecting for Sustainability
Architecting for Sustainabilityssuserd4e0d2
 

More from ssuserd4e0d2 (10)

LX-COMM-XX-Streamlined-deployment to Amazon EKS (1).pptx
LX-COMM-XX-Streamlined-deployment to Amazon EKS (1).pptxLX-COMM-XX-Streamlined-deployment to Amazon EKS (1).pptx
LX-COMM-XX-Streamlined-deployment to Amazon EKS (1).pptx
 
Bootstrapping Clusters with EKS Blueprints.pptx
Bootstrapping Clusters with EKS Blueprints.pptxBootstrapping Clusters with EKS Blueprints.pptx
Bootstrapping Clusters with EKS Blueprints.pptx
 
CommunityDay_Aotearoa_Geethika.pptx
CommunityDay_Aotearoa_Geethika.pptxCommunityDay_Aotearoa_Geethika.pptx
CommunityDay_Aotearoa_Geethika.pptx
 
serverless_meetup_Jan_2023_v1.0.pptx
serverless_meetup_Jan_2023_v1.0.pptxserverless_meetup_Jan_2023_v1.0.pptx
serverless_meetup_Jan_2023_v1.0.pptx
 
akl-reInvent-recap-2022.pptx
akl-reInvent-recap-2022.pptxakl-reInvent-recap-2022.pptx
akl-reInvent-recap-2022.pptx
 
aws_com_day_2022_Geethika_v1.0.pptx
aws_com_day_2022_Geethika_v1.0.pptxaws_com_day_2022_Geethika_v1.0.pptx
aws_com_day_2022_Geethika_v1.0.pptx
 
Architecting for Sustainability - Community Summit v1.0.pptx
Architecting for Sustainability - Community Summit v1.0.pptxArchitecting for Sustainability - Community Summit v1.0.pptx
Architecting for Sustainability - Community Summit v1.0.pptx
 
reInventReCap.pptx
reInventReCap.pptxreInventReCap.pptx
reInventReCap.pptx
 
Bootstrapping Clusters with EKS Blueprints.pptx
Bootstrapping Clusters with EKS Blueprints.pptxBootstrapping Clusters with EKS Blueprints.pptx
Bootstrapping Clusters with EKS Blueprints.pptx
 
Architecting for Sustainability
Architecting for SustainabilityArchitecting for Sustainability
Architecting for Sustainability
 

Recently uploaded

Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 

Recently uploaded (20)

Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 

Lambda SnapStart - wellington meetup Apr-2024.pptx

  • 1. Accelerating Serverless Performance with AWS Lambda SnapStart Wellington AWS User Group - April 2023 Geethika Guruge Lead Consultant @ Mantel APN Ambassador | AWS Community Builder
  • 2. 850+ team members Offices across Australia and New Zealand Voted Best Place to Work in 2021 and 2022 Operating at over 150 clients
  • 3. Changing how the world works for the better. Agenda ● A trip down the memory lane ● Anatomy of AWS Lambda ● Lambda Execution Lifecycle ● Let's Talk about Java ● Writing Lambdas in Java - is it as crazy as it sounds ● Lambda Snapstart ● Snapstart Pitfalls ● A bonus feature!!!! ● Demo
  • 4. Changing how the world works for the better. How Did We End Up Here
  • 5. Changing how the world works for the better. Anatomy of AWS Lambda ● The invocation request is passed by Load Balancer to a selected Frontend Invoker ● Frontend Invoker checks the request, and asks the Worker Manager for a sandboxed function that will handle the invocation. ● Worker Manager either finds a proper Worker and a sandbox, or creates one. ● Once it's ready, the code is executed by a Worker
  • 6. Changing how the world works for the better. Anatomy of AWS Lambda ● Firecracker is an open source project that allows AWS to span hundreds and thousands lightweight sandboxes on a single Worker.
  • 7. Changing how the world works for the better. Anatomy of AWS Lambda ● Note that we have the handler function and some code outside of it
  • 8. Changing how the world works for the better. Lambda Execution Environment Lifecycle (ColdStart) ● The code outside the handler function (init) is executed only during the cold start
  • 9. Changing how the world works for the better. Lambda Execution Environment Lifecycle (WarmStart)
  • 10. Changing how the world works for the better. When Would a Cold Strat Occur ● The first execution ● After 5-7 mins since last execution ● When lambda is horizontally scaling
  • 11. Changing how the world works for the better.
  • 12. Changing how the world works for the better. The Problems Features of Java ● It's a Compiled language ● Uses JIT compiler at runtime. ○ Initial compilation is minimal. ○ Compiles additional classes on-demand. ● Allows use of reflection. ○ JVM cannot optimize the code on compilation time ● Slower on first run. ● Faster on subsequent runs.
  • 13. Changing how the world works for the better. So Why Do People Still Use Java ● Been there since 1990s ● Lots of small & big enterprises leverage Java ● Its way too complicated to rewrite decades old Applications ● Existing Team skill set ● Has a still growing community
  • 14. Changing how the world works for the better. So Why Would You Use Java in Lambdas ● No-one writes Java anymore - Well not really….. ○ There are probably between 5 and 10 million Java developers in the world, & Java is still in the top 5 most-frequently-used programming languages ○ AWS themselves are huge users of Java ● Java is far too verbose for small Lambda functions ○ You can do a lot in 15 minutes with 6 CPU cores and 10GB memory. ● Cold Starts are terrible ○ That's why we’re here…..
  • 15. Changing how the world works for the better. When To Use Java in Lambdas ● When a team is already writing Java ● When throughput performance is important ● When writing applications and not “glue” scripts
  • 16. Changing how the world works for the better.
  • 17. Changing how the world works for the better. Lambda Execution Environment Lifecycle (SnapStart)
  • 18. Changing how the world works for the better. Things to Consider….Pitfalls to Avoid ● Uniqueness ○ Random number generation (i.e DB keys, correlation IDs, Cryptography) ○ Some commonly used libraries are “snap safe” ■ java.security.SecureRandom ■ Amazon Linux’s /dev/random and /dev/urandom ● Network Connections ○ Write resilient code to re-establish connections if necessary ● Ephemeral Data ○ Externally loaded data, may need to be refreshed.
  • 19. Changing how the world works for the better. Hang on….There's more