Serverless Computing
What, why, why not and how?
Harald Kubota harald.kubota@gmail.com
July 2017
Index
Definitions
Serverless and NoOps
Functions
Applications
When to use FaaS
Costs
Appendix
Example
Definitions
�IaaS - Infrastructure as a Service
PaaS - Platform as a Service
FaaS - Functions as a Service (Serverless Computing)
Another “Serverless Computing” Definition
Definitions
Serverless and NoOps
Functions
Applications
When to use FaaS
Costs
Appendix
Example
IaaS - Don’t Worry About Hardware Details
Hardware: CPU, RAM, Disks
Network: Cables, Switches, Routers
OS
Libraries
Run-Time environment
Service
Red Hat RHEL7.2 / Windows 2012 R2
translator.py
Apache, IIS
Virtual Machine
4 vCPUs, 16 GB RAM, 200GB Disks (RAID 1)
Application
Python 3.6.1, SQLAlchemy library, MySQL 5.7.18
HP ProLiant DL580 Gen 9, Intel E7-4800, 256GB RAM, SmartArray P440 RAID Controller, 4 600GB SAS disks, SolarFlare Flareon Ultra SFN8542
Blue: User is responsible for running it
Gray: Service provider is responsible for provisioning and running it
IaaS Examples
Managed Server - Don’t Worry About OS Details Either
Hardware: CPU, RAM, Disks
Network: Cables, Switches, Routers
OS
Libraries
Run-Time environment
Service
Red Hat RHEL7 / Windows 2012 R2
translator.py
Apache, IIS
Virtual Machine
4 vCPUs, 16 GB RAM, 200 GB Disks (RAID 1)
Application
Python 3.6.1, SQLAlchemy library, MySQL 5.7.18
HP ProLiant DL580 Gen 9, Intel E7-4800, 256GB RAM, SmartArray P440 RAID Controller, 4 600GB SAS disks, SolarFlare Flareon Ultra SFN8542
PaaS - Concentrate on the Code
Hardware: CPU, RAM, Disks
Network: Cables, Switches, Routers
OS
Libraries
Service
Red Hat RHEL7 / Windows 2012 R2
translator.py
Apache, IIS
Virtual Machine
4 vCPUs, 16 GB RAM, 200 GB Disks (RAID 1)
Application
SQLAlchemy library
Python 3.6, MySQL 5
HP ProLiant DL580 Gen 9, Intel E7-4800, 256GB RAM, SmartArray P440 RAID Controller, 4 600GB SAS disks, SolarFlare Flareon Ultra SFN8542
Run-Time Environment
PaaS Examples
FaaS - Concentrate on the Function
Hardware: CPU, RAM, Disks
Network: Cables, Switches, Routers
OS
Libraries
Service
Red Hat RHEL7 / Windows 2012 R2
translator.py
Apache, IIS
Virtual Machine
4 vCPUs, 16 GB RAM, 200 GB Disks (RAID 1)
Application
SQLAlchemy library
Python 3.6, MySQL 5
HP ProLiant DL580 Gen 9, Intel E7-4800, 256GB RAM, SmartArray P440 RAID Controller, 4 600GB SAS disks, SolarFlare Flareon Ultra SFN8542
Run-Time Environment
User connects here
FaaS Examples
Another “Serverless Computing” Definition
Definitions
Serverless and NoOps
Functions
Applications
When to use FaaS
Costs
Appendix
Example
Another “Serverless Computing” Definition
Code that runs on event-driven, ephemeral and stateless environments,
fully managed by a third-party.
��https://cheesecakelabs.com/blog/what-is-serverless-all-about/
The program code, incl. libraries needed
Triggered by something (incoming request or message)
Every time you call the code, a new environment is being spun up and it’s deleted afterwards
No state and no local methods/storage to keep a state
Nothing for you to do. Nothing you can do.
How does it work internally?
For efficiency reasons, replace “server” with “container”
What is a “State”?
Functions
Applications
Definitions
Serverless and NoOps
When to use FaaS
Costs
Appendix
Example
Serverless = No Servers?
No Servers = No Ops?
Definitions
Serverless and NoOps
Functions
Applications
When to use FaaS
Costs
Appendix
Example
#Serverless #NoOps
Welcome to the serverless fairyland!
It’s a dream come true!
Serverless = No servers to worry about!
No more Ops!
Mipsytipsy, https://charity.wtf/2016/05/31/wtf-is-operations-serverless/
#Serverless #YesOps
What is the “F” in “FaaS”?
What is a “Function”?
Definitions
Serverless and NoOps
Functions
Applications
When to use FaaS
Costs
Appendix
Example
What is a Function? - Context: Mathematics
Note that the function f: does not have any state
What is a Function? - Context: Web
Trigger
HTTP GET request to http://translate.com/translate
Input
HTTP GET http://translate.com/translate?in=en&out=de&text=Good%20Morning
Output
“Guten Morgen”
But where is my Application?
Definitions
Serverless and NoOps
Functions
Applications
When to use FaaS
Costs
Appendix
Example
Many Functions Become the Application
2 functions in a very simple translation web site:
Definitions
Serverless and NoOps
Functions
Applications
When to use FaaS
Costs
Appendix
Example
Keeping a State
To keep a state, a FaaS function needs to store it somewhere permanently.
Example:
Typical choices are:
When to use FaaS?
Definitions
Serverless and NoOps
Functions
Applications
When to use FaaS
Costs
Appendix
Example
When to use FaaS?
What works well for FaaS?
What does not work well for FaaS?
Possible Triggers/Events
Example: Google Cloud Functions
Microservice: Counting Primes
Definitions
Serverless and NoOps
Functions
Applications
GC Example
Costs
When to use FaaS
Good and Bad
When to use FaaS
Costs
Appendix
Example
Google Cloud Functions
GC: New Project
GC: Storage
GC: Storage
GC: Functions
Example: GC Counting Primes
Creating a new function
Example: GC Counting Primes
Example: GC Counting Primes
Function primeCount created:
Example: GC Counting Primes
Example: GC Counting Primes - Statistics
The Source Code
11: exported and called function
12-24: Prime calculation
25: Get URL param named “limit”
27: Output data format
28: HTTP 200 return code
28: Return JSON
29-31: Return limit, and number of primes and primes themselves
Code Differences between
GCF and AWS Lambda
Definitions
Serverless and NoOps
Functions
Applications
GC vs AWS Example
Costs
When to use FaaS
Good and Bad
GC Example
Costs
When to use FaaS
Good and Bad
When to use FaaS
Costs
Appendix
GCF vs Lambda
Code - GC Functions vs AWS Lambda
Example: Google Cloud
Microservice: Tic Tac Toe
Definitions
Serverless and NoOps
Functions
Applications
AWS Example
Costs
When to use FaaS
Good and Bad
GC Example
Costs
When to use FaaS
Good and Bad
When to use FaaS
Costs
Appendix
Example
Example: GC Tic Tac Toe
Calling it from any machine via cURL
or via a web browser (with a bit of HTML)
Build your own FaaS:
OpenWhisk
or
http://docs.get-faas.com/
Definitions
Serverless and NoOps
Functions
Applications
OpenWhisk
get-faas
Costs
When to use FaaS
Good and Bad
GC Example
Costs
When to use FaaS
Good and Bad
When to use FaaS
Costs
Appendix
DIY FaaS
OpenWhisk (Apache Incubator)
http://docs.get-faas.com/
Definitions
Serverless and NoOps
Functions
Applications
GC Example
Costs
When to use FaaS
Good and Bad
When to use FaaS
Costs
Appendix
Example
A Real Example: A Cloud Guru
Training platform for cloud training.
More details: Serverless - Cloud functions and the future of software architecture
Costs Comparison
AWS Lambda
vs
GC Functions
Definitions
Serverless and NoOps
Functions
Applications
GC Example
Costs
When to use FaaS
Good and Bad
When to use FaaS
Costs
Appendix
Example
Costs - AWS Lambda vs Google Cloud Functions
AWS Lambda
Google Cloud Functions
Costs - AWS Lambda vs Google Cloud Functions
AWS Lambda
Google Cloud Functions
Definitions
p3
Serverless and NoOps
p16
Functions
p20
Applications
p23
When to use FaaS
p27
Example
p29, p41, p43, p45, p48
Costs
p50
The End
Appendix
p54
Appendix