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.

Pivotal microservices spring_pcf_skillsmatter.pptx

568 views

Published on

Delivered by Martin McVay at Pivotal Meetup held at Skillsmatter London, 26 November 2015

Published in: Technology
  • Be the first to comment

Pivotal microservices spring_pcf_skillsmatter.pptx

  1. 1. 1© 2015 Pivotal Software, Inc. All rights reserved. 1© 2015 Pivotal Software, Inc. All rights reserved. Microservices: Why and How? Netflix OSS/Spring Cloud & Pivotal Cloud Foundry Matt Stine (@mstine) Principal Engineer & Senior Product Manager August 2015
  2. 2. 2© 2015 Pivotal Software, Inc. All rights reserved. DEFINE: Microservice Loosely coupled service oriented architecture with bounded contexts If every service has to be updated in concert, it’s not loosely coupled! If you have to know about surrounding services you don’t have a bounded context.
  3. 3. 3© 2015 Pivotal Software, Inc. All rights reserved. Not Monoliths Relational Database Data Access Service HTML JavaScript MVC Service Monolithic ApplicationBrowser
  4. 4. 4© 2015 Pivotal Software, Inc. All rights reserved. Not Traditional (ESB-centric) SOA Enterprise Service Bus Service Service Service Service Service Service Service Service UI UI
  5. 5. 5© 2015 Pivotal Software, Inc. All rights reserved. But Microservices!
  6. 6. 6© 2015 Pivotal Software, Inc. All rights reserved.
  7. 7. 7© 2015 Pivotal Software, Inc. All rights reserved.
  8. 8. 8© 2015 Pivotal Software, Inc. All rights reserved. But no Microservice is an Island…
  9. 9. 9© 2015 Pivotal Software, Inc. All rights reserved. Example Distributed System: Minified
  10. 10. 10© 2015 Pivotal Software, Inc. All rights reserved. Some emergent challenges of microservices systems… Ÿ  Configuration Management Ÿ  Service Registration & Discovery Ÿ  Routing & Load Balancing Ÿ  Fault Tolerance (Circuit Breakers!) Ÿ  Monitoring
  11. 11. 11© 2015 Pivotal Software, Inc. All rights reserved. Example: Coordination Boiler Plate
  12. 12. 12© 2015 Pivotal Software, Inc. All rights reserved. •  Eureka •  Hystrix + Turbine •  Ribbon •  Feign •  Zuul http://netflix.github.io
  13. 13. 13© 2015 Pivotal Software, Inc. All rights reserved. http://projects.spring.io/spring-cloud
  14. 14. 14© 2015 Pivotal Software, Inc. All rights reserved. Example: Spring Cloud + Netflix OSS
  15. 15. 15© 2015 Pivotal Software, Inc. All rights reserved. Config Server
  16. 16. 16© 2015 Pivotal Software, Inc. All rights reserved. Config Server + Cloud Bus
  17. 17. 17© 2015 Pivotal Software, Inc. All rights reserved. Service Registration/Discovery
  18. 18. 18© 2015 Pivotal Software, Inc. All rights reserved. Service Registration/Discovery @SpringBootApplication @EnableCircuitBreaker @EnableDiscoveryClient public class CustomerApp extends RepositoryRestMvcConfiguration { @Override protected void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) { config.exposeIdsFor(Customer.class); } public static void main(String[] args) { SpringApplication.run(CustomerApp.class, args); } }
  19. 19. 19© 2015 Pivotal Software, Inc. All rights reserved. Fault Tolerance – Circuit Breakers
  20. 20. 20© 2015 Pivotal Software, Inc. All rights reserved. Fault Tolerance – Circuit Breakers @SpringBootApplication @EnableCircuitBreaker @EnableDiscoveryClient public class CustomerApp extends RepositoryRestMvcConfiguration { @Override protected void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) { config.exposeIdsFor(Customer.class); } public static void main(String[] args) { SpringApplication.run(CustomerApp.class, args); } }
  21. 21. 21© 2015 Pivotal Software, Inc. All rights reserved. @HystrixCommand(fallbackMethod = "defaultLink") public Link getStoresByLocationLink(Map<String, Object> parameters) { URI storesUri = URI.create(uri); try { ServiceInstance instance = loadBalancer.choose("stores"); storesUri = URI.create(String.format("http://%s:%s", instance.getHost(), instance.getPort())); } catch (RuntimeException e) { // Eureka not available } Traverson traverson = new Traverson(storesUri, MediaTypes.HAL_JSON); Link link = traverson.follow("stores", "search", "by-location") .withTemplateParameters(parameters).asLink(); return link; } Enabling a Circuit Breaker Client-Side Load Balancing
  22. 22. 22© 2015 Pivotal Software, Inc. All rights reserved. { "id" : 3, "firstname" : "Matt", "lastname" : "Stine", "address" : { "street" : "9195 East Mineral Circle", "zipCode" : "80112", "city" : "Centennial", "location" : { "latitude" : 39.5738106, "longitude" : -104.8816934 } }, "_links" : { "self" : { "href" : "http://pivotalcustomers.cfapps.io/customers/3" }, "stores-nearby" : { "href" : "http://pivotalstores.cfapps.io/stores/search/ findByAddressLocationNear?location=39.5738106,-104.8816934&distance=50" } } }
  23. 23. 23© 2015 Pivotal Software, Inc. All rights reserved.
  24. 24. 24© 2015 Pivotal Software, Inc. All rights reserved. Circuit Breaker Fallback public Link defaultLink(Map<String, Object> parameters) { return null; } @HystrixCommand(fallbackMethod = "defaultLink") public Link getStoresByLocationLink(Map<String, Object> parameters) { //... }
  25. 25. 25© 2015 Pivotal Software, Inc. All rights reserved. { "id" : 3, "firstname" : "Matt", "lastname" : "Stine", "address" : { "street" : "9195 East Mineral Circle", "zipCode" : "80112", "city" : "Centennial", "location" : { "latitude" : 39.5738106, "longitude" : -104.8816934 } }, "_links" : { "self" : { "href" : "http://pivotalcustomers.cfapps.io/customers/3" } } }
  26. 26. 26© 2015 Pivotal Software, Inc. All rights reserved.
  27. 27. 27© 2015 Pivotal Software, Inc. All rights reserved. 27© Copyright 2015 Pivotal. All rights reserved. http://highscalability.com/blog/2014/4/8/microservices-not-a-free-lunch.html
  28. 28. 28© 2015 Pivotal Software, Inc. All rights reserved. Paying for your lunch… Ÿ  Significant Operations Overhead Ÿ  Substantial DevOps Skills Required Ÿ  Implicit Interfaces Ÿ  Duplication of Effort Ÿ  Distributed System Complexity Ÿ  Asynchronicity is Difficult! Ÿ  Testability Challenges
  29. 29. 29© 2015 Pivotal Software, Inc. All rights reserved. You must be this tall to use Microservices… https://www.flickr.com/photos/gusset/3723961589 •  RAPID PROVISIONING •  BASIC MONITORING •  RAPID APPLICATION DEPLOYMENT •  DEVOPS CULTURE http://martinfowler.com/bliki/MicroservicePrerequisites.html
  30. 30. 30© 2015 Pivotal Software, Inc. All rights reserved. It takes a platform… Cloud Foundry Spring Cloud Services
  31. 31. 31© 2015 Pivotal Software, Inc. All rights reserved. Cloud Foundry Features Ÿ  Environment Provisioning Ÿ  On-Demand/Automatic Scaling Ÿ  Failover/Resilience Ÿ  Routing/Load Balancing Ÿ  Data Service Operations Ÿ  Monitoring
  32. 32. 32© 2015 Pivotal Software, Inc. All rights reserved. Spring Cloud Services Suite Spring Cloud Services Config Server Service Registry Circuit Breaker Dashboard
  33. 33. 33© 2015 Pivotal Software, Inc. All rights reserved. Datastore Message Bus Circuit Breaker Load Balancer Message Bus REST Workload (Customer) Circuit Breaker Load Balancer REST Workload (Stores) Datastore Message Bus UI (Angular) Circuit Breaker Load Balancer Production Ready Proxy Service Discovery Config Server Messaging Circuit Breaker Dashboard Circuit Breaker Metric Aggregation Bind Production Ready Production Ready PCF Applications PCF Services Spring Cloud Services Suite – Logical View
  34. 34. 34© 2015 Pivotal Software, Inc. All rights reserved. Spring Cloud Services Suite •  Installed via Pivotal Ops Manager •  Adds all services to Pivotal Cloud Foundry Marketplace •  Dependencies: •  MySQL for PCF •  RabbitMQ for PCF Spring Cloud Services
  35. 35. 35© 2015 Pivotal Software, Inc. All rights reserved. App Manager Marketplace
  36. 36. 36© 2015 Pivotal Software, Inc. All rights reserved. Spring Cloud Config Server Config Server •  Spring Cloud Config Server •  Service Binding via Spring Cloud Connector •  Git/SVN URL for Config Repo provided via Service Dashboard (post- provisioning) •  Single tenant, scoped to CF space (nothing prevents shared Git repo)
  37. 37. 37© 2015 Pivotal Software, Inc. All rights reserved. Spring Cloud Config Server Dashboard
  38. 38. 38© 2015 Pivotal Software, Inc. All rights reserved. Spring Cloud Service Registry Service Registry •  Service Registration and Discovery via Netflix OSS Eureka •  Service Binding via Spring Cloud Connector •  Single-tenant, scoped to CF space •  Registration via CF Route or DEA/Cell IP:Port (must enable cross-container traffic)
  39. 39. 39© 2015 Pivotal Software, Inc. All rights reserved. Spring Cloud Service Registry Dashboard
  40. 40. 40© 2015 Pivotal Software, Inc. All rights reserved. Spring Cloud Services Suite Circuit Breaker Dashboard •  Netflix OSS Turbine + Hystrix Dashboard •  Aggregation via AMQP (RabbitMQ) •  Binding via Spring Cloud Connector •  Single-tenant, scoped to CF space
  41. 41. 41© 2015 Pivotal Software, Inc. All rights reserved. Spring Cloud Services Roadmap Ÿ  Opinionated RBAC via OAuth2 / Integration with PCF UAA Ÿ  Spring Cloud Bus Refresh/Restart (as a Service) Ÿ  Spring Cloud Config Server Encryption/Decryption Ÿ  Policy-based Inter-org/space Service Discovery Ÿ  Distributed Tracing Ÿ  Spring Cloud Dataflow (Spring XD 2.0) Ÿ  API Gateway / Management (as a Service) Ÿ  Polyglot Language Support (via Sidecar) Ÿ  .NET Support (Native Bindings)
  42. 42. 42© 2015 Pivotal Software, Inc. All rights reserved. Policy-based Inter-org/space Service Discovery
  43. 43. 43© 2015 Pivotal Software, Inc. All rights reserved. μServices with Bindable Services In-App Support Libraries BETA MAY 2015
  44. 44. 44© 2015 Pivotal Software, Inc. All rights reserved. Published March 16, 2015 Available to you compliments of Pivotal! http://bit.ly/cloud-native-book

×