Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Serverless and Servicefull Applications - Where Microservices complements Serverless

579 views

Published on

Serverless is a misnomer, your future cloud native applications will consist of both microservices and functions, wrapped as Linux containers, but in many cases where you the developer ignore the operational aspects of managing that infrastructure. In this session we get started using Function as a Service (FaaS) engine with Apache OpenWhisk deployed on Kubernetes and OpenShift. With Kubernetes/OpenShift being de-facto platform for Cloud Native Java Applications, we will explore on to see how to make Cloud Native Java Applications a.k.a Microservices can complement the serverless Functions. This technical intensive session will open up one of the possible serverless web application architecture where we deploy an API Gateway into the FaaS platform to draw the curtains up to see the microservices talking to the serverless functions. This session ends with us seeing how Event Sinks and Event Sources map in the Serverless World.

Published in: Software
  • Be the first to comment

Serverless and Servicefull Applications - Where Microservices complements Serverless

  1. 1. Serverless and Servicefull Where Microservices compliments Serverless @burrsutter burr@redhat.com bit.ly/dnl_serverfull
  2. 2. 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/dnl_serverfull Kubernetes for Java Developers learn.openshift.com/servicemesh bit.ly/faas-tutorial learn.openshift.com/serverless
  3. 3. bit.ly/mono2microdb @burrsutter
  4. 4. bit.ly/istio-book @burrsutter
  5. 5. Keynote Demo 2018 @burrsutter https://youtu.be/hu2BmE1Wk_Q?t=477
  6. 6. “Our ancestors called it magic, but you call it [computer] science. I come from a land where they are one and the same.” —THOR
  7. 7. Monolith MyApp @burrsutter
  8. 8. Modules @burrsutter
  9. 9. Microservices @burrsutter
  10. 10. Microservices @burrsutter
  11. 11. Microservices @burrsutter
  12. 12. Microservices @burrsutter
  13. 13. Microservices @burrsutter
  14. 14. Network of Services - Mesh @burrsutter
  15. 15. Microservices own their Data @burrsutter
  16. 16. Multiple Points of Entry @burrsutter
  17. 17. Microservices embedding Capabilities @burrsutter Container JVM Service B Discovery Load-balancer Resiliency Metrics Tracing Container JVM Service A Discovery Load-balancer Resiliency Metrics Tracing Container JVM Service C Discovery Load-balancer Resiliency Metrics Tracing Before Istio
  18. 18. Microservices externalizing Capabilities @burrsutter Pod Container JVM Service A Sidecar Container Pod Container JVM Service C Sidecar Container Pod Container JVM Service B Sidecar Container After Istio
  19. 19. Failure of a Service @burrsutter X
  20. 20. Cascading Failure @burrsutter X X X X X X X
  21. 21. MyService Monitoring Tracing API Discovery Invocation Resilience Pipeline Authentication Logging Elasticity Microservices'ilities + Istio @burrsutter
  22. 22. “Change is the essential process of all of existence.” —SPOCK
  23. 23. Let there be Functions @burrsutter
  24. 24. 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
  25. 25. 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
  26. 26. @burrsutter It is Serverless, because of SaaS (managed by another party services).
  27. 27. 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
  28. 28. It is all about the Services @burrsutter
  29. 29. API Gateway -as-a- Service HTTP Input/Output Service @burrsutter
  30. 30. API Gateway -as-a- Service SSO-as-a- Service A P I Authentication Service @burrsutter
  31. 31. Storage-as-a-Service A P I API Gateway -as-a- Service SSO-as-a- Service A P I File Storage Service @burrsutter
  32. 32. 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
  33. 33. 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
  34. 34. 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
  35. 35. 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
  36. 36. 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
  37. 37. 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
  38. 38. FaaS Kubernetes Players
  39. 39. 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
  40. 40. 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
  41. 41. 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
  42. 42. 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
  43. 43. 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
  44. 44. 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
  45. 45. 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
  46. 46. OpenWhisk On OpenShift (bit.ly/faas-tutorial) @burrsutter
  47. 47. Serverless and Servicefull Where Microservices compliments Serverless @burrsutter burr@redhat.com bit.ly/dnl_serverfull

×