Serverless Presentation from Devoxx 2017 Casablanca (AWS Lambda / FaaS / Fn Project).
I did another presentation with the same slides at DOAG Nürnberg.
3. • Founded munz & more in 2007
• > 15 years Middleware,
Cloud, and Distributed Computing
• Consulting and
High-End Training
• Wrote two WebLogic and
a Cloud book
Dr. Frank Munz
@frankmunz
8. Pay Per Use
• 1 US cent/h (micro), geo-distribution included
• You own a massively parallel, distributed and highly
available supercomputer with linear costs:
1 instance for 100 hours $= 100 instances for 1h
@frankmunz
12. FaaS: AWS Lambda
• AWS announced Lambda in 2014
• Lambda is Function as a Service (FaaS)
@frankmunz
13. AWS Lambda
AWS SAM Local: test and locally run Lambda (Public Beta)
event: event passed to function
context: runtime context
callback: optional return
(or null)
@frankmunz
18. Pricing
Every started request is charged:
• First 1 million req/month are free, forever
+ 400,000 GB seconds of compute time
• Measured in increments of 100 msec
• $0.20 per 1 million req
+ $0.00001667 per GB second
Tip: Use AWS
Cloud Watch
alarms for billing!
@frankmunz
19. Cost Savings
Expedia(2016):
– 2.3 billions calls
– 200k hours / month
– $ 550 a month
Postlight
– API GW, Lambda, Serverless
– Costs dropped 2 orders of magnitude down to $ 370
https://www.youtube.com/watch?v=gT9x9LnU_rE
https://trackchanges.postlight.com/serving-39-million-requests-for-370-month-or-how-we-reduced-our-hosting-costs-by-two-orders-of-edc30a9a88cd
http://serverlesscalc.com/
@frankmunz
21. Function as a Service
• Automated elasticity
• True pay per invocation
• Ephemeral compute
Definition
Characteristics
• Event based
• Reduced control plane (mem
+ CPU + I/O)
• Uses container tech
22. AMIGO: Public Cloud Services
Amazon Microsoft IBM Google Oracle
Name Lambda Azure Functions Open Whisk Cloud Functions tbd
Year 2014 2016 2016 2016 2016
Status prod prod prod beta announced
Language
Support
NodeJS 4.3.2,
Java8,Python
2.7, .Net C#,
native Linux
JS, PHP, C#, F#,
Python, bash,
PowerShell
NodeJS, Java,
Phython,
(Docker)
NodeJS
(not Java)
Docker based ?
Remarks Bundle functions,
OneDrive and
Bot integration
Apache
Incubator
Deploy from
github or
BitBucket, CLI
Based on
open source
Fn Project?
Link https://aws.amazon.
com/lambda/
https://azure.microsoft.co
m/en-
us/services/functions/
https://openwhisk.apa
che.org/
https://azure.microsoft.co
m/en-
us/services/functions/
https://cloud.oracle.com/home
24. Youtube: Gone in 60ms
https://www.youtube.com/watch?v=YZ058hmLuv0
@frankmunz
25. Microservices
Developing a single application as
• a suite of small services
• each running in its own process / owns it‘s data
• communicating with lightweight mechanisms
(M. Fowler / J. Lewis)
https://martinfowler.com/articles/microservices.html
@frankmunz
26. FaaS = Microservice?
• FaaS fulfills M. Fowler’s microservices definition
• A real micro service consists of multiple functions
• FaaS vs. Docker / Kubernetes?
✅
Benefits of FaaS
- Serverless
- Zero config auto scaling
- True pay per use
-> higher abstraction
Limits of FaaS
- Language choice
- Resource limits
- Vendor lock-in
-> reduced flexibility
@frankmunz
29. Serverless
Mark Cavage, Java One 2017:
“Reduce notion of all infrastructure”
Serverless
Example: AWS
SQS@frankmunz
Wasn’t that PaaS ?
Yes it‘s PaaS, but serverless requires…
• Never pay for idle
• Automated elasticity
• Reduced config settings
32. FaaS OS Frameworks
Overlap in functionality
-> expect consolidation
Survival is about:
• Integration: K8s, Traefik, Zipkin,
Prometheus, Kafka etc.
• Adoption, adoption, adoption
• FaaS as PaaS implementation? https://github.com/faas-lane/
FaaS-Lane/tree/master/candidates@frankmunz
33. Fn Project
• Apache 2, Open Source Java One 2017
• Fn Server (micro API GW), LB, Flow
• Function / Container duality
• Docker is only dependency -> polyglot
@frankmunz
34. Fn Project
• Jackson for JSON marshalling in Java
• JAX-RS demo
• Hot functions (30 seconds)
• Fn PaaS service likely?
@frankmunz
39. TL;DR #serverless & #FaaS
in all major clouds / could compose
μ out of 𝛌 / PaaS ⊇ Serverless ⊇ FaaS / FaaS
= stateless / true pay per use / automated
scalability / event driven / integrates with
other CS / architect against vendor lock in /
cloud agnostic FaaS frameworks emerge / FaaS
frameworks consolidation ahead /
𝛌 only technically the new μ (AWS).
@frankmunz
Global one man show
Intersection of Open Source / Enterprise SW
Background HPC / Brain Research
REST API with JSON Structures that go across wire
Autoscaling rules
5 people, many rules
Free lunch! Actually lunch included in $0.01
Happy days…
Well almost.
So far, theory. What we write when we write a book.
Look at reality… Reality i rocky.
Monte Cervino, Matterhorn, 4478m
Most photographed mountain in the alps
DIVING story.
IaaS: Launch Configuration, +Autoscaling Groups +Scaling Events,pay /h
PaaS: Min/Max, trigger, IaaS pricing
CS: Easy Ccontainer scaling IaaS pay per use pricing
SAM = Serverless Application Model, based on Cloud Formation
NO EVENTBUS! Stateless, with 5 min max exec time
Start threads and processes
Events based, but no event bus visible
Retries + dead letter Q
You can use environment variables
Invocation times differ per language and per call
No config for scaling
You pay for GB *s, metered in 100 ms
One event can trigger several funcs
Function executes at least once (-> idempotent f)
AWS Step Function: visual designer
No SLAs
Not Http
Reuse of container is undpredictable
Higher startup times on first hit
Higher startup times for Java
Speachlet is technically a servlet
Create a skill
Define Intents = function
Utterances = example user input, you give it several. “similar” is AI.
True pay per use
Duration is calculated from the time your code begins executing until it returns or otherwise terminates, rounded up to the nearest 100ms.
Like your mobile …
Continuous, automated scaling
Also the size of the attack vector is historically small !
Container lifetime = milli-seconds
No open ports
Not listening to an IP
Lambda triggered by event
Scaling - deal with hundreds of services
Modular structure - modularity vs. overhead
Independend change cycles - welcome to having 112 versions
My EAR story
Serverless is full of servers.
If your PaaS can start efficiently instances in 20 msec that run for half a second, then call it serverless
AWS Dynamo: normal mode, you provision r/w throughput and pay. Even if not used.
Alexis ellis
Hot functions keeps container running for 30 secs
CF : about 50 different methods for composing, combining, executing asynchronous computation steps and handling errors.
Hot functions keeps container running for 30 secs
CF : about 50 different methods for composing, combining, executing asynchronous computation steps and handling errors.
Currently JSON
- .thenCompose : add work when first func is done, uses Lambda
type safety across severall fn calls.
Looks like single programm, but every stepp is exec single JVM, massive paralleziation.
Next, the thenCompose call adds some work to be done once the flight booking function completes. This is in the form of a lambda that takes the result of the flight booking call flightRes and returns another future with more work to do. In this case another invokeFunction call but this time to the hotel booking function. Note that because we’ve specified some type information in the invokeFunction call (BookingRes.class) we have type safety across multiple serverless function invocations. And the compiler was able to infer the type of the thenCompose lambda for us. Very cool.
Finally there is the whenComplete call which triggers when all of the preceding stages have returned. This takes a lambda with two parameters, a result and an error. One of these will always be null and we can use this to check for and handle errors.
most changes ever within 1 major product version number aka 12.1