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.

Resilient Microservices with Spring Cloud

355 views

Published on

Spring Connect Charlotte
Resilient Microservices with Spring Cloud
Speaker: Abhinav Rau

Published in: Software
  • Be the first to comment

Resilient Microservices with Spring Cloud

  1. 1. © Copyright 2018 Pivotal Software, Inc. All rights Reserved. Abhinav Rau Senior Platform Architect @ Pivotal @abhinavrau https://github.com/abhinavrau Resilient Microservices with Spring Cloud
  2. 2. Tacoma Narrows Bridge
  3. 3. Cover w/ ImageCloud Native ?
  4. 4. Cloud Native Cloud Resilient Cloud Friendly Cloud Ready Cloud Native Criteria
  5. 5. Cloud Ready ! No file system requirements ! Containerized ! Platform managed addresses and ports ! Consume Platform services
  6. 6. Cloud Friendly ! 12 Factor apps ! Horizontally scalable ! Leverage platform for HA
  7. 7. Cloud Resilient ! Design for failure ! Apps are unaffected by dependent service failure ! Proactive testing for failure ! Metrics and monitoring baked in ! Cloud agnostic runtime implementation
  8. 8. Cloud Native ! Microservice Architecture ! API first design
  9. 9. Cloud Native Cloud Resilient Cloud Friendly Cloud Ready ! Microservice Architecture ! API first design ! Design for failure ! Apps are unaffected by dependent service failure ! Proactive testing for failure ! Metrics and monitoring baked in ! Cloud agnostic runtime implementation ! 12 Factor apps ! Horizontally scalable ! Leverage platform for HA ! No file system requirements ! Containerized ! Platform managed addresses and ports ! Consume Platform services Cloud Native Criteria
  10. 10. Cloud Resilient
  11. 11. Spring Cloud Simple and accessible programming model for the most common distributed systems and microservice patterns ! Service Discovery ! Config Management ! Circuit Breakers ! Gateways, Tracing ! AWS, GCP, AZure, K8s ! And more... Spring & Spring Boot The world’s #1 enterprise Java application development framework and the leading quickstart microservices engine 
 ! IoC / Dependency Injection ! AOP, Data, Transactions ! HTTP, REST, Reactive, Sockets ! Build, Test, Integrate, Run ! Instrumentation, Scheduling ! And more... Build Anything Coordinate Anything INCLUDES INCLUDES Spring Cloud Data Flow Cloud native connectors and data orchestration pipelines for the most common integration scenarios 
 ! Many, many connectors ! Stream & batch processing ! Host on PCF (PAS & PKS) & K8s ! Simple Spring Flow UI ! Metrics, Health, Insights ! And more... Connect Anything INCLUDES
  12. 12. Demo
  13. 13. Recap
  14. 14. Spring Cloud Service Discovery
  15. 15. Spring Cloud Service Discovery
  16. 16. Cover w/ Image Spring Cloud Service Discovery ■ Key tenets of microservice based architecture ■ Provides HTTP interface + client libs for client registry and discovery ■ Different implementations based on the underlying platform. ■ Support for Netflix Eureka and K8s
  17. 17. 1. Register 2. Discover 3. Connect Service Discovery
  18. 18. @SpringBootApplication @EnableDiscoveryClient public class MyClientApp{ public static void main(String[] args) { SpringApplication.run(MyClientApp.class, args); } } Service Discovery
  19. 19. public Portfolio accountLookup(String acctId) { Portfolio p = restTemplate.getForObject( “http://portfolio-service/portfolio/{accId}”, Portfolio.class acctId); return p; } Service Discovery
  20. 20. Spring Cloud Circuit Breaker
  21. 21. Cover w/ Image ■ Stop cascading failures in a Distributed System ■ Fail fast and Rapidly recoverLoad shedding and failing fast ■ Near realtime monitoring, alerting and operational control ■ Fallback and gracefully degrade when possible Spring Cloud Circuit Breaker
  22. 22. Spring Cloud Circuit Breaker
  23. 23. @SpringBootApplication @EnableDiscoveryClient @EnableCircuitBreaker public class MyClientApp{ public static void main(String[] args) { SpringApplication.run(MyClientApp.class, args); } } Spring Cloud Circuit Breaker
  24. 24. Spring Cloud Circuit Breaker
  25. 25. Spring Cloud Gateway
  26. 26. Microservices without gateway
  27. 27. Microservices without gateway
  28. 28. Microservices without gateway
  29. 29. Microservices without gateway
  30. 30. Spring Cloud Gateway
  31. 31. Cover w/ Image ■ Routing ■ Resiliency ■ Security ■ Monitoring ■ Rate Limiting ■ Path Rewriting Spring Cloud Gateway Use Cases
  32. 32. Cover w/ Image ■ Spring Cloud Discovery Client Integration ■ Circuit Breaker Integration ■ Built on Reactor, Spring Boot ■ Supports ■ YAML based Config ■ Java Fluent API Spring Cloud Gateway Features
  33. 33. K8s Demo
  34. 34. Spring Cloud Kubernetes
  35. 35. Cover w/ Image ■ Hot reload of ConfigMap/Secrets ■ Map Spring config support with ConfigMap: @Values, @ConfigurationProperties ■ Native Service Discovery without using an Eureka instance ■ DiscoveryClient uses Kubernetes DNS resolver and cluster events ■ Use @LoadBalanced and LoadBalancerClient for client-side load balancing across running pods ■ Spring Cloud Circuit breaker support (Hystrix and Resilience4j) Spring Cloud Kubernetes
  36. 36. Under the Covers
  37. 37. Cover w/ Image Use it Existing Spring Cloud apps Uses client side load balancing Uses Discovery Client Is OK to use the Kubernetes API server directly Maybe not for you (coz I like writing YAML!) Just planning on running only on Kubernetes Familiar with Kubernetes Should I use Spring Cloud K8s?
  38. 38. Cover w/ Image ■ Spring Cloud Gateway ■ Spring Cloud Service Discovery ■ Spring Cloud Circuit Breaker ■ Spring Cloud Kubernetes What we covered
  39. 39. Cloud Resilient ! Design for failure ! Apps are unaffected by dependent service failure ! Proactive testing for failure ! Metrics and monitoring baked in ! Cloud agnostic runtime implementation
  40. 40. Cover w/ Image ■ Revolutionized design of bridges by using reinforced concrete and arches ■ Always validated his design by conducting Full-Scale Load Tests ■ Emphasized learning from past Designs https://en.wikipedia.org/wiki/Robert_Maillart Robert Maillart
  41. 41. Learn Build Measure
  42. 42. ■ Code based on S1P presentation by Ryan Baxter and Alex Roman ■ Code for Demo https://github.com/abhinavrau/spring-cloud-k8s-demo ■ Neal Ford presentation of “Stories every developer should know ■ Spring Cloud Projects: https://spring.io/projects/spring-cloud
  43. 43. Transforming How The World Builds Software © Copyright 2019 Pivotal Software, Inc. All rights Reserved.

×