1. BASLE BERN BRUGG DÜSSELDORF FRANKFURT A.M. FREIBURG I.BR. GENEVA
HAMBURG COPENHAGEN LAUSANNE MUNICH STUTTGART VIENNA ZURICH
Servlerless Computing with Fn Project
Matthias Furrer
An introduction to the open source Fn Project
2. Agenda
TechEvent Sept 2018 - Servlerless Computing with Fn Project2 09/2018
1. Introduction
BaaS and FaaS
What is Serverless Computing ?
Expectations
Use cases
Tradeoffs
Comparison
2. Fn Project Overview
Key characteristics
Components
Architecture
3. Fn in the cloud
Concepts
4. Demo
Go function
Java function
4. BaaS and FaaS
TechEvent Sept 2018 - Servlerless Computing with Fn Project4 09/2018
Backend-as-a-Service (BaaS): third-party, API-based services that replace core
subsets of functionality in an application. The APIs are provided as a service that
auto-scales and operates transparently. BaaS will often be the supporting
infrastructure (e.g. provides state) to the stateless functions
Functions-as-a-Service (FaaS): provides event-driven computing. Application code
with functions is triggered by events or HTTP requests. Developers deploy small
units of code to the FaaS, which are executed as needed as discrete actions, scaling
without the need to manage servers or any other underlying infrastructure
A serverless computing platform may provide one or both of FaaS and BaaS.
5. What is Serverless Computing ?
Cloud Native Computing Foundation Definition
TechEvent Sept 2018 - Servlerless Computing with Fn Project5 09/2018
Serverless computing does not mean that servers to host and run code are no longer
used
A concept of building and running applications that do not require server
management.
A deployment model where applications, bundled as functions, are uploaded to a
platform and then executed, scaled, and billed in response to the exact demand
needed at the moment
Platform management tasks and capabilities are handled by a serverless platform
and are completely abstracted away from the developers and IT/operations teams
A serverless product can instantly and precisely scale to handle each individual
incoming request
https://github.com/cncf/wg-serverless/blob/master/whitepapers/serverless-
overview/cncf_serverless_whitepaper_v1.0.pdf
6. Expectations
The next evolution of cloud systems ?
TechEvent Sept 2018 - Servlerless Computing with Fn Project6 09/2018
Consumers of serverless computing no longer need to spend time and resources on
server provisioning, maintenance, updates, scaling, and capacity planning
No Compute Cost When Idle
Individual Services (e.g. endpoints in a microservice) can scale independently and
be billed separately, even if they share a common data backend.
Reduced packaging and deployment complexity
Reduction in lead time and faster time to market
Harder to infiltrate - «Try to attack something that only lives for few milliseconds»
«Greener» Computing ?
7. Use Cases
TechEvent Sept 2018 - Servlerless Computing with Fn Project7 09/2018
Asynchronous, concurrent, easy to parallelize into independent units of work
Infrequent or sporadic demand, with large, unpredictable variance in scaling
requirements
Stateless, ephemeral, without a major need for instantaneous cold start time
Examples:
– Performing analytics on IoT sensor input messages (e.g. MQTT messages)
– Handling stream processing (analyzing or modifying data in motion)
– Executing logic in response to database changes (triggers)
– Scheduling tasks (cron or batch style invocations)
8. Tradeoffs
TechEvent Sept 2018 - Servlerless Computing with Fn Project8 09/2018
Function startup after a period of inactivity may result in performance declines
Serverless is “No sysadmin” but it doesn’t mean "No Ops”. Monitoring, deployment,
security, networking is still a concern
Potential vendor lock-in
Execution duration may be limited in FaaS
Testing (e.g. load testing), debugging and monitoring can be tricky. However tools
are improving
9. Comparison to other deployment models
TechEvent Sept 2018 - Servlerless Computing with Fn Project9 09/2018
Source: Cloud Native Computing Foundation WG-Serverless Whitepaper v1.0
• Containers-as-a-Service (CaaS)
Maintain full control over infrastructure and get
maximum portability. Maximum control, flexibility,
reusability and ease of bringing existing
containerized apps into the cloud
• Platform-as-a-Service (PaaS)
Focus on the application and let the platform
handle the rest. Easier management and
deployment of applications, auto-scaling and pre-
configured services for the most common
application needs
• Functions-as-a-Service (FaaS)
Write logic as small pieces of code that respond to
a variety of events. Includes the lowest requirement
for infrastructure management of any of the cloud
native paradigms
11. Key Characteristics
www.fnproject.io
TechEvent Sept 2018 - Servlerless Computing with Fn Project11 09/2018
Open Source - Available under Apache 2.0
– Active 2700+ commits across 60+ contributors
– evolution of the IronFunctions project from iron.io, now mainly maintained by
Oracle
Platform Independent – Laptop, server, cloud
– Can be deployed locally, to any cloud or on-premise
Scheduler Independent
– Deploy to Kubernetes, Swarm, Mesos, etc.
Docker Based – Leverages Docker ecosystem
– Containers are primitives
12. Components
TechEvent Sept 2018 - Servlerless Computing with Fn Project12 09/2018
Fn Server
– Functions-as-a-Service system allowing to build, deploy, and scale their functions
into a multi-cloud environment
Fn Load Balancer (Fn LB)
– Deploy clusters of Fn servers and route traffic to them
– Route traffic to nodes where hot functions are running
– Distribute load if traffic to a specific function increases
Fn FDK’s
– Function Development Kits in several languages
Flow
– build and orchestrate higher level workflows
13. Fn Function
Developers View
TechEvent Sept 2018 - Servlerless Computing with Fn Project13 09/2018
Small chunk of code wrapped into a container image
Functions == Containers : Functions are packaged as containers—so any container
can be deployed as a function
Fn Function is a container with a set of known characteristics
– Short running / Ephemeral
– Stateless
– Single-purposed
– Self-contained
Language Support: Java, Go, Python, and Ruby (more coming..)
BYOD: “Bring your own Dockerfile” and launch as a function
14. Architecture
Function deployment
TechEvent Sept 2018 - Servlerless Computing with Fn Project14 09/2018
Fn Service
myFunction
r/myApp/myFunction:0.0.2
myFunction:0.0.2
mySourcCode
myFunction:0.0.2
Fn Server
1. Builds Container (multistage) – and increments version
2. Pushes Container to registry – if not deployed locally
3. Creates/updates server routes – servers lazy load images
16. Architecture
Traffic routing
TechEvent Sept 2018 - Servlerless Computing with Fn Project16 09/2018
Source: http://deck.fnproject.io/
• If functions are deployed
as hot functions, a
container is kept alive for
30 seconds (and not
restarted for every
invocation)
19. Fn Server
Supporting Services
TechEvent Sept 2018 - Servlerless Computing with Fn Project19 09/2018
DB, MQ, blob store are all pluggable modules that are thin wrappers around their
respective drivers.
– DB: MySQL, sqlite3, Postgres
– Queue: Redis, Kafka
– Registry: Any Docker v2-compliant, even private
Metrics/Monitoring
– OpenTracing API for metrics
– Prometheus support, pluggable backends
– Logging via syslog
21. Fn Flow
Sequencing/chaining functions
TechEvent Sept 2018 - Servlerless Computing with Fn Project21 09/2018
Build long-running, reliable, scalable functions with rich sets of language-specific
primitives – fork-join, chaining, delays and error handling
Supports complex parallel processes that are readable and testable (including unit
tests) with
Standard programming tools
Java support – Java 8 CompletableFuture API
JS, Python, Go language support on the way!
22. TechEvent Sept 2018 - Servlerless Computing with Fn Project22 09/2018
Fn in the cloud
23. Fn in the cloud
TechEvent Sept 2018 - Servlerless Computing with Fn Project23 09/2018
Can be installed on any public cloud IaaS
However, when running on IaaS, there is no true ‘pay-per-invocation” benefit
Fn can be installed on Kubernetes from the command line using Helm
– Preconfigured Helm charts available for Fn service, Fn UI, Fn Flow
– Fn LB can be deployed and updated if Fn Server Kubernetes pods are added or
removed
Runs on Oracle managed Kubernetes service - Oracle Container Engine (OCE)
26. Matthias Furrer
Principal Consultant, Application Integration & SOA
matthias.furrer@trivadis.com
09/2018
TechEvent Sept 2018 - Servlerless Computing with Fn
Project
26
27. Session Feedback – now
TechEvent September 201827 14.09.2018
Please use the Trivadis Events mobile app to give feedback on each session
Use "My schedule" if you have registered for a session
Otherwise use "Agenda" and the search function
If the mobile app does not work (or if you have a Windows smartphone), use your
smartphone browser
– URL: http://trivadis.quickmobileplatform.eu/
– User name: <your_loginname> (such as "svv")
– Password: sent by e-mail...