Weitere ähnliche Inhalte
Ähnlich wie fn project serverless computing (20)
Mehr von Wolfgang Weigend (19)
fn project serverless computing
- 1. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
• Content Syndication Previews
• Zenith
• July, 2017
- 2. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
Serverless Computing: Das Projekt Fn
Wir stellen die nächste Generation des Serverless Computing vor: Das Fn Projekt
ist eine containerbasierte Serverless-Plattform, die als Open Source Software
unter Apache 2.0 Lizenz freigegeben wurde. Es läuft überall, in jeder Cloud und
On-Premises. Fn ist einfach zu benutzen, unterstützt jede Programmiersprache, ist
erweiterbar und performant. Ideal, wenn man sich nur noch auf seinen Code
konzentrieren will, nicht auf die darunterliegende Infrastruktur.
2
Wolfgang
Weigend
Oracle
- 3. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
Serverless Computing
Fn Project
Wolfgang Weigend
Sen. Leitender Systemberater
Java Technology and Architecture
- 4. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. | 4
The following is intended to outline our general product
direction. It is intended for information purposes only, and
may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality,
and should not be relied upon in making purchasing
decisions. The development, release, and timing of any
features or functionality described for Oracle’s products
remains at the sole discretion of Oracle.
Disclaimer
- 5. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
Serverless-Kategorie
• Diese Kategorie von Cloud Services hat einen Abstraktionsgrad erreicht, dass
Entwickler nicht mehr über Server, VM’s oder andere IaaS Komponenten
nachdenken müssen
• Funktionen — Das Applikationsprogrammiermodell für Serverless-Architekturen
– Erhöht die Entwicklerproduktivität & Agilität, bei geringeren Kosten
– Kleinere leichtgewichtige Code-Fragmente sind einfach zu entwickeln, debuggen, zu testen
– Event-gesteuerte Trigger: Funktionsaufruf basiert auf Ereignissen
– Services-Skalierbarkeit per Funktion, im Gegensatz für bezahlten Leerlauf
• Container Native — Funktionen sind in Container paketiert
5
- 6. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
Betrachtung der Funktionslandschaft
• Hauptsächlich proprietär, aber davon sind einige Open Source
• Viele gemeinsame Konzepte, sogar plattformübergreifend, aber bisher
ohne Standards
• Entwicklungserfahrung ist stärker als bei IT-Operations, aber derzeit mit
wenig Wissensvermittlung von der Entwicklung zum IT-Betrieb (Dev/Ops)
• Oftmals keine existierende Java-Unterstützung vorhanden
6
- 7. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
Wie eine ideale Funktions-Plattform sein sollte
• Open Source — Kein Vendor-Lock-in
• Plattformunabhängigkeit — Laptop, Server, Cloud
• Zugänglichkeit — Für Einsteiger und Fortgeschrittene
• Docker-basierend — Stärkt das Docker-Ökosystem
• Scheduler-Unabhängigkeit — Deployment für Kubernetes, Swarm, Mesos, etc.
7
- 8. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
Serverless bringt Veränderung
• Serverless als “Compute-Einheit”
• Functions-as-a-Service (FaaS) bestimmt das Anwendungsentwicklungs-
modell der Serverless-Architektur, in Kombination mit den verwendeten
Daten-Services
• Skalierbare Services pro Funktion
8
Traditional
Infrastructure
Virtualized
Infrastructure
FaaS
Compute on demand
- 9. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
Oracle Container Native Serverless - Functions as Service
Eine funktionsbasierte Plattform
• Polyglotte Funktionsplattform mit
Java Optimierungen
• Open Source
• Container Native mit lokaler
Entwicklerunterstützung
– On Premise & Cloud
• Cloud- und Scheduler-Neutral
Function
CI/CD
Local
Develop
Fn Flow
Polyglot Function Engine
fn fn fn fn
Managed Kubernetes
- 10. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
• Container-native, Cloud-agnostische, serverless Plattform
• fn ist eine Open Source Functions-as-a-Service Plattform
• fn läuft überall: public, privat und hybrid
• fn ist Go, kann aber mit jeder Programmiersprache genutzt werden
• fn unterstützt das AWS Lambda Format, Importe können überall laufen
• fn ist modular, für Entwickler einfach nutzbar und erweiterbar
• fn ist einfach zu betreiben
– Intelligenter Load Balancer leitet Datenverkehr an die Funktionen
– Deployment z.B. mit Kubernetes, Mesosphere and Docker Swarm
Oracle Fn Project
- 11. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
• Fn Server und CLI
– Docker-basierte Elastic-Plattform mit
vollständiger CLI für Funktionserzeugung,
Deployment und Management
• Fn Java FDK (Functions Development Kit)
– Java Funktions-Erstellungsunterstützung mit
umfassendem JUnit Test-Framework
• Fn Flow
– Orchestrierung vieler Funktionen in
einen Arbitrary-Graphen
– Skalierbarkeit (in/out), Timeouts,
Fehlerbehandlung
– Sprachneutralität mit initialer Java-
Unterstützung, basierend auf
CompletionStage API mit Java SE 8
11
Fn — Merkmale
Fn Project
Fn Server und CLI
Fn Java Functions
Development Kit
Fn Flow
- 12. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
• Open Source Funktionsplattform, aufgebaut mit
Docker — Container Native
– Evolution der IronFunctions von Iron.io mit den
ursprünlichen Initiatoren
– Deployment von Custom-Docker-Container als Funktionen
• Entwicklung & Test auf jeder Plattform
– Laptop, Server, Cloud
• Scheduler-Agnostisch
– Kubernetes, Mesos, Swarm, ohne Scheduler
• API Gateway eingebaut
12
Fn — Server und CLI
- 13. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
• Funktionen schreiben in der favorisierten Sprache
mit integrierter Unterstützung für Java, Go, Node.js,
Python, Ruby, Rust, & PHP
• Fn Java FDK (Functions Development Kit)
– Java Funktionsentwicklung, Unit-Testing, lokales Debugging
– Fn Flow SDK für parallele und verteilte Funktionsaufrufe
– AWS Lambda Kompatibilität
– Deployment existierender Node.js Lambda Funktionen
13
Fn — Sprachunterstützung
- 14. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 14
Fn Architektur
Fn Server Fn Server Fn Server Fn Server…
Databank
Message Queue Logging
sync async
Client
Fn Load Balancer
… … … …
- 15. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. | 15
Oracle Funktionen mit Oracle Cloud Infrastruktur (OCI)
Function Deployments
Container Operations
Container Automation
API Registry
Service Katalog
Managed
Kubernetes
Service Fabric
fn fn fn fn
fn fn fn fn
- 16. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
Fn Quickstart
- 17. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
Fn Setup
• Systemanforderungen
– Docker 17.05 or later installed and running
– Docker Hub account (Docker Hub) or other Docker-compliant registry
• Installation vom CLI Tool
– Shell Skript ausführen auf Linux und MacOS
• Ubuntu-16.04.3-desktop-amd64.iso 64-bit
$ curl -LSs https://raw.githubusercontent.com/fnproject/cli/master/install | sh
• Download fn.exe 16.5 MB
– https://github.com/fnproject/cli/releases
– fn.exe, fn_alpine, fn_linux, fn_mac
– Source code (zip), Source code (tar.gz)
17
- 18. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
Fn Server starten
$ fn start
18
- 19. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
Erste Funktion erzeugen: func.go
$ mkdir hello
~/hello$ touch func.go
~/hello$ fn init
• initialisiert die Funktion & erkennt die Code-Runtime und erzeugt func.yaml
19
- 20. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
Docker Hub-Benutzernamen & Funktion func.go testen
$ export FN_REGISTRY=<DOCKERHUB_USERNAME>
/hello$ fn run
• Die Funktion läuft im Container genauso, wie auf dem Server
20
- 21. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
Deployment der Funktion auf den Fn Server
• Default localhost:8080 wird verwendet
und es wird eine Route zur Funktion erzeugt
$ fn deploy --local --app myapp
21
- 22. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
Aufruf der Funktion mit curl & fn call oder Browser
$ curl http://localhost:8080/r/myapp/hello
$ fn call myapp /hello
• Browser: http://localhost:8080/r/myapp/hello
22
- 23. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
Fn User Interface im Browser via localhost:4000
$ docker run --rm -it --link fnserver:api -p 4000:4000 -e "FN_API_URL=http://api:8080" fnproject/ui
23
https://github.com/fnproject/ui
- 24. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
Fn Java Functions Developer Kit (FDK)
- 25. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
Fn CLI Tool Installation und Java Funktion erzeugen
$ curl -LSs https://raw.githubusercontent.com/fnproject/cli/master/install | sh
• Create a first Java Function
$ mkdir hello-java-function && cd hello-java-function
$ fn init --runtime=java --name your_dockerhub_account/hello
25
- 26. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
Verzeichnis mit Java Funktion und Funktionskonfiguration
$ cat func.yaml
26
- 27. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
Verzeichnis mit Java Funktion und Source Code
$ cat src/main/java/com/example/fn/HelloFunction.java
27
- 28. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
Docker-build für die Funktion mit fn-CLI-Tool und fn run
$ fn build
$ fn run
28
- 29. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
fn run und Eingabe vom Parameter “name”
$ fn run
$ echo –n “name” | fn run
29
Für den ersten WebCast fn habe ich alles schon bekommen.
- 30. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
Funktion testen
• Fn Java FDK enthält eine Testbibliothek zum Funktionstest mit JUnit
• src/test/java/com/example/fn/HelloFunctionTest.java
30
- 31. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
Fn Server Funktions-Deployment lokal testen
$ fn start
$ fn apps create java-app
31
- 32. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
Fn Server Funktions-Deployment lokal testen und aufrufen
$ fn deploy --app java-app --local
• Aufruf der Funktion mit Fn CLI: $ fn call java-app /hello-java-function
• Funktionsaufruf mit curl http://localhost:8080/r/java-app/hello-java-function
•
32
- 33. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 33
fn deploy
$ fn deploy java-app
func.yaml
HelloFunction
name: dockerwwme/hello
version: 0.0.2
runtime: java
cmd: com.example.fn.HelloFunction::handleRequest
build_image: fnproject/fn-java-fdk-build:jdk9-1.0.56
run_image: fnproject/fn-java-fdk-build:jdk9-1.0.56
format: http
- 34. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 34
fn deploy—build Funktions-Container
$ fn deploy java-app
func.yaml
dockerwwme/hello:0.0.2
HelloFunction
name: dockerwwme/hello
version: 0.0.2
runtime: java
cmd: com.example.fn.HelloFunction::handleRequest
build_image: fnproject/fn-java-fdk-build:jdk9-1.0.56
run_image: fnproject/fn-java-fdk-build:jdk9-1.0.56
format: http
- 35. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 35
fn deploy—push Container zur Registry
$ fn deploy java-app
func.yaml
Docker Registry
dockerwwme/hello:0.0.2
HelloFunction
name: dockerwwme/hello
version: 0.0.2
runtime: java
cmd: com.example.fn.HelloFunction::handleRequest
build_image: fnproject/fn-java-fdk-build:jdk9-1.0.56
run_image: fnproject/fn-java-fdk-build:jdk9-1.0.56
format: http
- 36. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
FN
36
fn deploy—definiere Funktions-Route
$ fn deploy java-app
Docker Registry
dockerwwme/hello:0.0.2
HelloFunctionjava-app
/hello-java dockerwwme/hello:0.0.2
func.yaml
name: dockerwwme/hello
version: 0.0.2
runtime: java
cmd: com.example.fn.HelloFunction::handleRequest
build_image: fnproject/fn-java-fdk-build:jdk9-1.0.56
run_image: fnproject/fn-java-fdk-build:jdk9-1.0.56
format: http
- 37. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Applikations-Deployment und Funktionen überprüfen
$ fn apps list
$ fn routes list java-app
37
- 38. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
Funktionen orchestrieren und zusammensetzen
Fn Flow
- 39. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
Fn Flow
• Erstellt auf dem Java SE 8 CompletionStage API
• Zusammensetzung und Orchestrierung mehrerer Funktionen im Arbitrary-Graphen
• Volumenanpassung (groß/klein), Timeouts, Fehlerbehandlung
• Orchestrierung komplexer Workflows an zentraler Stelle
– Sprachnative Funktionsorchestrierung—selbstverständlich für Entwickler
• Java-Unterstützung
– Java-Language-Binding mit Standard API
• Weitere Programmiersprachen werden unterstützt
Strongly-Typed-Promises-API für Funktionen
- 40. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 40
Mehrere Threads in einer JVM in einem Container
256px
512px
original px
128px
resize upload notify
notify
start
resize upload notify
resize upload notify
upload
notify
end
- 41. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 41
Andere Funktionen aufrufen
256px
512px
original px
128px
upload notify
notify
start
upload notify
upload notify
upload
notify
end
resize
resize
resize
resize 128
resize 256
resize 512
- 42. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 42
Jede Funktion läuft in einem separaten Container
und bekommt automatisch die passenden Ressourcen
256px
512px
original px
128px
upload notify
notify
start
upload notify
upload notify
upload
notify
end
resize
resize
resize
resize
256
resize
128
resize
512
- 43. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 43
Wenn eine Funktion komplett beendet ist, werden ihre Ressourcen
freigegeben und der aufrufende Funktions-Thread wird ausgeführt
256px
512px
original px
128px
upload notify
notify
start
upload notify
upload notify
upload
notify
end
resize
resize
resize
resize
128
resize
512
- 44. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 44
256px
512px
original px
128px
upload notify
notify
start
upload notify
upload notify
upload
notify
end
resize
resize
resize
Jeder Funktions-Thread läuft bis zu seiner kompletten Fertigstellung
- 45. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 45
256px
512px
original px
128px
upload notify
notify
start
upload notify
upload notify
upload
notify
end
resize
resize
resize
Sind alle Threads abgearbeitet und beendet, so wird die finale Aktion ausgeführt
- 46. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. | 46
Wenn die Funktion komplett ausgeführt und beendet ist, dann
wird der Container zerstört und die Ressourcen wieder freigegeben
- 47. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
Zusammenfassung: Fn - Die Funktionsplattform
✅ Open Source — Kein Vendor-Lock-in
✅ Plattformunabhängig — Laptop, Server, Cloud
✅ Zugänglichkeit — Für Einsteiger und Fortgeschrittene
✅ Docker-basierend — Stärkt das Docker-Ökosystem
✅ Scheduler-Unabhängig — Deployment für Kubernetes, Swarm, Mesos, etc.
47
http://fnproject.io
@fnproj
slack
- 48. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
Danke!
Wolfgang Weigend
Sen. Leitender Systemberater
Java Technology and Architecture
Twitter: @wolflook
- 49. Copyright © 2018 Oracle and/or its affiliates. All rights reserved. |
Ressourcen
• http://fnproject.io/
• https://github.com/fnproject/fn
• https://github.com/fnproject/fdk-java