Jules Testard - Software Engineer, Docker Inc
Since the advent of AWS Lambda in 2014, the Function as a Service (FaaS) programming paradigm has gained a lot of traction in the cloud community. Since then, interest has increased for developers and entreprises to build their own open source solutions on top of Kubernetes. A number of competing frameworks in this space have been developed. In this talk, we will look at three specific frameworks (OpenFaas, Nuclio and FN) and for each framework we will: Show how to create, deploy, and invoke a function using that framework Show how Docker images and containers are used by each framework under the hood Investigate how the frameworks leverage KNative to build, ship and run applications on Kubernetes
2. What is Serverless?
● Serverless: also called FaaS
● FaaS: Function-As-A-Service
● Programming model in which applications are written as a set of
“functions”, run in ephemeral containers
package function
import (
"encoding/json"
)
// Handle a serverless request
func Handle(req []byte) string {
var e CloudEvent
if err := json.Unmarshal(req, &e); err != nil {
panic(err)
}
if Authenticate(e.Data) {
return "authentication successful"
}
return "authentication failed"
}
3. What is Serverless?
Public Cloud FaaS
● Public cloud manages the
function lifecycle and execution
● “Pay-as-you-go” model. Pricing is
based on actual amount of
resources consumed by the
function execution
● Pioneered by AWS, with AWS
Lambda (2014)
Private/Installable FaaS
● Installed using an orchestrator
such as Docker Swarm or
Kubernetes on a cluster
● Function management and
lifecycle handled in orchestrator.
● More recently developed (2016).
● Serverless: also called FaaS
● FaaS: Function-As-A-Service
● Programming model in which applications are written as a set of
“functions”, run in ephemeral containers
4. Serverless Pros
● Eliminates server maintenance
○ Developer time is spent on building actual value
○ (installable framework) -> maintenance goes to ops team
● Automatic Scaling
● Significant Price Drop
● Modernize traditional application (MTA)
5. LibHive: 90% cost reduction on small app
Small web app running on
AWS using a public cloud application
moved to AWS
Lambda
application fully
managed by Ec2
and ELB
6. HeavyWater: from 30,000$/mo to 3700$/mo
HeavyWater processes
files in batch using AWS
1000 Ec2 machines
200 Ec2
machines
39M AWS
Lambda
invocations
7. Serverless Cons
● (Still) hard to observe
● Cold Starts*
● Hard to hire knowledgeable developers
○ ecosystem is very new
● Each platform has specific tools
○ No common tooling
● Heavier reliance on vendor ecosystems
8. Public or Installable?
Public over Installable:
● Free below free tier
○ i.e. AWS Lambda has 1M requests/mo for free
● No ops team required
● Integrated within each cloud
○ i.e. a cloudwatch event can trigger an AWS Lambda
call
9. Public or Installable?
Installable over Public:
● Can be much more performant if properly configured
● Functions can be as big as you like* and run for as
long as you like
● Can be much cheaper on large scale (back of the
envelope
● Can run without the internet
*: within available resources
18. ● Github stars: 2,300
● Starte Date: Jun 4, 2017
● Focuses on data processing and
performance
● Contributors: 33
● Runs on Kubernetes
● Sponsored by Iguazio
24. Knative
● Kubernetes-based platform to build, deploy,
and manage modern serverless workloads.
● Release Date: Jun 4, 2018 (currently at v0.2)
● Contributors: 50
● Runs on Kubernetes
● Sponsored by Google, Pivotal, IBM, Red Hat,
and SAP
30. Tools which will influence the future of FaaS:
- CloudFlare isolates
- AWS FireCracker
- Pulumi
New Trends
31. CloudFlare Isolates
● All functions which use the same runtime will use the same process
● Node JS runtime overhead: 35MB
● Node JS runtime using CloudFlag isolates: 3MB
32. AWS Firecracker
● Open Source Project
● Designed for multi-tenant function
services
● MicroVM: lightweight virtual machine
● Same hardware-virtualization-based
security as VMs
● Almost as fast to start as a container