Serverless at Lifestage

BATbern
BATbernBATbern
Serverless at
Lifestage
What is serverless and how we use it
at Lifestage. The good parts and the
challenges we faced over the past
years.
About me
• CTO at Lifestage Solutions AG since 2016
• Between 2000 and 2010 I’ve been working
primarily for enterprise clients on on-premise
Oracle DB and AS with Java / PL/SQL / C.
• Since 2010 mostly for startups on AWS cloud
with Node.js / C++ / Lambda and DynamoDB.
Our
Application
• We sell care material for the elderly to Spitex and
elderly homes (APH). And we help them charging this
material to insurances and patients.
• You can think about us as a small Amazon for nurses
• Among other things we handle material ordering /
pick&pack / billing / automatic inventory management
and warm food delivery
• We are live since 2016 and constantly adding features.
• We serve >200 organizations in 3 languages across
Switzerland.
• We have ~2.5k digital scales deployed across
Switzerland to track product usage
Agenda
• What is “serverless”?
• Why we choose it?
• What we enjoyed AND struggled with
• An example: our application and the
components we use to run it
• Q&A
“serverless”?!
Traditional 3-tier architecture (servers) Serverless architecture (services)
What is “serverless”?
• Managed infrastructure for compute AND
persistence (operated by your cloud vendor e.g.
DDoS mitigation, OS/AS/DB updates)
• Scalable and highly available by design (serverless
functions and persistence runs on different AZ
active-active)
• Billing model: pay only for the resources you
actually use (by execution duration or IO
operations)
• Tradeoff: scalable simple interface implies some
compexity is moved back into the application code
(e.g. state management). No lift and shift.
Why we choose it?
• Move fast / break things: focus on
business logic, on customers, on
everchanging regulations instead of
babysitting systems
• Billing model: pay only for the resources
you actually use / have the cost scale
with revenue
Serverless at Lifestage
Serverless at Lifestage
The
good
Resilient: if a request crashes a VM all the other requests are running on
different containers / VMs, so are completely unaffected. Also memory
leaks are less of a problem.
Flexible: custom runtimes depending on feature JS/C++/Python/memory
size/wrap cli. Easy to add features without touching the running parts.
Low cost: when implemented efficiently if no user is active there is no
running cost as compute time is billed on milliseconds of use * GB of
memory used. (our ratio: revenue / 1000)
Scalable: new lambda instances are created as requests come in and kept
running for a while to serve new requests
highly avaialable: (API Gateway is automatically load balancing on Lambda
instances in different data centers typically 3 per region)
Low touch: No operational cost for servers. (no OS updates / AS updates /
downtime / hot deployment does not affect running requests)
Resilient
• Each request has its own
dedicated application server
instance
Felixible
• Add new API endpoints without
touching deployed ones
• Add new DB / Event subscribers
without affecting the running
ones
The
“bad”
Coordination: building complicated workflows without
lock-in on solutions like AWS Step Functions is tricky.
Also being aware of vendor lock-in while architecting is
crucial to use ONLY the relevant and reproducible
portion of the offered APIs.
https://serverlessworkflow.io/
Complexity: you are always facing a very constrained
execution environment (max execution time / max
memory / max input/output size / disk space / code size
/ stateless) and so you constantly need clever solutions
to work around this limitations to enjoy the benefits.
Cold starts: lambdas are on-demand containers that
need initialization, so if you need low latency, you
probably have to pay for provisioned concurrency.
The
“ugly”
VM updates: AWS discontinues obsolete
versions of VMs (Java/Node/Python etc) so if
your code relies on it, you have to upgrade it
and keep it fresh. Challenging at times with
native extensions (C++). Especially when you
have to review the impact on 100s of
microservices. Needs planning or can be
worked around with custom runtimes.
Local development
• We use 1 Docker container per mocked service / app,
recreating the same service topology as in AWS
• We mostly use AWS services (or portions of the API) that
we can easily mock locally.
• Although there are several offerings for local
development replacements, we end up writing our own.
Operations via
REPL
• Data import / export / plots
• Scripts
• Log investigation
• Manual Lambda execution
• Authorized granularly via IAM
Q & A
What about security?
• Shared responsibility model (infrastructure is kept secure and up to date
from the cloud provider, application developers need to be sure to
implement their code according to best practices e.g. OWASP)
• Lambdas are stateless and ephimeral created on invocation and get often
recycled. Based on Firecracker MicroVMs for isolation (KVM). Strict
runtime constraints (memory / cpu / disk space / execution roles).
• Data at rest and in transit is encrypted by default in most AWS services,
and can be configured to use client owned keys or service keys.
• CloudFront has built-in DDoS mitigation and API Gateway can be
granularly configured to throttle API calls blacklist IPs and validate request
content before the request is passed to any compute layer.
• Custom request authorizers (session token validation / signed requests
validators) are configurable both at the Edge (CDN nodes) and on API
Gateway.
• You can run some Lambdas in restricted VPCs with access to crafted
network resources and e.g. no internet access at all.
Examples of serverless offerings
Compute: AWS Lambda,
Google Cloud Functions,
MS Azure Functions
Database: AWS
DynamoDB, Google Cloud
Spanner, MS Cosmos DB
File storage: AWS S3,
Google Cloud Storage, MZ
Azure BLOB storage
Caching: MomentoHQ
Examples of NON-serverless offerings
Compute: AWS ECS, AWS
EC2, AWS Elastic Beanstalk,
Google AppEngine, Azure
App Service
Database: AWS RDS , Azure
for MYSQL/Postgre/..
File storage: AWS EFS
Caching: AWS Elasticache
(Redis), Google
Memorystore (Redis), Azure
Cache (Redis) , AWS DAX
Example cost structure (Lambda x86 vs ARM)
Cost grows with memory but so does VCPUs (1-6) so if your code can use parallelism it will run
faster AND cheaper on bigger Lambdas. Test test test.
Example cost structure (Dynamo)
RRU: 1 item read up to 4KB (2 if eventual consistent)
WRU: 1 item write up to 1KB
This is the case for each table AND index, although you can limit the size of each index entry by projecting only
A few attributes from the original item and save on both index reads and writes.
1 of 22

Recommended

Building Serverless Web Applications - DevDay Austin 2017 by
Building Serverless Web Applications - DevDay Austin 2017Building Serverless Web Applications - DevDay Austin 2017
Building Serverless Web Applications - DevDay Austin 2017Amazon Web Services
313 views47 slides
Building Serverless Web Applications - DevDay Los Angeles 2017 by
Building Serverless Web Applications - DevDay Los Angeles 2017Building Serverless Web Applications - DevDay Los Angeles 2017
Building Serverless Web Applications - DevDay Los Angeles 2017Amazon Web Services
349 views46 slides
Serverless design considerations for Cloud Native workloads by
Serverless design considerations for Cloud Native workloadsServerless design considerations for Cloud Native workloads
Serverless design considerations for Cloud Native workloadsTensult
92 views21 slides
Get the EDGE to scale: Using Cloudfront along with edge compute to scale your... by
Get the EDGE to scale: Using Cloudfront along with edge compute to scale your...Get the EDGE to scale: Using Cloudfront along with edge compute to scale your...
Get the EDGE to scale: Using Cloudfront along with edge compute to scale your...Amazon Web Services
609 views35 slides
Customer Sharing: Trend Micro - Analytic Engine - A common Big Data computati... by
Customer Sharing: Trend Micro - Analytic Engine - A common Big Data computati...Customer Sharing: Trend Micro - Analytic Engine - A common Big Data computati...
Customer Sharing: Trend Micro - Analytic Engine - A common Big Data computati...Amazon Web Services
680 views32 slides
analytic engine - a common big data computation service on the aws by
analytic engine - a common big data computation service on the awsanalytic engine - a common big data computation service on the aws
analytic engine - a common big data computation service on the awsScott Miao
697 views32 slides

More Related Content

Similar to Serverless at Lifestage

Serverlessusecase workshop feb3_v2 by
Serverlessusecase workshop feb3_v2Serverlessusecase workshop feb3_v2
Serverlessusecase workshop feb3_v2kartraj
152 views31 slides
AWS Cloud Kata | Manila - Getting to Scale on AWS by
AWS Cloud Kata | Manila - Getting to Scale on AWSAWS Cloud Kata | Manila - Getting to Scale on AWS
AWS Cloud Kata | Manila - Getting to Scale on AWSAmazon Web Services
2.2K views62 slides
使用 AWS 無伺服器運算服務打造您的第一個語音助理 by
使用 AWS 無伺服器運算服務打造您的第一個語音助理使用 AWS 無伺服器運算服務打造您的第一個語音助理
使用 AWS 無伺服器運算服務打造您的第一個語音助理Amazon Web Services
1.7K views48 slides
AWS FSI Symposium 2017 NYC - Moving at the Speed of Serverless ft Broadridge by
AWS FSI Symposium 2017 NYC - Moving at the Speed of Serverless ft BroadridgeAWS FSI Symposium 2017 NYC - Moving at the Speed of Serverless ft Broadridge
AWS FSI Symposium 2017 NYC - Moving at the Speed of Serverless ft BroadridgeAmazon Web Services
628 views26 slides
Managing Your Cloud Assets by
Managing Your Cloud AssetsManaging Your Cloud Assets
Managing Your Cloud AssetsAmazon Web Services
1.4K views45 slides
ENT305 Migrating Your Databases to AWS: Deep Dive on Amazon Relational Databa... by
ENT305 Migrating Your Databases to AWS: Deep Dive on Amazon Relational Databa...ENT305 Migrating Your Databases to AWS: Deep Dive on Amazon Relational Databa...
ENT305 Migrating Your Databases to AWS: Deep Dive on Amazon Relational Databa...Amazon Web Services
574 views35 slides

Similar to Serverless at Lifestage(20)

Serverlessusecase workshop feb3_v2 by kartraj
Serverlessusecase workshop feb3_v2Serverlessusecase workshop feb3_v2
Serverlessusecase workshop feb3_v2
kartraj152 views
AWS Cloud Kata | Manila - Getting to Scale on AWS by Amazon Web Services
AWS Cloud Kata | Manila - Getting to Scale on AWSAWS Cloud Kata | Manila - Getting to Scale on AWS
AWS Cloud Kata | Manila - Getting to Scale on AWS
Amazon Web Services2.2K views
使用 AWS 無伺服器運算服務打造您的第一個語音助理 by Amazon Web Services
使用 AWS 無伺服器運算服務打造您的第一個語音助理使用 AWS 無伺服器運算服務打造您的第一個語音助理
使用 AWS 無伺服器運算服務打造您的第一個語音助理
Amazon Web Services1.7K views
AWS FSI Symposium 2017 NYC - Moving at the Speed of Serverless ft Broadridge by Amazon Web Services
AWS FSI Symposium 2017 NYC - Moving at the Speed of Serverless ft BroadridgeAWS FSI Symposium 2017 NYC - Moving at the Speed of Serverless ft Broadridge
AWS FSI Symposium 2017 NYC - Moving at the Speed of Serverless ft Broadridge
ENT305 Migrating Your Databases to AWS: Deep Dive on Amazon Relational Databa... by Amazon Web Services
ENT305 Migrating Your Databases to AWS: Deep Dive on Amazon Relational Databa...ENT305 Migrating Your Databases to AWS: Deep Dive on Amazon Relational Databa...
ENT305 Migrating Your Databases to AWS: Deep Dive on Amazon Relational Databa...
AWS Serverless Community Day Keynote and Vendia Launch 6-26-2020 by Tim Wagner
AWS Serverless Community Day Keynote and Vendia Launch 6-26-2020AWS Serverless Community Day Keynote and Vendia Launch 6-26-2020
AWS Serverless Community Day Keynote and Vendia Launch 6-26-2020
Tim Wagner1.8K views
Aws re invent 2018 recap by CloudHesive
Aws re invent 2018 recapAws re invent 2018 recap
Aws re invent 2018 recap
CloudHesive390 views
Getting Started with AWS Lambda and the Serverless Cloud - AWS Summit Cape T... by Amazon Web Services
 Getting Started with AWS Lambda and the Serverless Cloud - AWS Summit Cape T... Getting Started with AWS Lambda and the Serverless Cloud - AWS Summit Cape T...
Getting Started with AWS Lambda and the Serverless Cloud - AWS Summit Cape T...
Amazon Web Services1.2K views
Getting Started with AWS Lambda and the Serverless Cloud by Amazon Web Services
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless Cloud
Amazon Web Services1.1K views
AWS Summit Benelux 2013 - Media and Online Advertising on AWS by Amazon Web Services
AWS Summit Benelux 2013 - Media and Online Advertising on AWSAWS Summit Benelux 2013 - Media and Online Advertising on AWS
AWS Summit Benelux 2013 - Media and Online Advertising on AWS
Amazon Web Services1.6K views
Satrtup Bootcamp - Scale on AWS by Idan Tohami
Satrtup Bootcamp - Scale on AWSSatrtup Bootcamp - Scale on AWS
Satrtup Bootcamp - Scale on AWS
Idan Tohami277 views
Your Basic Building Blocks - AWS Compute - AWS Summit Tel Aviv 2017 by Amazon Web Services
Your Basic Building Blocks - AWS Compute - AWS Summit Tel Aviv 2017Your Basic Building Blocks - AWS Compute - AWS Summit Tel Aviv 2017
Your Basic Building Blocks - AWS Compute - AWS Summit Tel Aviv 2017
AWS 201 Webinar Series - Rightsizing and Cost Optimizing your Deployment by Amazon Web Services
AWS 201 Webinar Series - Rightsizing and Cost Optimizing your DeploymentAWS 201 Webinar Series - Rightsizing and Cost Optimizing your Deployment
AWS 201 Webinar Series - Rightsizing and Cost Optimizing your Deployment
Amazon Web Services3.4K views
Stephen Liedig: Building Serverless Backends with AWS Lambda and API Gateway by Steve Androulakis
Stephen Liedig: Building Serverless Backends with AWS Lambda and API GatewayStephen Liedig: Building Serverless Backends with AWS Lambda and API Gateway
Stephen Liedig: Building Serverless Backends with AWS Lambda and API Gateway
Steve Androulakis683 views
Building serverless backends - Tech talk 5 May 2017 by ARDC
Building serverless backends - Tech talk 5 May 2017Building serverless backends - Tech talk 5 May 2017
Building serverless backends - Tech talk 5 May 2017
ARDC408 views
Building scalable OTT workflows on AWS - Serverless Video Workflows by Amazon Web Services
Building scalable OTT workflows on AWS - Serverless Video WorkflowsBuilding scalable OTT workflows on AWS - Serverless Video Workflows
Building scalable OTT workflows on AWS - Serverless Video Workflows
Amazon Web Services2.1K views
AWS re:Invent 2020 Serverless Recap by Daniel Zivkovic
AWS re:Invent 2020 Serverless RecapAWS re:Invent 2020 Serverless Recap
AWS re:Invent 2020 Serverless Recap
Daniel Zivkovic196 views
AWS re:Invent 2016: The State of Serverless Computing (SVR311) by Amazon Web Services
AWS re:Invent 2016: The State of Serverless Computing (SVR311)AWS re:Invent 2016: The State of Serverless Computing (SVR311)
AWS re:Invent 2016: The State of Serverless Computing (SVR311)
Amazon Web Services3.3K views

More from BATbern

Embracing Serverless: reengineering a real-estate digital marketplace by
Embracing Serverless: reengineering a real-estate digital marketplaceEmbracing Serverless: reengineering a real-estate digital marketplace
Embracing Serverless: reengineering a real-estate digital marketplaceBATbern
31 views35 slides
Serverless und Event-Driven Architecture by
Serverless und Event-Driven ArchitectureServerless und Event-Driven Architecture
Serverless und Event-Driven ArchitectureBATbern
36 views11 slides
Serverless Dev(Ops) in der Praxis by
Serverless Dev(Ops) in der PraxisServerless Dev(Ops) in der Praxis
Serverless Dev(Ops) in der PraxisBATbern
26 views23 slides
BATbern51 Serverless?! by
BATbern51 Serverless?!BATbern51 Serverless?!
BATbern51 Serverless?!BATbern
15 views9 slides
Ein Rückblick anlässlich des 50. BAT aus Sicht eines treuen Partners by
Ein Rückblick anlässlich des 50. BAT aus Sicht eines treuen PartnersEin Rückblick anlässlich des 50. BAT aus Sicht eines treuen Partners
Ein Rückblick anlässlich des 50. BAT aus Sicht eines treuen PartnersBATbern
21 views9 slides
MLOps journey at Swisscom: AI Use Cases, Architecture and Future Vision by
MLOps journey at Swisscom: AI Use Cases, Architecture and Future VisionMLOps journey at Swisscom: AI Use Cases, Architecture and Future Vision
MLOps journey at Swisscom: AI Use Cases, Architecture and Future VisionBATbern
223 views35 slides

More from BATbern(20)

Embracing Serverless: reengineering a real-estate digital marketplace by BATbern
Embracing Serverless: reengineering a real-estate digital marketplaceEmbracing Serverless: reengineering a real-estate digital marketplace
Embracing Serverless: reengineering a real-estate digital marketplace
BATbern31 views
Serverless und Event-Driven Architecture by BATbern
Serverless und Event-Driven ArchitectureServerless und Event-Driven Architecture
Serverless und Event-Driven Architecture
BATbern36 views
Serverless Dev(Ops) in der Praxis by BATbern
Serverless Dev(Ops) in der PraxisServerless Dev(Ops) in der Praxis
Serverless Dev(Ops) in der Praxis
BATbern26 views
BATbern51 Serverless?! by BATbern
BATbern51 Serverless?!BATbern51 Serverless?!
BATbern51 Serverless?!
BATbern15 views
Ein Rückblick anlässlich des 50. BAT aus Sicht eines treuen Partners by BATbern
Ein Rückblick anlässlich des 50. BAT aus Sicht eines treuen PartnersEin Rückblick anlässlich des 50. BAT aus Sicht eines treuen Partners
Ein Rückblick anlässlich des 50. BAT aus Sicht eines treuen Partners
BATbern21 views
MLOps journey at Swisscom: AI Use Cases, Architecture and Future Vision by BATbern
MLOps journey at Swisscom: AI Use Cases, Architecture and Future VisionMLOps journey at Swisscom: AI Use Cases, Architecture and Future Vision
MLOps journey at Swisscom: AI Use Cases, Architecture and Future Vision
BATbern223 views
From Ideation to Production in 7 days: The Scoring Factory at Raiffeisen by BATbern
From Ideation to Production in 7 days: The Scoring Factory at RaiffeisenFrom Ideation to Production in 7 days: The Scoring Factory at Raiffeisen
From Ideation to Production in 7 days: The Scoring Factory at Raiffeisen
BATbern65 views
The Future of Coaching in Sport with AI/ML by BATbern
The Future of Coaching in Sport with AI/MLThe Future of Coaching in Sport with AI/ML
The Future of Coaching in Sport with AI/ML
BATbern50 views
Klassifizierung von Versicherungsschäden – AI und MLOps bei der Mobiliar by BATbern
Klassifizierung von Versicherungsschäden – AI und MLOps bei der MobiliarKlassifizierung von Versicherungsschäden – AI und MLOps bei der Mobiliar
Klassifizierung von Versicherungsschäden – AI und MLOps bei der Mobiliar
BATbern100 views
BATbern48_ZeroTrust-Konzept und Realität.pdf by BATbern
BATbern48_ZeroTrust-Konzept und Realität.pdfBATbern48_ZeroTrust-Konzept und Realität.pdf
BATbern48_ZeroTrust-Konzept und Realität.pdf
BATbern397 views
BATbern48_How Zero Trust can help your organisation keep safe.pdf by BATbern
BATbern48_How Zero Trust can help your organisation keep safe.pdfBATbern48_How Zero Trust can help your organisation keep safe.pdf
BATbern48_How Zero Trust can help your organisation keep safe.pdf
BATbern326 views
BATbern48_Zero Trust Architektur des ISC-EJPD.pdf by BATbern
BATbern48_Zero Trust Architektur des ISC-EJPD.pdfBATbern48_Zero Trust Architektur des ISC-EJPD.pdf
BATbern48_Zero Trust Architektur des ISC-EJPD.pdf
BATbern164 views
Why did the shift-left end up in the cloud for Bank Julius Baer? by BATbern
Why did the shift-left end up in the cloud for Bank Julius Baer?Why did the shift-left end up in the cloud for Bank Julius Baer?
Why did the shift-left end up in the cloud for Bank Julius Baer?
BATbern403 views
Creating a Product through DevOps: The Story of APPUiO Cloud by BATbern
Creating a Product through DevOps: The Story of APPUiO CloudCreating a Product through DevOps: The Story of APPUiO Cloud
Creating a Product through DevOps: The Story of APPUiO Cloud
BATbern116 views
Zeitnahe Reaktion auf Verordnungsänderungen mit Feature Toggles by BATbern
Zeitnahe Reaktion auf Verordnungsänderungen mit Feature TogglesZeitnahe Reaktion auf Verordnungsänderungen mit Feature Toggles
Zeitnahe Reaktion auf Verordnungsänderungen mit Feature Toggles
BATbern66 views
DevSecOps-Teams das Security-Steuer überlassen by BATbern
DevSecOps-Teams das Security-Steuer überlassenDevSecOps-Teams das Security-Steuer überlassen
DevSecOps-Teams das Security-Steuer überlassen
BATbern59 views
Compliance und Governance in der DevOps-Acht by BATbern
Compliance und Governance in der DevOps-AchtCompliance und Governance in der DevOps-Acht
Compliance und Governance in der DevOps-Acht
BATbern250 views
Shift Left Security by BATbern
Shift Left SecurityShift Left Security
Shift Left Security
BATbern245 views
Erfolgreich scheitern mit Shift Left und DevOps by BATbern
Erfolgreich scheitern mit Shift Left und DevOpsErfolgreich scheitern mit Shift Left und DevOps
Erfolgreich scheitern mit Shift Left und DevOps
BATbern35 views
Shift Left fängt ganz links an by BATbern
Shift Left fängt ganz links anShift Left fängt ganz links an
Shift Left fängt ganz links an
BATbern107 views

Recently uploaded

PCCC23:日本AMD株式会社 テーマ2「AMD EPYC™ プロセッサーを用いたAIソリューション」 by
PCCC23:日本AMD株式会社 テーマ2「AMD EPYC™ プロセッサーを用いたAIソリューション」PCCC23:日本AMD株式会社 テーマ2「AMD EPYC™ プロセッサーを用いたAIソリューション」
PCCC23:日本AMD株式会社 テーマ2「AMD EPYC™ プロセッサーを用いたAIソリューション」PC Cluster Consortium
27 views12 slides
Discover Aura Workshop (12.5.23).pdf by
Discover Aura Workshop (12.5.23).pdfDiscover Aura Workshop (12.5.23).pdf
Discover Aura Workshop (12.5.23).pdfNeo4j
20 views55 slides
"Surviving highload with Node.js", Andrii Shumada by
"Surviving highload with Node.js", Andrii Shumada "Surviving highload with Node.js", Andrii Shumada
"Surviving highload with Node.js", Andrii Shumada Fwdays
59 views29 slides
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or... by
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...ShapeBlue
209 views20 slides
The Power of Heat Decarbonisation Plans in the Built Environment by
The Power of Heat Decarbonisation Plans in the Built EnvironmentThe Power of Heat Decarbonisation Plans in the Built Environment
The Power of Heat Decarbonisation Plans in the Built EnvironmentIES VE
85 views20 slides
The Coming AI Tsunami.pptx by
The Coming AI Tsunami.pptxThe Coming AI Tsunami.pptx
The Coming AI Tsunami.pptxjohnhandby
14 views12 slides

Recently uploaded(20)

PCCC23:日本AMD株式会社 テーマ2「AMD EPYC™ プロセッサーを用いたAIソリューション」 by PC Cluster Consortium
PCCC23:日本AMD株式会社 テーマ2「AMD EPYC™ プロセッサーを用いたAIソリューション」PCCC23:日本AMD株式会社 テーマ2「AMD EPYC™ プロセッサーを用いたAIソリューション」
PCCC23:日本AMD株式会社 テーマ2「AMD EPYC™ プロセッサーを用いたAIソリューション」
Discover Aura Workshop (12.5.23).pdf by Neo4j
Discover Aura Workshop (12.5.23).pdfDiscover Aura Workshop (12.5.23).pdf
Discover Aura Workshop (12.5.23).pdf
Neo4j20 views
"Surviving highload with Node.js", Andrii Shumada by Fwdays
"Surviving highload with Node.js", Andrii Shumada "Surviving highload with Node.js", Andrii Shumada
"Surviving highload with Node.js", Andrii Shumada
Fwdays59 views
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or... by ShapeBlue
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
ShapeBlue209 views
The Power of Heat Decarbonisation Plans in the Built Environment by IES VE
The Power of Heat Decarbonisation Plans in the Built EnvironmentThe Power of Heat Decarbonisation Plans in the Built Environment
The Power of Heat Decarbonisation Plans in the Built Environment
IES VE85 views
The Coming AI Tsunami.pptx by johnhandby
The Coming AI Tsunami.pptxThe Coming AI Tsunami.pptx
The Coming AI Tsunami.pptx
johnhandby14 views
Measurecamp Brussels - Synthetic data.pdf by Human37
Measurecamp Brussels - Synthetic data.pdfMeasurecamp Brussels - Synthetic data.pdf
Measurecamp Brussels - Synthetic data.pdf
Human37 27 views
PCCC23:日本AMD株式会社 テーマ1「AMD Instinct™ アクセラレーターの概要」 by PC Cluster Consortium
PCCC23:日本AMD株式会社 テーマ1「AMD Instinct™ アクセラレーターの概要」PCCC23:日本AMD株式会社 テーマ1「AMD Instinct™ アクセラレーターの概要」
PCCC23:日本AMD株式会社 テーマ1「AMD Instinct™ アクセラレーターの概要」
"Running students' code in isolation. The hard way", Yurii Holiuk by Fwdays
"Running students' code in isolation. The hard way", Yurii Holiuk "Running students' code in isolation. The hard way", Yurii Holiuk
"Running students' code in isolation. The hard way", Yurii Holiuk
Fwdays38 views
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023 by BookNet Canada
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023Redefining the book supply chain: A glimpse into the future - Tech Forum 2023
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023
BookNet Canada46 views
AIM102-S_Cognizant_CognizantCognitive by PhilipBasford
AIM102-S_Cognizant_CognizantCognitiveAIM102-S_Cognizant_CognizantCognitive
AIM102-S_Cognizant_CognizantCognitive
PhilipBasford23 views
Bronack Skills - Risk Management and SRE v1.0 12-3-2023.pdf by ThomasBronack
Bronack Skills - Risk Management and SRE v1.0 12-3-2023.pdfBronack Skills - Risk Management and SRE v1.0 12-3-2023.pdf
Bronack Skills - Risk Management and SRE v1.0 12-3-2023.pdf
ThomasBronack31 views
Deep Tech and the Amplified Organisation: Core Concepts by Holonomics
Deep Tech and the Amplified Organisation: Core ConceptsDeep Tech and the Amplified Organisation: Core Concepts
Deep Tech and the Amplified Organisation: Core Concepts
Holonomics17 views
Don’t Make A Human Do A Robot’s Job! : 6 Reasons Why AI Will Save Us & Not De... by Moses Kemibaro
Don’t Make A Human Do A Robot’s Job! : 6 Reasons Why AI Will Save Us & Not De...Don’t Make A Human Do A Robot’s Job! : 6 Reasons Why AI Will Save Us & Not De...
Don’t Make A Human Do A Robot’s Job! : 6 Reasons Why AI Will Save Us & Not De...
Moses Kemibaro38 views
Future of AR - Facebook Presentation by Rob McCarty
Future of AR - Facebook PresentationFuture of AR - Facebook Presentation
Future of AR - Facebook Presentation
Rob McCarty66 views

Serverless at Lifestage

  • 1. Serverless at Lifestage What is serverless and how we use it at Lifestage. The good parts and the challenges we faced over the past years.
  • 2. About me • CTO at Lifestage Solutions AG since 2016 • Between 2000 and 2010 I’ve been working primarily for enterprise clients on on-premise Oracle DB and AS with Java / PL/SQL / C. • Since 2010 mostly for startups on AWS cloud with Node.js / C++ / Lambda and DynamoDB.
  • 3. Our Application • We sell care material for the elderly to Spitex and elderly homes (APH). And we help them charging this material to insurances and patients. • You can think about us as a small Amazon for nurses • Among other things we handle material ordering / pick&pack / billing / automatic inventory management and warm food delivery • We are live since 2016 and constantly adding features. • We serve >200 organizations in 3 languages across Switzerland. • We have ~2.5k digital scales deployed across Switzerland to track product usage
  • 4. Agenda • What is “serverless”? • Why we choose it? • What we enjoyed AND struggled with • An example: our application and the components we use to run it • Q&A
  • 5. “serverless”?! Traditional 3-tier architecture (servers) Serverless architecture (services)
  • 6. What is “serverless”? • Managed infrastructure for compute AND persistence (operated by your cloud vendor e.g. DDoS mitigation, OS/AS/DB updates) • Scalable and highly available by design (serverless functions and persistence runs on different AZ active-active) • Billing model: pay only for the resources you actually use (by execution duration or IO operations) • Tradeoff: scalable simple interface implies some compexity is moved back into the application code (e.g. state management). No lift and shift.
  • 7. Why we choose it? • Move fast / break things: focus on business logic, on customers, on everchanging regulations instead of babysitting systems • Billing model: pay only for the resources you actually use / have the cost scale with revenue
  • 10. The good Resilient: if a request crashes a VM all the other requests are running on different containers / VMs, so are completely unaffected. Also memory leaks are less of a problem. Flexible: custom runtimes depending on feature JS/C++/Python/memory size/wrap cli. Easy to add features without touching the running parts. Low cost: when implemented efficiently if no user is active there is no running cost as compute time is billed on milliseconds of use * GB of memory used. (our ratio: revenue / 1000) Scalable: new lambda instances are created as requests come in and kept running for a while to serve new requests highly avaialable: (API Gateway is automatically load balancing on Lambda instances in different data centers typically 3 per region) Low touch: No operational cost for servers. (no OS updates / AS updates / downtime / hot deployment does not affect running requests)
  • 11. Resilient • Each request has its own dedicated application server instance
  • 12. Felixible • Add new API endpoints without touching deployed ones • Add new DB / Event subscribers without affecting the running ones
  • 13. The “bad” Coordination: building complicated workflows without lock-in on solutions like AWS Step Functions is tricky. Also being aware of vendor lock-in while architecting is crucial to use ONLY the relevant and reproducible portion of the offered APIs. https://serverlessworkflow.io/ Complexity: you are always facing a very constrained execution environment (max execution time / max memory / max input/output size / disk space / code size / stateless) and so you constantly need clever solutions to work around this limitations to enjoy the benefits. Cold starts: lambdas are on-demand containers that need initialization, so if you need low latency, you probably have to pay for provisioned concurrency.
  • 14. The “ugly” VM updates: AWS discontinues obsolete versions of VMs (Java/Node/Python etc) so if your code relies on it, you have to upgrade it and keep it fresh. Challenging at times with native extensions (C++). Especially when you have to review the impact on 100s of microservices. Needs planning or can be worked around with custom runtimes.
  • 15. Local development • We use 1 Docker container per mocked service / app, recreating the same service topology as in AWS • We mostly use AWS services (or portions of the API) that we can easily mock locally. • Although there are several offerings for local development replacements, we end up writing our own.
  • 16. Operations via REPL • Data import / export / plots • Scripts • Log investigation • Manual Lambda execution • Authorized granularly via IAM
  • 17. Q & A
  • 18. What about security? • Shared responsibility model (infrastructure is kept secure and up to date from the cloud provider, application developers need to be sure to implement their code according to best practices e.g. OWASP) • Lambdas are stateless and ephimeral created on invocation and get often recycled. Based on Firecracker MicroVMs for isolation (KVM). Strict runtime constraints (memory / cpu / disk space / execution roles). • Data at rest and in transit is encrypted by default in most AWS services, and can be configured to use client owned keys or service keys. • CloudFront has built-in DDoS mitigation and API Gateway can be granularly configured to throttle API calls blacklist IPs and validate request content before the request is passed to any compute layer. • Custom request authorizers (session token validation / signed requests validators) are configurable both at the Edge (CDN nodes) and on API Gateway. • You can run some Lambdas in restricted VPCs with access to crafted network resources and e.g. no internet access at all.
  • 19. Examples of serverless offerings Compute: AWS Lambda, Google Cloud Functions, MS Azure Functions Database: AWS DynamoDB, Google Cloud Spanner, MS Cosmos DB File storage: AWS S3, Google Cloud Storage, MZ Azure BLOB storage Caching: MomentoHQ
  • 20. Examples of NON-serverless offerings Compute: AWS ECS, AWS EC2, AWS Elastic Beanstalk, Google AppEngine, Azure App Service Database: AWS RDS , Azure for MYSQL/Postgre/.. File storage: AWS EFS Caching: AWS Elasticache (Redis), Google Memorystore (Redis), Azure Cache (Redis) , AWS DAX
  • 21. Example cost structure (Lambda x86 vs ARM) Cost grows with memory but so does VCPUs (1-6) so if your code can use parallelism it will run faster AND cheaper on bigger Lambdas. Test test test.
  • 22. Example cost structure (Dynamo) RRU: 1 item read up to 4KB (2 if eventual consistent) WRU: 1 item write up to 1KB This is the case for each table AND index, although you can limit the size of each index entry by projecting only A few attributes from the original item and save on both index reads and writes.