Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.
© mimacom
Microservices with
Spring and Cloud
Foundry
Alain Sahli
© mimacom 30.03.2015
Agenda
• Introduction
• Microservices architecture
• Spring Cloud components
• Demo
© mimacom 30.03.2015
GitHub Builds & Deploys
Source: https://github.com/blog/1241-deploying-at-github
© mimacom 30.03.2015
GitHub Builds & Deploys
Source: https://github.com/blog/1241-deploying-at-github
175 deploys!
© mimacom 30.03.2015
Microservices
© mimacom 30.03.2015
Microservices
LB
© mimacom 30.03.2015
Microservices
© mimacom 30.03.2015
Microservices
© mimacom 30.03.2015
Communication Between Services
© mimacom 30.03.2015
Communication Between Services
© mimacom 30.03.2015
Communication Between Services
© mimacom 30.03.2015
Communication Between Services
© mimacom 30.03.2015
Service Discovery cont’d
© mimacom 30.03.2015
Service Discovery cont’d
© mimacom 30.03.2015
Service Discovery cont’d
© mimacom 30.03.2015
Client-Side Load Balancing
© mimacom 30.03.2015
Client-Side Load Balancing
LB
© mimacom 30.03.2015
Resiliency
© mimacom 30.03.2015
Resiliency
© mimacom 30.03.2015
Circuit Breaker
© mimacom 30.03.2015
Circuit Breaker
© mimacom 30.03.2015
Circuit Breaker
1x every minute
© mimacom 30.03.2015
API Gateway
Browser
© mimacom 30.03.2015
API Gateway
Browser
© mimacom 30.03.2015
Handling Configuration
© mimacom 30.03.2015
Handling Configuration
© mimacom 30.03.2015
Handling Configuration
© mimacom 30.03.2015
Handling Configuration
© mimacom 30.03.2015
Summary
© mimacom 30.03.2015
Summary
• Service discovery: Netflix Eureka
© mimacom 30.03.2015
Summary
• Service discovery: Netflix Eureka
• Client-side load balancing: Netflix Ribbon
© mimacom 30.03.2015
Summary
• Service discovery: Netflix Eureka
• Client-side load balancing: Netflix Ribbon
• Circuit br...
© mimacom 30.03.2015
Summary
• Service discovery: Netflix Eureka
• Client-side load balancing: Netflix Ribbon
• Circuit br...
© mimacom 30.03.2015
Summary
• Service discovery: Netflix Eureka
• Client-side load balancing: Netflix Ribbon
• Circuit br...
© mimacom 30.03.2015
Spring IO
CLOUD
SERVICE REGISTRY,

CIRCUIT BREAKER, METRICS
CORE
FRAMEWORK SECURITY GROOVY REACTOR
IO...
© mimacom 30.03.2015
Spring Boot: Short Introduction
© mimacom 30.03.2015
Spring Boot: Short Introduction
“Takes an opinionated view of building
production-ready Spring applic...
© mimacom 30.03.2015
Spring Boot: Short Introduction
• Create standalone Spring applications
• Provide opinionated “starte...
© mimacom 30.03.2015
Spring Boot: Key Features
© mimacom 30.03.2015
Spring Boot: Key Features
MyApplication.java:
@SpringBootApplication
public class EurekaServer {
publ...
© mimacom 30.03.2015
Spring Boot: Key Features
MyApplication.java:
@SpringBootApplication
public class EurekaServer {
publ...
© mimacom 30.03.2015
Spring Boot: Key Features
MyApplication.java:
@SpringBootApplication
public class EurekaServer {
publ...
© mimacom 30.03.2015
Spring Cloud
Bus
Connectors
Starters
Amazon Web
Services
Config
Cloud Foundry
Netflix
CLI
© mimacom 30.03.2015
Spring Cloud
Bus
StartersConfig
Cloud Foundry
Netflix
© mimacom 30.03.2015
Spring Cloud Config: Server
Spring Cloud
Config Server
GIT
SVN
File
© mimacom 30.03.2015
Spring Cloud Config: Server
Spring Cloud
Config Server
GIT
SVN
File
ConfigServer.java:
@SpringBootApp...
© mimacom 30.03.2015
Spring Cloud Config: Server
Spring Cloud
Config Server
GIT
SVN
File
ConfigServer.java:
@SpringBootApp...
© mimacom 30.03.2015
Spring Cloud Config: Client
Spring Cloud
Config Server
Application
Spring Cloud
Config Client
Applica...
© mimacom 30.03.2015
Spring Cloud Config: Client
Spring Cloud
Config Server
Application
Spring Cloud
Config Client
Applica...
© mimacom 30.03.2015
Spring Cloud Bus
Spring Cloud
Config Server
Application
Application
Application
© mimacom 30.03.2015
Spring Cloud Netflix: Eureka
Spring Cloud
Eureka Server
Application
Spring Cloud
Eureka Client
Applic...
© mimacom 30.03.2015
Spring Cloud Netflix: Eureka
Spring Cloud
Eureka Server
Application
Spring Cloud
Eureka Client
Applic...
© mimacom 30.03.2015
Spring Cloud Netflix: Eureka
Spring Cloud
Eureka Server
Application
Spring Cloud
Eureka Client
Applic...
© mimacom 30.03.2015
Spring Cloud Netflix: Ribbon
© mimacom 30.03.2015
Spring Cloud Netflix: Ribbon
RibbonSample.java:
public class RibbonSample {
@Autowired
private RestTe...
© mimacom 30.03.2015
Spring Cloud Netflix: Zuul
© mimacom 30.03.2015
Spring Cloud Netflix: Zuul
ApiGateway.java:
@SpringBootApplication
@EnableZuulProxy
public class ApiG...
© mimacom 30.03.2015
Spring Cloud Netflix: Zuul
ApiGateway.java:
@SpringBootApplication
@EnableZuulProxy
public class ApiG...
© mimacom 30.03.2015
Spring Cloud Netflix: Hystrix
© mimacom 30.03.2015
Spring Cloud Netflix: Hystrix
PentagonApplication.java:
@SpringBootApplication
@EnableHystrix
public ...
© mimacom 30.03.2015
Spring Cloud Netflix: Hystrix
PentagonApplication.java:
@SpringBootApplication
@EnableHystrix
public ...
© mimacom 30.03.2015
Spring Cloud Netflix: Hystrix
PentagonApplication.java:
@SpringBootApplication
@EnableHystrix
public ...
© mimacom 30.03.2015
Spring Cloud Netflix: Hystrix
PentagonApplication.java:
@SpringBootApplication
@EnableHystrix
public ...
© mimacom 30.03.2015
Spring Cloud Netflix: Hystrix Dashboard
© mimacom 30.03.2015
Spring Cloud Netflix: Turbine
Turbine
© mimacom 30.03.2015
Spring Cloud Netflix: Turbine
Turbine
Hystrix
Dashboard
© mimacom 30.03.2015
Demo Application
Zuul Server
Service
Discovery
Eureka
Customers Stores
Config
Server
Hystrix
Dashboar...
© mimacom 30.03.2015
© mimacom 30.03.2015
Summary
© mimacom 30.03.2015
Summary
• Netflix Eureka: Service registry & discovery
© mimacom 30.03.2015
Summary
• Netflix Eureka: Service registry & discovery
• Netflix Hystrix: Circuit breaker and dashboa...
© mimacom 30.03.2015
Summary
• Netflix Eureka: Service registry & discovery
• Netflix Hystrix: Circuit breaker and dashboa...
© mimacom 30.03.2015
Summary
• Netflix Eureka: Service registry & discovery
• Netflix Hystrix: Circuit breaker and dashboa...
© mimacom 30.03.2015
Summary
• Netflix Eureka: Service registry & discovery
• Netflix Hystrix: Circuit breaker and dashboa...
© mimacom 30.03.2015
Summary
• Netflix Eureka: Service registry & discovery
• Netflix Hystrix: Circuit breaker and dashboa...
© mimacom 30.03.2015
Summary
• Netflix Eureka: Service registry & discovery
• Netflix Hystrix: Circuit breaker and dashboa...
© mimacom 30.03.2015
Summary
• Netflix Eureka: Service registry & discovery
• Netflix Hystrix: Circuit breaker and dashboa...
© mimacom 30.03.2015
Q/A
© mimacom 30.03.2015
Customer-oriented
User-friendly
Proficient
Qualitative
Efficient
3
…the open source integrator
Próxima SlideShare
Cargando en…5
×

Microservices with Spring and Cloud Foundry

425 visualizaciones

Publicado el

Cloud Foundry allows developers to deploy easily and often their applications. This is a great thing but it is only a part of the whole picture. In order to smoothly scale an application some patterns and basic architecture concepts must be taken into consideration. With Spring Boot, applications can be split into smaller parts called Microservices, which can be scaled in a more fine-grained manner. In addition Spring Cloud provides tools to quickly build some of the common patterns in distributed systems (e.g. configuration management, service discovery, circuit breakers).

Publicado en: Software
  • Sé el primero en comentar

  • Sé el primero en recomendar esto

Microservices with Spring and Cloud Foundry

  1. 1. © mimacom Microservices with Spring and Cloud Foundry Alain Sahli
  2. 2. © mimacom 30.03.2015 Agenda • Introduction • Microservices architecture • Spring Cloud components • Demo
  3. 3. © mimacom 30.03.2015 GitHub Builds & Deploys Source: https://github.com/blog/1241-deploying-at-github
  4. 4. © mimacom 30.03.2015 GitHub Builds & Deploys Source: https://github.com/blog/1241-deploying-at-github 175 deploys!
  5. 5. © mimacom 30.03.2015 Microservices
  6. 6. © mimacom 30.03.2015 Microservices LB
  7. 7. © mimacom 30.03.2015 Microservices
  8. 8. © mimacom 30.03.2015 Microservices
  9. 9. © mimacom 30.03.2015 Communication Between Services
  10. 10. © mimacom 30.03.2015 Communication Between Services
  11. 11. © mimacom 30.03.2015 Communication Between Services
  12. 12. © mimacom 30.03.2015 Communication Between Services
  13. 13. © mimacom 30.03.2015 Service Discovery cont’d
  14. 14. © mimacom 30.03.2015 Service Discovery cont’d
  15. 15. © mimacom 30.03.2015 Service Discovery cont’d
  16. 16. © mimacom 30.03.2015 Client-Side Load Balancing
  17. 17. © mimacom 30.03.2015 Client-Side Load Balancing LB
  18. 18. © mimacom 30.03.2015 Resiliency
  19. 19. © mimacom 30.03.2015 Resiliency
  20. 20. © mimacom 30.03.2015 Circuit Breaker
  21. 21. © mimacom 30.03.2015 Circuit Breaker
  22. 22. © mimacom 30.03.2015 Circuit Breaker 1x every minute
  23. 23. © mimacom 30.03.2015 API Gateway Browser
  24. 24. © mimacom 30.03.2015 API Gateway Browser
  25. 25. © mimacom 30.03.2015 Handling Configuration
  26. 26. © mimacom 30.03.2015 Handling Configuration
  27. 27. © mimacom 30.03.2015 Handling Configuration
  28. 28. © mimacom 30.03.2015 Handling Configuration
  29. 29. © mimacom 30.03.2015 Summary
  30. 30. © mimacom 30.03.2015 Summary • Service discovery: Netflix Eureka
  31. 31. © mimacom 30.03.2015 Summary • Service discovery: Netflix Eureka • Client-side load balancing: Netflix Ribbon
  32. 32. © mimacom 30.03.2015 Summary • Service discovery: Netflix Eureka • Client-side load balancing: Netflix Ribbon • Circuit breaker: Netflix Hystrix
  33. 33. © mimacom 30.03.2015 Summary • Service discovery: Netflix Eureka • Client-side load balancing: Netflix Ribbon • Circuit breaker: Netflix Hystrix • API gateway: Netflix Zuul
  34. 34. © mimacom 30.03.2015 Summary • Service discovery: Netflix Eureka • Client-side load balancing: Netflix Ribbon • Circuit breaker: Netflix Hystrix • API gateway: Netflix Zuul • Configuration: Spring Cloud Config • Spring Cloud Bus for refreshing the config
  35. 35. © mimacom 30.03.2015 Spring IO CLOUD SERVICE REGISTRY,
 CIRCUIT BREAKER, METRICS CORE FRAMEWORK SECURITY GROOVY REACTOR IOEXECUTIONIOFOUNDATION GRAILS FULL STACK, WEB XD STREAMS, TAPS, JOBS BOOT BOOTABLE, MINIMAL, OPS-READY BATCH JOBS, STEPS,
 READERS, WRITERS DATA RELATIONAL DATA NON-RELATIONAL DATA BIG DATA INGESTION, EXPORT,
 ORCHESTRATION, HADOOP WEB CONTROLLERS, REST,
 WEBSOCKET INTEGRATION CHANNELS, FILTERS,
 ADAPTERS, TRANSFORMERS IOCOORDINATION
  36. 36. © mimacom 30.03.2015 Spring Boot: Short Introduction
  37. 37. © mimacom 30.03.2015 Spring Boot: Short Introduction “Takes an opinionated view of building production-ready Spring applications”
  38. 38. © mimacom 30.03.2015 Spring Boot: Short Introduction • Create standalone Spring applications • Provide opinionated “starter” POMs to simplify your maven configuration • Automatically configure Spring whenever possible • Provide production-ready features such as metrics, health checks and externalized configuration “Takes an opinionated view of building production-ready Spring applications”
  39. 39. © mimacom 30.03.2015 Spring Boot: Key Features
  40. 40. © mimacom 30.03.2015 Spring Boot: Key Features MyApplication.java: @SpringBootApplication public class EurekaServer { public static void main(String[] args) { SpringApplication.run(MyApplication.class, args); } }
  41. 41. © mimacom 30.03.2015 Spring Boot: Key Features MyApplication.java: @SpringBootApplication public class EurekaServer { public static void main(String[] args) { SpringApplication.run(MyApplication.class, args); } } pom.xml: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency>
  42. 42. © mimacom 30.03.2015 Spring Boot: Key Features MyApplication.java: @SpringBootApplication public class EurekaServer { public static void main(String[] args) { SpringApplication.run(MyApplication.class, args); } } pom.xml: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> Configuration file: application.yml, bootstrap.yml
  43. 43. © mimacom 30.03.2015 Spring Cloud Bus Connectors Starters Amazon Web Services Config Cloud Foundry Netflix CLI
  44. 44. © mimacom 30.03.2015 Spring Cloud Bus StartersConfig Cloud Foundry Netflix
  45. 45. © mimacom 30.03.2015 Spring Cloud Config: Server Spring Cloud Config Server GIT SVN File
  46. 46. © mimacom 30.03.2015 Spring Cloud Config: Server Spring Cloud Config Server GIT SVN File ConfigServer.java: @SpringBootApplication @EnableConfigServer public class ConfigServer {…}
  47. 47. © mimacom 30.03.2015 Spring Cloud Config: Server Spring Cloud Config Server GIT SVN File ConfigServer.java: @SpringBootApplication @EnableConfigServer public class ConfigServer {…} application.yml spring.cloud.config.git.uri: https://github.com/…
  48. 48. © mimacom 30.03.2015 Spring Cloud Config: Client Spring Cloud Config Server Application Spring Cloud Config Client Application Spring Cloud Config Client Application Spring Cloud Config Client
  49. 49. © mimacom 30.03.2015 Spring Cloud Config: Client Spring Cloud Config Server Application Spring Cloud Config Client Application Spring Cloud Config Client Application Spring Cloud Config Client bootstrap.yml: spring.cloud.config.uri: ${vcap.services.configserver.credentials.uri}
  50. 50. © mimacom 30.03.2015 Spring Cloud Bus Spring Cloud Config Server Application Application Application
  51. 51. © mimacom 30.03.2015 Spring Cloud Netflix: Eureka Spring Cloud Eureka Server Application Spring Cloud Eureka Client Application Spring Cloud Eureka Client Application Spring Cloud Eureka Client
  52. 52. © mimacom 30.03.2015 Spring Cloud Netflix: Eureka Spring Cloud Eureka Server Application Spring Cloud Eureka Client Application Spring Cloud Eureka Client Application Spring Cloud Eureka Client EurekaServer.java: @SpringBootApplication @EnableEurekaServer public class EurekaServer {…}
  53. 53. © mimacom 30.03.2015 Spring Cloud Netflix: Eureka Spring Cloud Eureka Server Application Spring Cloud Eureka Client Application Spring Cloud Eureka Client Application Spring Cloud Eureka Client EurekaServer.java: @SpringBootApplication @EnableEurekaServer public class EurekaServer {…} Application.java: @SpringBootApplication @EnableEurekaClient public class Application {…}
  54. 54. © mimacom 30.03.2015 Spring Cloud Netflix: Ribbon
  55. 55. © mimacom 30.03.2015 Spring Cloud Netflix: Ribbon RibbonSample.java: public class RibbonSample { @Autowired private RestTemplate restTemplate; public void foo() { restTemplate.postForLocation(“http://customers/add”, customer); } }
  56. 56. © mimacom 30.03.2015 Spring Cloud Netflix: Zuul
  57. 57. © mimacom 30.03.2015 Spring Cloud Netflix: Zuul ApiGateway.java: @SpringBootApplication @EnableZuulProxy public class ApiGateway {…}
  58. 58. © mimacom 30.03.2015 Spring Cloud Netflix: Zuul ApiGateway.java: @SpringBootApplication @EnableZuulProxy public class ApiGateway {…} application.yml: zuul: ignoredServices: * routes: users: /myusers/**
  59. 59. © mimacom 30.03.2015 Spring Cloud Netflix: Hystrix
  60. 60. © mimacom 30.03.2015 Spring Cloud Netflix: Hystrix PentagonApplication.java: @SpringBootApplication @EnableHystrix public class PentagonApplication {…}
  61. 61. © mimacom 30.03.2015 Spring Cloud Netflix: Hystrix PentagonApplication.java: @SpringBootApplication @EnableHystrix public class PentagonApplication {…} Store.java: @HystrixCommand(fallbackMethod = "defaultStores") public Object getStores(Map<String, Object> parameters) { //Call another service over HTTP (ribbon) } public Object defaultStores(Map<String, Object> parameters) { return /* some fallback data */; }
  62. 62. © mimacom 30.03.2015 Spring Cloud Netflix: Hystrix PentagonApplication.java: @SpringBootApplication @EnableHystrix public class PentagonApplication {…} Store.java: @HystrixCommand(fallbackMethod = "defaultStores") public Object getStores(Map<String, Object> parameters) { //Call another service over HTTP (ribbon) } public Object defaultStores(Map<String, Object> parameters) { return /* some fallback data */; }
  63. 63. © mimacom 30.03.2015 Spring Cloud Netflix: Hystrix PentagonApplication.java: @SpringBootApplication @EnableHystrix public class PentagonApplication {…} Store.java: @HystrixCommand(fallbackMethod = "defaultStores") public Object getStores(Map<String, Object> parameters) { //Call another service over HTTP (ribbon) } public Object defaultStores(Map<String, Object> parameters) { return /* some fallback data */; }
  64. 64. © mimacom 30.03.2015 Spring Cloud Netflix: Hystrix Dashboard
  65. 65. © mimacom 30.03.2015 Spring Cloud Netflix: Turbine Turbine
  66. 66. © mimacom 30.03.2015 Spring Cloud Netflix: Turbine Turbine Hystrix Dashboard
  67. 67. © mimacom 30.03.2015 Demo Application Zuul Server Service Discovery Eureka Customers Stores Config Server Hystrix Dashboard Browser Turbine
  68. 68. © mimacom 30.03.2015
  69. 69. © mimacom 30.03.2015 Summary
  70. 70. © mimacom 30.03.2015 Summary • Netflix Eureka: Service registry & discovery
  71. 71. © mimacom 30.03.2015 Summary • Netflix Eureka: Service registry & discovery • Netflix Hystrix: Circuit breaker and dashboard
  72. 72. © mimacom 30.03.2015 Summary • Netflix Eureka: Service registry & discovery • Netflix Hystrix: Circuit breaker and dashboard • Netflix Turbine: Aggregate hystrix streams
  73. 73. © mimacom 30.03.2015 Summary • Netflix Eureka: Service registry & discovery • Netflix Hystrix: Circuit breaker and dashboard • Netflix Turbine: Aggregate hystrix streams • Netflix Ribbon: Client-side load-balancing
  74. 74. © mimacom 30.03.2015 Summary • Netflix Eureka: Service registry & discovery • Netflix Hystrix: Circuit breaker and dashboard • Netflix Turbine: Aggregate hystrix streams • Netflix Ribbon: Client-side load-balancing • Netflix Zuul: Reverse proxy for API gateway
  75. 75. © mimacom 30.03.2015 Summary • Netflix Eureka: Service registry & discovery • Netflix Hystrix: Circuit breaker and dashboard • Netflix Turbine: Aggregate hystrix streams • Netflix Ribbon: Client-side load-balancing • Netflix Zuul: Reverse proxy for API gateway • Spring Cloud Config: Centralized configuration
  76. 76. © mimacom 30.03.2015 Summary • Netflix Eureka: Service registry & discovery • Netflix Hystrix: Circuit breaker and dashboard • Netflix Turbine: Aggregate hystrix streams • Netflix Ribbon: Client-side load-balancing • Netflix Zuul: Reverse proxy for API gateway • Spring Cloud Config: Centralized configuration • Spring Cloud Bus: Publish events over RabbitMQ
  77. 77. © mimacom 30.03.2015 Summary • Netflix Eureka: Service registry & discovery • Netflix Hystrix: Circuit breaker and dashboard • Netflix Turbine: Aggregate hystrix streams • Netflix Ribbon: Client-side load-balancing • Netflix Zuul: Reverse proxy for API gateway • Spring Cloud Config: Centralized configuration • Spring Cloud Bus: Publish events over RabbitMQ • Spring Cloud Netflix: Configure Netflix components
  78. 78. © mimacom 30.03.2015 Q/A
  79. 79. © mimacom 30.03.2015 Customer-oriented User-friendly Proficient Qualitative Efficient 3 …the open source integrator

×