SlideShare ist ein Scribd-Unternehmen logo
1 von 38
Democratizing Serverless
Shaun Smith
Director of Product Management
Oracle Cloud Infrastructure—Serverless
The Open Source Fn Project
What is Serverless?
● Serverless is an abstraction of infrastructure and its operations
including provisioning, scaling, patching, etc.
● Serverless architecture is when an app is built entirely on
serverless components (compute, storage, networking)
● FaaS (Functions as a Service) is the compute component in a
serverless architecture
2
Functions as a Service
● Functions are small bits of code that do one thing well and are
easy to understand and maintain
● As a Service means no complicated plumbing, the system
takes care of provisioning, scaling, patching, maintaining, etc.
Each function scales independently. 3
In mathematics, a function is a relation between
a set of inputs and a set of permissible outputs
with the property that each input is related to
exactly one output.
Function (mathematics) - Wikipedia
https://en.wikipedia.org/wiki/Function_(mathematics)
Why Serverless?
4
AgilityEconomics InnovationReliability
There are still servers
5
There are still servers
6
Hockey-stick ready
time
users
The Ideal Functions Platform
● Open Source—no vendor lock-in
● Platform Independent—laptop, server, cloud
● Approachable—easy for new users, low level controls for
advanced users
● Docker Based—leverage Docker ecosystem
● Scheduler Independent—deploy to Kubernetes, Swarm,
Mesos, etc.
8
www.fnproject.io
Introducing the Fn Project
● Open-source serverless compute platform
● Can be deployed to any cloud and on-premise
● Simple, elegant, and extensible by design
● Containers are primitives
● Active w/ 2500+ commits across 50+ contributors
● Independently governed with representation at Container
Native Compute Foundation (CNCF)
● Strong enterprise focus (security, scalability, observability, etc.)
10
An Fn Function
11
● Code wrapped in a container
image
● Input from STDIN and
environment
● Output to STDOUT
● Logs to STDERR
The Fn server handles everything else
Function Development Kits (FDKs)
● Used to help with parsing input and writing output
● Simply write a `handler` function that adheres to the FDK’s
interface and it will parse STDIN and provide the input data to
your function and deal with writing the proper output format.
● Makes it a lot easier to write functions
12
Functions == Containers
13
Functions are packaged as
containers—so any
container can be deployed
as a function
Package and reuse open
source libraries as functions!
Containers vs Functions
Fn Function is a container with
a set of known traits:
● Short running
● Ephemeral
● Stateless
● Invoked
● Single Purpose
● Self-contained
14
Fn CLI
● fn init --runtime go
● fn run
● fn test
● fn deploy --app myapp
● fn call myapp myfunc
route → http://localhost:8080/r/myapp/myfunc 15
Architecture
Fn Server
● Handles CRUD operations for setting up routes and functions
● Executes sync functions, returning responses to clients
immediately
● Queues async function calls
● Executes async functions when capacity is available
● Written in Go, easy to extend via plugin module system
Fn LB
● Simple, fast load balancer that routes functions to certain
nodes consistently for hot function efficiency
● Scales each function independently based on traffic to any
particular function
● Can be used to scale Fn servers and infrastructure as well as it
has a view of global state of all fn servers
Fn Demo
19
fn deploy details
1. Builds container (multi-stage) + bumps version
MyFunc:0.0.2
Your code
1
20
fn deploy details
1. Builds container (multi-stage) + bumps version
2. Pushes container to registry
MyFunc:0.0.2
MyFunc:0.0.2
Your code
1 2
21
fn deploy details
1. Builds container (multi-stage) + bumps version
2. Pushes container to registry
3. Creates/updates function route (fn servers lazy load images)
MyFunc:0.0.2
MyFunc:0.0.2 MyFunc:0.0.2
Your code
Fn Service
myfunc →
/r/myapp/myfunc:0.0.2
1 2 3
22
fn deploy --local
1. Builds container (multi-stage) + bumps version
2. Pushes container to registry
3. Creates/updates function route (fn servers lazy load images)
MyFunc:0.0.2
MyFunc:0.0.2
Your code
Fn Service
myfunc →
/r/myapp/myfunc:0.0.2
1
MyFunc:0.0.2
2 3
23
Debugging
● fn calls list myapp
● fn calls get myapp <call-id>
● fn logs get myapp <call-id>
● Metrics created using OpenTracing w/ initial collectors and
extensions for Prometheus, ZipKin, and soon Jaeger
24
OpenCensus and Prometheus
25
Fn UI
26
Fn Flow
27
Composing Functions
Fn Flow
● For long-running, reliable, scalable functions with primitives for
fork-join, chaining, delays and error handling
● Java support using CompletableFuture API from Java 8—
Node, Python, Go support on the way!
29
Fn Flow Example—Generate Resized Images
30
public Response handleRequest(byte[] imageBuffer) {
String id = java.util.UUID.randomUUID().toString();
CloudThreadRuntime runtime = CloudThreads.currentRuntime();
mm.notify("Resizing " + imageBuffer.length + " with id " + id);
runtime.allOf(
runtime.invokeFunction("myapp/resize128", imageBuffer)
.thenAccept((img) -> swiftClient.swiftUpload(img, id + "-128.png"))
.thenRun(() -> mm.notify("Uploaded 128px image")),
runtime.invokeFunction("myapp/resize256", imageBuffer)
.thenAccept((img) -> swiftClient.swiftUpload(img, id + "-256.png"))
.thenRun(() -> mm.notify("Uploaded 256px image")),
runtime.invokeFunction("myapp/resize512", imageBuffer)
.thenAccept((img) -> swiftClient.swiftUpload(img, id + "-512.png"))
.thenRun(() -> mm.notify("Uploaded 512px image")),
runtime.invokeAsync(() -> swiftClient.swiftUpload(imageBuffer, id + ".png"))
).whenComplete((val,err) -> {
if(err!= null){
mm.notify("An error occurred while uploading images " + err.getMessage());
} else {
mm.notify("All images uploaded to id " + id);
}
});
return new Response(id);
}
31
Fn Flow Example—Multiple Stages & Threads
Notify the user “Resizing is being performed”
Do all of the following in parallel:
Run function "myapp/resize128” to resize image to 128px
Then upload the 128px image to storage
Then notify the user the 128px image was uploaded
Run function "myapp/resize256” to resize image to 256x256
Then upload the 128px image to storage
Then notify the user the 128px image was uploaded
Run function “myapp/resize512” to resize image to 512x512
Then upload the 128px image to storage
Then notify the user the 128px image was uploaded
Upload the original image to storage
When all functions are complete:
Then notify the user that "All images uploaded"
2.a
2.b
2.c
2.d
3
1
Fn Flow Demo
32
http://microservices.io/patterns/data/saga.html
It’s (still) just Java
It’s (still) just Java or Go or Node.js or …
Fn—An Ideal Functions Platform?
✅ Open Source—no vendor lock-in
✅ Platform Independent—laptop, server, cloud
✅ Approachable—easy for new users, low level controls for
advanced users
✅ Docker Based—leverage Docker ecosystem
✅ Scheduler Independent—deploy to Kubernetes, Swarm,
Mesos, etc.
37
http://fnproject.io
Thank you!
1. Star the project: github.com/fnproject/fn
2. Join the conversation: slack.fnproject.io
3. Learn more: fnproject.io
Shaun Smith
@shaunMsmith
Get Involved

Weitere ähnliche Inhalte

Was ist angesagt?

Fltk S60 Introduction
Fltk S60 IntroductionFltk S60 Introduction
Fltk S60 Introduction
guest5c161
 

Was ist angesagt? (14)

Embedded Linux on ARM
Embedded Linux on ARMEmbedded Linux on ARM
Embedded Linux on ARM
 
Automating with ansible (Part B)
Automating with ansible (Part B)Automating with ansible (Part B)
Automating with ansible (Part B)
 
Linux systems - Getting started with setting up and embedded platform
Linux systems - Getting started with setting up and embedded platformLinux systems - Getting started with setting up and embedded platform
Linux systems - Getting started with setting up and embedded platform
 
Os final project
Os final projectOs final project
Os final project
 
Introduction to netlink in linux kernel (english)
Introduction to netlink in linux kernel (english)Introduction to netlink in linux kernel (english)
Introduction to netlink in linux kernel (english)
 
Building the VM
Building the VMBuilding the VM
Building the VM
 
Strategies for developing and deploying your embedded applications and images
Strategies for developing and deploying your embedded applications and imagesStrategies for developing and deploying your embedded applications and images
Strategies for developing and deploying your embedded applications and images
 
Nano Server (ATD 11)
Nano Server (ATD 11)Nano Server (ATD 11)
Nano Server (ATD 11)
 
Automating with ansible (Part A)
Automating with ansible (Part A)Automating with ansible (Part A)
Automating with ansible (Part A)
 
Fltk S60 Introduction
Fltk S60 IntroductionFltk S60 Introduction
Fltk S60 Introduction
 
CNIT 127 Ch 3: Shellcode
CNIT 127 Ch 3: ShellcodeCNIT 127 Ch 3: Shellcode
CNIT 127 Ch 3: Shellcode
 
LXC, Docker, and the future of software delivery | LinuxCon 2013
LXC, Docker, and the future of software delivery | LinuxCon 2013LXC, Docker, and the future of software delivery | LinuxCon 2013
LXC, Docker, and the future of software delivery | LinuxCon 2013
 
Linux firmware for iRMC controller on Fujitsu Primergy servers
Linux firmware for iRMC controller on Fujitsu Primergy serversLinux firmware for iRMC controller on Fujitsu Primergy servers
Linux firmware for iRMC controller on Fujitsu Primergy servers
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAs
 

Ähnlich wie Democratizing Serverless

Ähnlich wie Democratizing Serverless (20)

"Wie passen Serverless & Autonomous zusammen?"
"Wie passen Serverless & Autonomous zusammen?""Wie passen Serverless & Autonomous zusammen?"
"Wie passen Serverless & Autonomous zusammen?"
 
Open Source Serverless: a practical view. - Gabriele Provinciali Luca Postacc...
Open Source Serverless: a practical view. - Gabriele Provinciali Luca Postacc...Open Source Serverless: a practical view. - Gabriele Provinciali Luca Postacc...
Open Source Serverless: a practical view. - Gabriele Provinciali Luca Postacc...
 
Going serverless with Fn project, Fn Flow and Kubernetes
Going serverless with Fn project, Fn Flow and KubernetesGoing serverless with Fn project, Fn Flow and Kubernetes
Going serverless with Fn project, Fn Flow and Kubernetes
 
Democratizing Serverless: the New Open Source, Cloud Agnostic Functions Platf...
Democratizing Serverless: the New Open Source, Cloud Agnostic Functions Platf...Democratizing Serverless: the New Open Source, Cloud Agnostic Functions Platf...
Democratizing Serverless: the New Open Source, Cloud Agnostic Functions Platf...
 
The FN Project by Maximilian Jerg
The FN Project by Maximilian JergThe FN Project by Maximilian Jerg
The FN Project by Maximilian Jerg
 
The Fn Project: A Quick Introduction (December 2017)
The Fn Project: A Quick Introduction (December 2017)The Fn Project: A Quick Introduction (December 2017)
The Fn Project: A Quick Introduction (December 2017)
 
Serverless design with Fn project
Serverless design with Fn projectServerless design with Fn project
Serverless design with Fn project
 
Free the Functions with Fn project!
Free the Functions with Fn project!Free the Functions with Fn project!
Free the Functions with Fn project!
 
When Web Services Go Bad
When Web Services Go BadWhen Web Services Go Bad
When Web Services Go Bad
 
Near real-time anomaly detection at Lyft
Near real-time anomaly detection at LyftNear real-time anomaly detection at Lyft
Near real-time anomaly detection at Lyft
 
Serverless Boston @ Oracle Meetup
Serverless Boston @ Oracle MeetupServerless Boston @ Oracle Meetup
Serverless Boston @ Oracle Meetup
 
The Fn Project by Jesse Butler
 The Fn Project by Jesse Butler The Fn Project by Jesse Butler
The Fn Project by Jesse Butler
 
Devops with Python by Yaniv Cohen DevopShift
Devops with Python by Yaniv Cohen DevopShiftDevops with Python by Yaniv Cohen DevopShift
Devops with Python by Yaniv Cohen DevopShift
 
Configuration Management with Saltstack
Configuration Management with SaltstackConfiguration Management with Saltstack
Configuration Management with Saltstack
 
Arnold Bechtoldt, Inovex GmbH Linux systems engineer - Configuration Manageme...
Arnold Bechtoldt, Inovex GmbH Linux systems engineer - Configuration Manageme...Arnold Bechtoldt, Inovex GmbH Linux systems engineer - Configuration Manageme...
Arnold Bechtoldt, Inovex GmbH Linux systems engineer - Configuration Manageme...
 
Activity 5
Activity 5Activity 5
Activity 5
 
Immutant
ImmutantImmutant
Immutant
 
Docker - Demo on PHP Application deployment
Docker - Demo on PHP Application deployment Docker - Demo on PHP Application deployment
Docker - Demo on PHP Application deployment
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
 
OSDC 2016 | rkt and Kubernetes: What’s new with Container Runtimes and Orches...
OSDC 2016 | rkt and Kubernetes: What’s new with Container Runtimes and Orches...OSDC 2016 | rkt and Kubernetes: What’s new with Container Runtimes and Orches...
OSDC 2016 | rkt and Kubernetes: What’s new with Container Runtimes and Orches...
 

Mehr von Shaun Smith

EclipseCon 2011-Gemini Naming
EclipseCon 2011-Gemini NamingEclipseCon 2011-Gemini Naming
EclipseCon 2011-Gemini Naming
Shaun Smith
 
EclipseCon 2011-Gemini Intro
EclipseCon 2011-Gemini IntroEclipseCon 2011-Gemini Intro
EclipseCon 2011-Gemini Intro
Shaun Smith
 
RESTful Data Access Services with Java EE
RESTful Data Access Services with Java EERESTful Data Access Services with Java EE
RESTful Data Access Services with Java EE
Shaun Smith
 
RESTful services with JAXB and JPA
RESTful services with JAXB and JPARESTful services with JAXB and JPA
RESTful services with JAXB and JPA
Shaun Smith
 

Mehr von Shaun Smith (13)

Serverless Java: JJUG CCC 2019
Serverless Java: JJUG CCC 2019Serverless Java: JJUG CCC 2019
Serverless Java: JJUG CCC 2019
 
Functions and DevOps
Functions and DevOpsFunctions and DevOps
Functions and DevOps
 
Polyglot! A Lightweight Cloud Platform for Java SE, Node, and More
Polyglot! A Lightweight Cloud Platform for Java SE, Node, and MorePolyglot! A Lightweight Cloud Platform for Java SE, Node, and More
Polyglot! A Lightweight Cloud Platform for Java SE, Node, and More
 
Lightweight Java in the Cloud
Lightweight Java in the CloudLightweight Java in the Cloud
Lightweight Java in the Cloud
 
EclipseLink: Beyond Relational and NoSQL to Polyglot and HTML5
EclipseLink: Beyond Relational and NoSQL to Polyglot and HTML5EclipseLink: Beyond Relational and NoSQL to Polyglot and HTML5
EclipseLink: Beyond Relational and NoSQL to Polyglot and HTML5
 
Practical RESTful Persistence
Practical RESTful PersistencePractical RESTful Persistence
Practical RESTful Persistence
 
The Evolution of Java Persistence
The Evolution of Java PersistenceThe Evolution of Java Persistence
The Evolution of Java Persistence
 
EclipseCon 2011-Gemini Naming
EclipseCon 2011-Gemini NamingEclipseCon 2011-Gemini Naming
EclipseCon 2011-Gemini Naming
 
EclipseCon 2011-Gemini Intro
EclipseCon 2011-Gemini IntroEclipseCon 2011-Gemini Intro
EclipseCon 2011-Gemini Intro
 
EclipseCon 2011-Gemini JPA
EclipseCon 2011-Gemini JPAEclipseCon 2011-Gemini JPA
EclipseCon 2011-Gemini JPA
 
RESTful Data Access Services with Java EE
RESTful Data Access Services with Java EERESTful Data Access Services with Java EE
RESTful Data Access Services with Java EE
 
RESTful services with JAXB and JPA
RESTful services with JAXB and JPARESTful services with JAXB and JPA
RESTful services with JAXB and JPA
 
OSGi Persistence With EclipseLink
OSGi Persistence With EclipseLinkOSGi Persistence With EclipseLink
OSGi Persistence With EclipseLink
 

Kürzlich hochgeladen

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Kürzlich hochgeladen (20)

The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 

Democratizing Serverless

  • 1. Democratizing Serverless Shaun Smith Director of Product Management Oracle Cloud Infrastructure—Serverless The Open Source Fn Project
  • 2. What is Serverless? ● Serverless is an abstraction of infrastructure and its operations including provisioning, scaling, patching, etc. ● Serverless architecture is when an app is built entirely on serverless components (compute, storage, networking) ● FaaS (Functions as a Service) is the compute component in a serverless architecture 2
  • 3. Functions as a Service ● Functions are small bits of code that do one thing well and are easy to understand and maintain ● As a Service means no complicated plumbing, the system takes care of provisioning, scaling, patching, maintaining, etc. Each function scales independently. 3 In mathematics, a function is a relation between a set of inputs and a set of permissible outputs with the property that each input is related to exactly one output. Function (mathematics) - Wikipedia https://en.wikipedia.org/wiki/Function_(mathematics)
  • 5. There are still servers 5
  • 6. There are still servers 6
  • 8. The Ideal Functions Platform ● Open Source—no vendor lock-in ● Platform Independent—laptop, server, cloud ● Approachable—easy for new users, low level controls for advanced users ● Docker Based—leverage Docker ecosystem ● Scheduler Independent—deploy to Kubernetes, Swarm, Mesos, etc. 8
  • 10. Introducing the Fn Project ● Open-source serverless compute platform ● Can be deployed to any cloud and on-premise ● Simple, elegant, and extensible by design ● Containers are primitives ● Active w/ 2500+ commits across 50+ contributors ● Independently governed with representation at Container Native Compute Foundation (CNCF) ● Strong enterprise focus (security, scalability, observability, etc.) 10
  • 11. An Fn Function 11 ● Code wrapped in a container image ● Input from STDIN and environment ● Output to STDOUT ● Logs to STDERR The Fn server handles everything else
  • 12. Function Development Kits (FDKs) ● Used to help with parsing input and writing output ● Simply write a `handler` function that adheres to the FDK’s interface and it will parse STDIN and provide the input data to your function and deal with writing the proper output format. ● Makes it a lot easier to write functions 12
  • 13. Functions == Containers 13 Functions are packaged as containers—so any container can be deployed as a function Package and reuse open source libraries as functions!
  • 14. Containers vs Functions Fn Function is a container with a set of known traits: ● Short running ● Ephemeral ● Stateless ● Invoked ● Single Purpose ● Self-contained 14
  • 15. Fn CLI ● fn init --runtime go ● fn run ● fn test ● fn deploy --app myapp ● fn call myapp myfunc route → http://localhost:8080/r/myapp/myfunc 15
  • 17. Fn Server ● Handles CRUD operations for setting up routes and functions ● Executes sync functions, returning responses to clients immediately ● Queues async function calls ● Executes async functions when capacity is available ● Written in Go, easy to extend via plugin module system
  • 18. Fn LB ● Simple, fast load balancer that routes functions to certain nodes consistently for hot function efficiency ● Scales each function independently based on traffic to any particular function ● Can be used to scale Fn servers and infrastructure as well as it has a view of global state of all fn servers
  • 20. fn deploy details 1. Builds container (multi-stage) + bumps version MyFunc:0.0.2 Your code 1 20
  • 21. fn deploy details 1. Builds container (multi-stage) + bumps version 2. Pushes container to registry MyFunc:0.0.2 MyFunc:0.0.2 Your code 1 2 21
  • 22. fn deploy details 1. Builds container (multi-stage) + bumps version 2. Pushes container to registry 3. Creates/updates function route (fn servers lazy load images) MyFunc:0.0.2 MyFunc:0.0.2 MyFunc:0.0.2 Your code Fn Service myfunc → /r/myapp/myfunc:0.0.2 1 2 3 22
  • 23. fn deploy --local 1. Builds container (multi-stage) + bumps version 2. Pushes container to registry 3. Creates/updates function route (fn servers lazy load images) MyFunc:0.0.2 MyFunc:0.0.2 Your code Fn Service myfunc → /r/myapp/myfunc:0.0.2 1 MyFunc:0.0.2 2 3 23
  • 24. Debugging ● fn calls list myapp ● fn calls get myapp <call-id> ● fn logs get myapp <call-id> ● Metrics created using OpenTracing w/ initial collectors and extensions for Prometheus, ZipKin, and soon Jaeger 24
  • 29. Fn Flow ● For long-running, reliable, scalable functions with primitives for fork-join, chaining, delays and error handling ● Java support using CompletableFuture API from Java 8— Node, Python, Go support on the way! 29
  • 30. Fn Flow Example—Generate Resized Images 30 public Response handleRequest(byte[] imageBuffer) { String id = java.util.UUID.randomUUID().toString(); CloudThreadRuntime runtime = CloudThreads.currentRuntime(); mm.notify("Resizing " + imageBuffer.length + " with id " + id); runtime.allOf( runtime.invokeFunction("myapp/resize128", imageBuffer) .thenAccept((img) -> swiftClient.swiftUpload(img, id + "-128.png")) .thenRun(() -> mm.notify("Uploaded 128px image")), runtime.invokeFunction("myapp/resize256", imageBuffer) .thenAccept((img) -> swiftClient.swiftUpload(img, id + "-256.png")) .thenRun(() -> mm.notify("Uploaded 256px image")), runtime.invokeFunction("myapp/resize512", imageBuffer) .thenAccept((img) -> swiftClient.swiftUpload(img, id + "-512.png")) .thenRun(() -> mm.notify("Uploaded 512px image")), runtime.invokeAsync(() -> swiftClient.swiftUpload(imageBuffer, id + ".png")) ).whenComplete((val,err) -> { if(err!= null){ mm.notify("An error occurred while uploading images " + err.getMessage()); } else { mm.notify("All images uploaded to id " + id); } }); return new Response(id); }
  • 31. 31 Fn Flow Example—Multiple Stages & Threads Notify the user “Resizing is being performed” Do all of the following in parallel: Run function "myapp/resize128” to resize image to 128px Then upload the 128px image to storage Then notify the user the 128px image was uploaded Run function "myapp/resize256” to resize image to 256x256 Then upload the 128px image to storage Then notify the user the 128px image was uploaded Run function “myapp/resize512” to resize image to 512x512 Then upload the 128px image to storage Then notify the user the 128px image was uploaded Upload the original image to storage When all functions are complete: Then notify the user that "All images uploaded" 2.a 2.b 2.c 2.d 3 1
  • 33.
  • 36. It’s (still) just Java or Go or Node.js or …
  • 37. Fn—An Ideal Functions Platform? ✅ Open Source—no vendor lock-in ✅ Platform Independent—laptop, server, cloud ✅ Approachable—easy for new users, low level controls for advanced users ✅ Docker Based—leverage Docker ecosystem ✅ Scheduler Independent—deploy to Kubernetes, Swarm, Mesos, etc. 37 http://fnproject.io
  • 38. Thank you! 1. Star the project: github.com/fnproject/fn 2. Join the conversation: slack.fnproject.io 3. Learn more: fnproject.io Shaun Smith @shaunMsmith Get Involved

Hinweis der Redaktion

  1. Easier: Just think about your code, not infrastructure Powerful: Transparent and limitless scaling Faster: Deploy faster, iterate faster, innovate faster Cheaper: Only pay for what you use to the 100ms (never idle)
  2. I’ll let you into a secret. There are servers. Lots of servers. And networking gear. Storage too. We just don’t want to have to think about them anymore. In this session we’ll learn how to build, from the ground up, a scalable, reliable app without once mentioning virtual machines, load balancers, volumes, auto-scaling groups (or even containers that much).
  3. I’ll let you into a secret. There are servers. Lots of servers. And networking gear. Storage too. We just don’t want to have to think about them anymore. In this session we’ll learn how to build, from the ground up, a scalable, reliable app without once mentioning virtual machines, load balancers, volumes, auto-scaling groups (or even containers that much).
  4. Your FaaS platform will enable your app to scale organically per-request without you having to write any special code to handle it. And not just the gentle seasonal changes in demand that a retail business might experience but also sudden, dramatic surges in demand caused by your app going viral.
  5. 17 minutes to here
  6. 24.5 minutes to here.
  7. 29.5 to here
  8. OK so so have a great way to build small, scalable functions but what do we do when we want to write a more complex app. One that has long-lived workflows and fault cases that we need to handle gracefully? This workflow or composition problem is actually a general one that most serverless applications have once they reach some level of complexity. There are 2 naive approaches: - Write a blocking master function that runs one function, waits for the result, then runs the next etc. This might be easy to understand but we lose a lot of the nice characteristics of a serverless app when we do this. This master function is long-running and consumes resources for the whole time that the individual functions are running. When the booking processes take minutes this can get expensive. It's also not very reliable: if this master function dies then we've got no easy way of recovering. - Chain the next function by directly calling it. This ends up being a maintenance nightmare very quickly as all of a sudden each upstream function has to know about every downstream one so that it can gather and pass the right data down the chain. It's also very difficult to deal with errors. Fan-in / join is tricky. Details: ---------- Built on familiar CompletionStage interface from Java 8 Chain together many functions in an arbitrary graph Fan-out / fan-in, timeouts, exception handling Orchestrate complex workflows in one place Language native function orchestration—natural for developer Java initially with additional language support to follow
  9. 29.5 to here
  10. OK, so let’s just recap what we’ve just seen and what it enables you to do. Develop small, reusable functions in Java and have the platform deal with scale, deployment and all the infrastructure concerns Then use a familiar API in your favorite language (still Java) to orchestrate work. No more ‘programming’ in large globs of JSON. Or XML <shudder> Orchestrate many functions in an arbitrary graph Fan-out / fan-in, timeouts, exception handling Java language binding using standard API Other language bindings coming soon Powerful but easy to use
  11. Fn Flow started with Java but there’s already early support for Go, Node.js, and even Amazon Step Functions text format. With Fn Flow you can work in your language of choice and compose and orchestrate functions to build sophisticated applications.
  12. 37 minutes to here no Flow Demo