3. The serverless explained
Credits: Matthew Gilliard
DIY Bare Metal PaaS K8s-aaS Serverless
Hardware
OS
Hypervisor
Virtual OS
Container
Orchestration
Application
Code
@totollygeek
14. What is Fn Project?
• Independent open-source
serverless compute platform
• Not tied to any cloud vendor
• Can be run on premises
• Supported by Oracle
• Containers are primitives
• Strong enterprise in mind
@totollygeek
15. What is a function
container?
• Sandboxed process
• Short running
• Event-driven
• Stateless (-ish)
@totollygeek
16. Anatomy of an Fn function
• Small chunk of code wrapped in a container
• Gets input from http-stream and environment
• Sends output to http-stream
• Logs to STDERR / syslog
@totollygeek
17. FDK (Function Development Kit) support
@totollygeek
Go Java Node.js Python Ruby
Officially
supported
C#
Community
supported
18. The Fn Server
• Runs in a container also
• Handles as an API gateway
• Exposes REST interface
• Storing logs
@totollygeek
19. The Fn CLI
• Of course we have a CLI!
• Used to interact with Fn Server
• Initialization
• Deployment
• Invocation
@totollygeek
20. Initialization of functions
• Calling fn init to create a boilerplate in a folder
• Does not do anything on the server
• Boilerplate includes: Dockerfile, func.yaml & code
@totollygeek
22. How deployment works
@totollygeek
1. Bumps function version
2.Builds container
3.Pushes it to registry
4.Creates or update function & trigger in server
Your code
MyFunc:0.0.2
1 & 2 3
MyFunc:0.0.2
MyFunc:0.0.2
Fn Service
4
26. Using it in
Kubernetes
• Recommended
way of deployment
for production
• Helm chart
available on
GitHub
@totollygeek
27. Fn Flow
• Building scalable distributed applications out of functions
• Flows are functions also
• Support complex parallel processes with error handling, which is
testable
• Flow functions scale as normal functions
• Currently supports Java, hopefully more to come
@totollygeek
28. Fn Flow | Licence plate example
@totollygeek
Scraper
Plate detect
Plate detect
Plate detect
Draw
Draw
Draw
Post to
Twitter
Post to
Twitter
Post to
Twitter
Post to
Slack
Post to
Slack
Post to
Slack
29. Fn Flow | Licence plate example
@totollygeek
Scraper
Plate detect
Plate detect
Plate detect
Draw
Draw
Draw
Post to
Twitter
Post to
Twitter
Post to
Twitter
Post to
Slack
Post to
Slack
Post to
Slack
FlowFuture.invoke()
thenCompose()
thenCompose()
allOf()
whenComplete()
This is me
My tagline from twitter
I know what you ask yourself – aren’t you 20?
I am 24 years and 120 months old.
You saw that in every serverless session
Because the Gods of serverless demand that explanation
You pay just for execution
Generally you have a Monolith, you break to Microservices
Microservices are broken to functions
I don’t completely agree, but that is the idea
Different mindset
Most likely this is what you have
Face it – monoliths are not going anywhere any time soon
This is OK
When you think about it, it is a bit frustrating
When you think about it, it is a bit frustrating
DISCLAIMER:
I do not work for Oracle
I am not affiliated with Oracle in any way shape or form
Views are my own
Apache 2 Licensed, so you can use it however you want
Running bit of your code on demand, based on triggers
Anything that is a Linux process can be containerized and used as a function
Why reinvent the wheel, when you can use already established tools and libraries
For example use a NuGet package in a Function in Google cloud?
Or ruby gem in a function in Azure?
How many of you use containers on daily basis ?
In production ?
Hidden by other processes by a kernel namespacing mechanism
You can run long running containers
Used to use STDIN and STDOUT, but that was not easily supported by all
FDKs handle the IN, OUT and Hot function support
Recently added C#
Still not “official”
Used to use STDIN and STDOUT, but that was not easily supported by all
Used to use STDIN and STDOUT, but that was not easily supported by all
Used to use STDIN and STDOUT, but that was not easily supported by all
Used to use STDIN and STDOUT, but that was not easily supported by all
Show fn start
Fn Init
Fn Deploy
Fn Invoke
Fn UI
Completable Future
Used for Asynchronous programming in Java
Kinda like task based programming in C#