{
"name": "Vidyasagar Machupalli",
"website": "http: //vidyasagarmsc.com",
"tweets": "@VidyasagarMSC”
}
§Team size
§Lines of code
§Number of API/EndPoints
MicroService
§ Many smaller (fine grained), clearly scoped services
§ Single Responsibility Principle
§ Domain Driven Development
§ Bounded Context
§ Independently Managed
§ Clear ownership for each service
§ Typically need/adopt the “DevOps” model
Attribution: Adrian Cockroft, Martin Fowler …
VS
monolith microservices
PRESENTATION LAYER
BUSINESS LOGIC LAYER
DATABASE LAYER
A monolith Module
A
Module
B
Module
c
Module
D
VS
monolith microservices
PRESENTATION LAYER
BUSINESS LOGIC LAYER
DATABASE LAYER
microservices
API API
BUSINESS LOGIC
LAYER
DATABASE LAYER
consume
Produce
Microservice 1
Microservice 2
Comparing Monolithic to MicroServices
Swift
Application
Container VMCF
2
Direct
Request
1b
Polling
1a
§ Worry about scaling
§ When to scale? (mem-, cpu-, response time-, etc. driven?)
§ How fast can you scale?
§ Worry about resiliency & cost
§ At least 2 processes for HA
§ Keep them running & healthy
§ Deployment in multiple regions
§ Charged even when idling / not 100% utilized
§ Continous polling due to missing event programming
model
Region BRegion A
12
Monolithic application
Break-down into microservices,
e.g. one container per
microservice
Make each micro service HA
Protect against regional outage
Explosion of # of containers /
processes!
à Increase of infrastructure cost
footprint
à Increase of operational mgmt cost &
complexity
§ Scales inherently
§ One process per request
§ No cost overhead for resiliency
§ No long running process to be made HA / multi-region
§ Introduces event programming model
§ Charges only for what is used
§ Only worry about code
à dev velocity, lower operational costs
Registered actions
Swift DockerJS
Event
1a
Running
action
Running
action
Running
action
3
Deploy action within millisecs,
run it,
free up resources
OpenWhisk
Engine
2
PythonJava
0
Direct
Request
1b
a cloud-native platform
for
short-running, stateless computation
and
event-driven applications
which
scales up and down instantly, automatically, and transparently
and
charges at a millisecond granularity
14
15
Serverless (aka Functions-aaS) =
consuming compute on a per-request basis
16
Short answer:
Besides
a) making app development & ops dramatically faster, cheaper, easier (but different J ), it
b) Drives infrastructure cost savings
(yes – this has been true for most IT innovations over the last decades, while serverless potentially
introduces another step-function change)
17
* work in progress
} 1
Event Providers
Cloudant
Push Notifcations
Kafka*
…
…
Data event occurs, e.g.
-Commit on a Git Repository
-CRUD operation on Cloudant
-….
…
OpenWhisk
Trigger execution
of associated
OpenWhisk action
2
Swift DockerJS Python Java*
Incoming HTTP request, e.g. HTTP GET
openwhisk.ng.bluemix.net/api/v1/<namespace>/actions/getCustomers
1
Browser
Mobile App
Web App
OpenWhisk
2 Invoke associated
OpenWhisk action
„getCustomers“
Swift DockerJS Python Java*
Variety of
languages
* work in progress
§ Microservices-based apps / APIs
§ Mobile Backends
§ Data (Stream) Processing
§ IoT
§ Cognitive
§ Bots
21
22
§ Services define the events they emit as triggers, and developers associate the
actions to handle the events via rules
§ Actions: JSON as in- and output
§ The developer only needs to care about implementing the desired application
logic - the system handles the rest
T R A
Node 0.12 and 6 supported
function main(msg) {
return { message: 'Hello, ' + msg.name + ' from ' + msg.place };
};
Swift v2 & v3 supported
func main(params:[String:Any]) -> [String:Any] {
var reply = [String:Any] ()
if let name = params[“name”] as? String {
print(“Hello (name)”)
reply[“msg”] = “Goodbye (name)”
}
return reply
}
26
import sys
def main(dict):
if 'message' in dict:
name = dict['message']
else:
name = 'stranger'
greeting = 'Hello ' + name + '!'
print(greeting)
return {'greeting':greeting}
Actions: Can be chained to create sequences to increase flexibility and foster reuse
A
AA
:= A1
+ A2
+ A3
AB
:= A2
+ A1
+ A3
AC
:= A3
+ A1
+ A2
Rules: „An association of a trigger and an action“
R
R := T A
30
§ Bluemix UI
§ CLI
§ iOS SDK
§ REST API
31
32
https://console.ng.bluemix.net/apidocs/98?&language=node#introduction
33
https://console.ng.bluemix.net/docs/openwhisk/openwhisk_mobile_sdk.html
Microservices and Serverless Computing - OpenWhisk

Microservices and Serverless Computing - OpenWhisk

  • 1.
    { "name": "Vidyasagar Machupalli", "website":"http: //vidyasagarmsc.com", "tweets": "@VidyasagarMSC” }
  • 3.
    §Team size §Lines ofcode §Number of API/EndPoints MicroService
  • 4.
    § Many smaller(fine grained), clearly scoped services § Single Responsibility Principle § Domain Driven Development § Bounded Context § Independently Managed § Clear ownership for each service § Typically need/adopt the “DevOps” model Attribution: Adrian Cockroft, Martin Fowler …
  • 5.
  • 6.
    PRESENTATION LAYER BUSINESS LOGICLAYER DATABASE LAYER A monolith Module A Module B Module c Module D
  • 7.
  • 8.
    PRESENTATION LAYER BUSINESS LOGICLAYER DATABASE LAYER microservices API API BUSINESS LOGIC LAYER DATABASE LAYER consume Produce Microservice 1 Microservice 2
  • 9.
  • 11.
    Swift Application Container VMCF 2 Direct Request 1b Polling 1a § Worryabout scaling § When to scale? (mem-, cpu-, response time-, etc. driven?) § How fast can you scale? § Worry about resiliency & cost § At least 2 processes for HA § Keep them running & healthy § Deployment in multiple regions § Charged even when idling / not 100% utilized § Continous polling due to missing event programming model
  • 12.
    Region BRegion A 12 Monolithicapplication Break-down into microservices, e.g. one container per microservice Make each micro service HA Protect against regional outage Explosion of # of containers / processes! à Increase of infrastructure cost footprint à Increase of operational mgmt cost & complexity
  • 13.
    § Scales inherently §One process per request § No cost overhead for resiliency § No long running process to be made HA / multi-region § Introduces event programming model § Charges only for what is used § Only worry about code à dev velocity, lower operational costs Registered actions Swift DockerJS Event 1a Running action Running action Running action 3 Deploy action within millisecs, run it, free up resources OpenWhisk Engine 2 PythonJava 0 Direct Request 1b
  • 14.
    a cloud-native platform for short-running,stateless computation and event-driven applications which scales up and down instantly, automatically, and transparently and charges at a millisecond granularity 14
  • 15.
    15 Serverless (aka Functions-aaS)= consuming compute on a per-request basis
  • 16.
    16 Short answer: Besides a) makingapp development & ops dramatically faster, cheaper, easier (but different J ), it b) Drives infrastructure cost savings (yes – this has been true for most IT innovations over the last decades, while serverless potentially introduces another step-function change)
  • 17.
  • 18.
    * work inprogress } 1 Event Providers Cloudant Push Notifcations Kafka* … … Data event occurs, e.g. -Commit on a Git Repository -CRUD operation on Cloudant -…. … OpenWhisk Trigger execution of associated OpenWhisk action 2 Swift DockerJS Python Java*
  • 19.
    Incoming HTTP request,e.g. HTTP GET openwhisk.ng.bluemix.net/api/v1/<namespace>/actions/getCustomers 1 Browser Mobile App Web App OpenWhisk 2 Invoke associated OpenWhisk action „getCustomers“ Swift DockerJS Python Java* Variety of languages * work in progress
  • 20.
    § Microservices-based apps/ APIs § Mobile Backends § Data (Stream) Processing § IoT § Cognitive § Bots
  • 21.
  • 22.
  • 23.
    § Services definethe events they emit as triggers, and developers associate the actions to handle the events via rules § Actions: JSON as in- and output § The developer only needs to care about implementing the desired application logic - the system handles the rest T R A
  • 24.
    Node 0.12 and6 supported function main(msg) { return { message: 'Hello, ' + msg.name + ' from ' + msg.place }; };
  • 25.
    Swift v2 &v3 supported func main(params:[String:Any]) -> [String:Any] { var reply = [String:Any] () if let name = params[“name”] as? String { print(“Hello (name)”) reply[“msg”] = “Goodbye (name)” } return reply }
  • 26.
    26 import sys def main(dict): if'message' in dict: name = dict['message'] else: name = 'stranger' greeting = 'Hello ' + name + '!' print(greeting) return {'greeting':greeting}
  • 28.
    Actions: Can bechained to create sequences to increase flexibility and foster reuse A AA := A1 + A2 + A3 AB := A2 + A1 + A3 AC := A3 + A1 + A2
  • 29.
    Rules: „An associationof a trigger and an action“ R R := T A
  • 30.
  • 31.
    § Bluemix UI §CLI § iOS SDK § REST API 31
  • 32.
  • 33.