Serverless and Servicefull
Where Microservices compliments Serverless
@burrsutter burr@redhat.com
bit.ly/serverlessjuly2018
Link
Demo: bit.ly/msa-instructions
Slides: bit.ly/microservicesdeepdive
Video Training: bit.ly/microservicesvideo
Free eBooks from developers.redhat.com
bit.ly/reactivemicroservicesbookbit.ly/javamicroservicesbook
Microservices Introductory
Materials
@burrsutter
Advanced Materials
bit.ly/istio-tutorial
bit.ly/serverlessjuly2018
Kubernetes for Java Developers
learn.openshift.com/servicemesh
bit.ly/faas-tutorial
learn.openshift.com/serverless
bit.ly/mono2microdb
@burrsutter
bit.ly/istio-book
@burrsutter
“Our ancestors called it
magic, but you call it
[computer] science.
I come from a land where
they are one and the same.”
—THOR
Monolith
MyApp
@burrsutter
Modules
@burrsutter
Microservices
@burrsutter
Microservices
@burrsutter
Microservices
@burrsutter
Microservices
@burrsutter
Microservices
@burrsutter
Network of Services - Mesh
@burrsutter
Microservices own their Data
@burrsutter
Multiple Points of Entry
@burrsutter
MyService
Monitoring
Tracing
API
Discovery
Invocation
Resilience
Pipeline
Authentication
Logging Elasticity
Microservices'ilities + Istio
@burrsutter
“Change is the essential
process of all of existence.”
—SPOCK
Let there be Functions
@burrsutter
Short History of Serverless
* Only supports JavaScript
Only for stateless, short-lived, simple applications
AWS
S3
March
2006
AWS
Lambda
November
2014 *
AWS
EC2
August
2006
Serverless
Described
Thoughtworks
August 2016
Serverless
Coined
October
2012
Serverless
Assess
Thoughtworks
Radar
April 2016
AWS
Dynamo
DB
January
2012
Firebase
September
2011
Iron.io
July
2011
Google
Cloud
Function
Feb 2016
Azure
Functions
Mar 2016
Pivotal
Function
Service
Dec 2017
Oracle
Functions
Sept 2016
IBM
Bluemix
OpenWhisk
Feb 2016
Oracle
Fn Project
Oct 2017
@burrsutter
Keynote Demo 2018
@burrsutter
https://youtu.be/hu2BmE1Wk_Q?t=477
Microservices Serverless
Functions
Your Control
Long-Lived Processes
Known Programming Model
Often Sync Request-Response
Mature:
IDE Integration
Debuggers
Tracers
Monitoring
CI/CD
Cloud Control
Short-Lived Processes
New Programming Model
Event-Driven Async
Immature:
?
@burrsutter
The first question is “is there a suitable service I can
consume?” before “is there something I can buy and
set up using a cloud provider?”.
Thoughtworks Nov 29 2017
@burrsutter
@burrsutter
It is Serverless, because of SaaS
(managed by another party services).
Serverless Defined
Serverless architectures refer to applications that significantly depend on third-party
services (knows as Backend as a Service or "BaaS") or on custom code that's run in
ephemeral containers (Function as a Service or "FaaS"), the best known vendor host of
which currently is AWS Lambda. By using these ideas, and by moving much behavior to the
front end, such architectures remove the need for the traditional 'always on' server system
sitting behind an application. Depending on the circumstances, such systems can significantly
reduce operational cost and complexity at a cost of vendor dependencies and (at the
moment) immaturity of supporting services.
https://martinfowler.com/articles/serverless.html
@burrsutter
It is all about the Services
@burrsutter
API
Gateway
-as-a-
Service
HTTP Input/Output Service
@burrsutter
API
Gateway
-as-a-
Service
SSO-as-a-
Service
A
P
I
Authentication Service
@burrsutter
Storage-as-a-Service
A
P
I
API
Gateway
-as-a-
Service
SSO-as-a-
Service
A
P
I
File Storage Service
@burrsutter
Storage-as-a-Service
A
P
I
API
Gateway
-as-a-
Service
Cache-as-a-
Service
API
DB-as-a-
Service
API
SSO-as-a-
Service
A
P
I
Data Services
@burrsutter
Storage-as-a-Service
A
P
I
API
Gateway
-as-a-
Service
Messaging
-as-a-
Service
A
P
I
Cache-as-a-
Service
API
DB-as-a-
Service
API
Notifications
-as-a-
Service
A
P
I
A
P
I
SSO-as-a-
Service
A
P
I
Connectivity Services
@burrsutter
Storage-as-a-Service
A
P
I
API
Gateway
-as-a-
Service
My
Microservice
A
My
Microservice
B
My
Microservice
C
Messaging
-as-a-
Service
A
P
I
Cache-as-a-
Service
API
DB-as-a-
Service
API
Notifications
-as-a-
Service
A
P
I
A
P
I
SSO-as-a-
Service
A
P
I
Your Containerized Services
@burrsutter
Storage-as-a-Service
A
P
I
API
Gateway
-as-a-
Service
My
Microservice
A
Function
1
My
Microservice
B
My
Microservice
C
Function
2
Function
3
Function
4
Messaging
-as-a-
Service
A
P
I
Cache-as-a-
Service
API
DB-as-a-
Service
API
Notifications
-as-a-
Service
A
P
I
A
P
I
SSO-as-a-
Service
A
P
I
Event-Driven Input
Function
5
@burrsutter
Storage-as-a-Service
A
P
I
API
Gateway
-as-a-
Service
My
Microservice
A
Function
1
My
Microservice
B
My
Microservice
C
Function
2
Function
3
Function
7
Function
4
Function
6
Messaging
-as-a-
Service
A
P
I
Cache-as-a-
Service
API
DB-as-a-
Service
API
Notifications
-as-a-
Service
A
P
I
A
P
I
SSO-as-a-
Service
A
P
I
Event-Driven Output
Function
5
@burrsutter
Storage-as-a-Service
A
P
I
API
Gateway
-as-a-
Service
My
Microservice
A
Function
1
My
Microservice
B
My
Microservice
C
Function
2
Function
3
Function
7
Function
4
Function
6
Messaging
-as-a-
Service
A
P
I
Cache-as-a-
Service
API
DB-as-a-
Service
API
Notifications
-as-a-
Service
A
P
I
A
P
I
SSO-as-a-
Service
A
P
I
Synergy
Function
5
@burrsutter
FaaS Kubernetes Players
Business Logic
Application
Data
Containers
OS
Virtualization
Server, Storage,
Network
Container
as a Service
Business Logic
Application
Data
Runtime
OS
Virtualization
Server, Storage,
Network
Infrastructure as
a Service
Business Logic
Application
Data
Containers
OS
Virtualization
Server, Storage,
Network
Platform
as a Service
Business Logic
Application
Data
Containers
OS
Virtualization
Server, Storage,
Network
Backend
as a Service
Business Logic
Application
Data
Containers
OS
Virtualization
Server, Storage,
Network
Function
as a Service
Platform Responsibilities
Business Logic
Application
Data
Runtime
OS
Virtualization
Server, Storage,
Network
On Premises
@burrsutter
Apache OpenWhisk
● Open Source incubating under Apache
● A FaaS platform to execute functions written in:
○ JavaScript
○ Swift
○ Java
○ Python
○ PHP
○ Docker
○ Go
● Deployable on
○ Any platform where docker can be run
○ Kubernetes/OpenShift
Terms
● Actions
○ A stateless code snippet that gets executed (aka Functions)
● Package
○ A bundle of actions and feeds synonymous to Java Packages
● Feeds
○ Acts as Interface between external Event Sources and OpenWhisk Actions
● Triggers
○ Stimulus of external Events via Feeds
● Rules
○ Ties one or more Triggers to an Action or vice-versa
● Activation
○ Records the output/response of Running/Ran actions
@burrsutter
Action (aka Function) JavaScript
function main(params) {
console.log("JS msgaction args: %j", params);
Object.keys(params["body"]).forEach(function(key) {
console.log("%s: %j", key, params["body"][key])
});
return { payload: 'JavaScript on OpenWhisk on OpenShift ' + params.body.text};
}
wsk -i action update msgaction msgaction.js
wsk -i action invoke msgaction --param body '{"text":"my stuff"}' --result
{ “payload”: “JavaScript OpenWhisk on OpenShift my stuff” }
wsk -i activation get -l # see the details, logs
@burrsutter
Action (aka Function) Python
def main(params):
print "Py msgaction params: " + str(params)
for key in params["body"]:
print key, params["body"][key]
return { "payload" :
"Python on OpenWhisk on OpenShift " + str(params["body"]["text"])}
wsk -i action update msgaction msgaction.py
wsk -i action invoke msgaction --param body '{"text":"my stuff"}' --result
{ “payload”: “Python on OpenWhisk on OpenShift my stuff” }
wsk -i activation get -l # see the details, logs
@burrsutter
Action (aka Function) Java
public static JsonObject main(JsonObject params) {
System.out.println("msgaction params: " + params);
JsonObject body = params.get("body").getAsJsonObject();
for (Map.Entry<String, JsonElement> entry : body.entrySet()) {
System.out.println(entry.getKey() + " " + entry.getValue().getAsJsonPrimitive().getAsString());
}
JsonObject response = new JsonObject();
response.addProperty("payload", "Java on OpenWhisk on OpenShift " +
params.getAsJsonObject("body").get("text").getAsString());
return response;
}
wsk -i action update msgaction target/actionjava.jar --main com.example.FunctionApp
wsk -i action invoke msgaction --param body '{"text":"my stuff"}' --result
{ “payload”: “Java on OpenWhisk on OpenShift my stuff” }
wsk -i activation get -l # see the details, logs
mvn clean package
maven archetype
mvn archetype:generate 
-DarchetypeGroupId=org.apache.openwhisk.java 
-DarchetypeArtifactId=java-action-archetype 
-DarchetypeVersion=1.0-SNAPSHOT 
-DgroupId=com.example 
-DartifactId=actionjava 
-Dversion=1.0-SNAPSHOT 
-DinteractiveMode=false
bit.ly/faas-tutorial
learn.openshift.com/serverless
@burrsutter
OpenWhisk
On
OpenShift
(bit.ly/faas-tutorial)
@burrsutter
Cloudevents
https://cloudevents.io/
The lack of a common way of describing events means developers must constantly
re-learn how to receive events. This also limits the potential for libraries, tooling and
infrastructure to aide the delivery of event data across environments, like SDKs, event
routers or tracing systems. The portability and productivity we can achieve from event
data is hindered overall.
Serverless and Servicefull
Where Microservices compliments Serverless
@burrsutter burr@redhat.com
bit.ly/serverlessjuly2018
Link

Serverless and serverfull - where microservices compliments serverless