Upload
xpeppers
View
292
Download
1
Embed Size (px)
Citation preview
Nome Speaker@twitter
\ Si fa presto a dire Serverless
Daniel Depaoli@dedaniel_xp
Alessio Coser@AlessioCoser
\ Si fa presto a dire Serverless
What we are going to talk about?
1. Introduction to Serverless2. Our Dev Experience3. Our Ops Experience
\ Si fa presto a dire Serverless
What is a Function?
Custom code that’s run in an ephemeral context.
\ Si fa presto a dire Serverless
What is a Function?
Custom code that’s run in an ephemeral context.
● The code/application that we want to execute● The Service we provide to our users● Responds to events
\ Si fa presto a dire Serverless
What is a Function?
● Created only to run your code and then destroyed● Has no state or persistence● It’s still a server!
Custom code that’s run in an ephemeral context.
\ Si fa presto a dire Serverless
Functions
Application
Runtime
Operating System
Virtualization
Hardware
IaaS
Customer Managed Unit of scale
Customer Managed
Abstract by vendor
\ Si fa presto a dire Serverless
Functions
Application
Runtime
Operating System
Virtualization
Hardware
Functions
Application
Runtime
Operating System
Virtualization
Hardware
IaaS PaaS
Customer Managed Unit of scale
Customer Managed
Abstract by vendor
\ Si fa presto a dire Serverless
Functions
Application
Runtime
Operating System
Virtualization
Hardware
Functions
Application
Runtime
Operating System
Virtualization
Hardware
Functions
Application
Runtime
Operating System
Virtualization
Hardware
IaaS PaaS FaaS
Customer Managed Unit of scale
Customer Managed
Abstract by vendor
\
● No infrastructure maintenance● Built-in automatic scaling● Only pay for the execution time● No persistence, no state● Limited execution time● Fully integrated with cloud provider’s services
Si fa presto a dire Serverless
Main features
\ Si fa presto a dire Serverless
Cloud-Computing Providers
● Amazon AWS Lambda● Google Cloud Functions● Azure Functions
\ Our Dev experiences
aws.amazon.com/solutions/case-studies/photovogue
\
An online photography platform
● Allows upcoming photographers to showcase their work.
● Each picture that’s submitted is carefully reviewed by Vogue Italia’s editorial staff.
Our Dev experiences PhotoVogue
\
● ~ 400,000 photos● ~ 130,000 photographers● ~ 3,000 uploaded images each day
An online photography platform
Our Dev experiences PhotoVogue
\ Our Dev experiences PhotoVogue
● Application that scales● No state or sessions● No long running scripts● Upload and resize of photos in parallel
How FaaS applies to the domain
\
(as long as an entire AWS region does not crash)
[image]
Our Dev experiences PhotoVogue
No downtime
\
Very common problem:You have two distinct functionalities, and
they share some of their code
Our Dev experiences PhotoVogue
\
1st solution:Create a single function which responds
to two different events
Our Dev experiences PhotoVogue
\
Easy to updateNo dependencies to manage
Big functionViolates Single Responsibility Principle
Our Dev experiences PhotoVogue
\
Common parts are easier to shareNo dependencies to manage
Deploy takes longerUnnecessary dependencies are also shared
Must deploy each function to update common code
Our Dev experiences PhotoVogue
\
3rd solution:Create two different functions with an
external shared dependency (es: git, npm)
Our Dev experiences PhotoVogue
\
No duplicated codeCan use different versions of dependency
Startup time increasesYou have to manage an external library
Our Dev experiences PhotoVogue
\
4th solution:Create two different functions that will
invoke a third one (containing the shared behaviour)
Our Dev experiences PhotoVogue
\
No duplicated codeCan use different versions of common function
Execution time increasesAdditional point of failure
Our Dev experiences PhotoVogue
\
1. Backupa. Every night create VMs snapshotb. Move snapshots to another AWS region
Our Ops experiences Disaster Recovery and Testing
Our implementation with FaaS
\
2. Recoverya. Activate the new environment in alternative region with
lastest snapshots
3. Testa. Check services and send notification
Our Ops experiences Disaster Recovery and Testing
Our implementation with FaaS
\ Our Ops experiences Interaction with infrastructure
Load Balancer
Instance InstanceInstance task
Master
● Lambda direct SSH connection to instance● Triggering or doing particular tasks
\
● Check Backup S3● Dump DB● Clean EFS● Etc.
Our Ops experiences Interaction with infrastructure
Some example:
\
FaaS - when?Conclusions
● You need to simplify operational tasks● Your app needs to scale● Your domain logic is event based● You need to process a large quantity of
data
\
● You want some form of control over the infrastructure
● You have to maintain some state into the app● Your functions take a long time to run
FaaS - when not?Conclusions