Spring cloud for microservices architecture

Embed Size (px)

Citation preview

1. Spring Cloud For Microservices Architecture Igor Khotin E-mail: [email protected] 2. Background 15+ years in the IT industry 10+ years with Java Flexible design promoter Agile-junkie Deploying... After deployment 3. Microservices Spring Cloud DevOps 4. Monolith 5. Monolith One code base, deployed and scaled as a single unit 6. Traditional approach Easy to deploy Monolithic .war 7. Traditional approach Easy to deploy Availability challenges Hard to scale Centralized release cycle Single Responsibility Principle? Monolithic .war 8. Infrastructure as a Service 9. Platform as a Service 10. Components 11. Microservice Small independent component with well-defined boundaries that's doing one thing, but doing it well 12. Microservice Small independent component with well-defined boundaries that's doing one thing, but doing it well 13. Microservice Small independent component with well-defined boundaries that's doing one thing, but doing it well 14. Archipelago 15. UNIX Tools 16. It's like UNIX pipes all over again! 17. Best set of tools for each service Inherently loosely coupled Reduced time to market Parallel development Independent and frequent releases Designed to scale Benefits 18. Distributed are inherently hard Significant operation overhead Service discovery Redundancy Loadbalancing Performance penalty Requires DevOps skills Challenges 19. Protocol Epoch 20. Microservices Spring Cloud DevOps 21. Spring Cloud Promise It is easy to develop and deploy JVM application for the cloud 22. Not a single tool 23. Not a single tool 24. Spring Cloud Patterns Configuration management Service discovery Circuit breakers Intelligent routing Control bus Global lock Leadership election One-time tokens Distributed Sessions ... 25. @RestController class ItActuallyWorks { @RequestMapping(/) String home() { Hello Spring Boot! } } Spring Boot 26. Annotation-driven @SpringBootApplication @EnableCircuitBreaker @EnableDiscoveryClient public class App extends RepositoryRestMvcConfiguration { @Override protected void configure(RepositoryRestConfiguration config) { config.exposeIdsFor(Customer.class); } public static void main(String[] args) { SpringApplication.run(CustomerApp.class, args); } } 27. Annotation-driven @Autowired(required = false) DataSource dataSource; @Autowired(required = false) RedisConnectionFactory rcf; @Autowired(required = false) MongoDbFactory mongoDbFactory; @Autowired(required = false) ConnectionFactory rbcf; 28. Config Server @Configuration @EnableAutoConfiguration @EnableDiscoveryClient @EnableConfigServer public class ConfigServerApplication { public static void main(String[] args) { SpringApplication .run(ConfigServerApplication.class, args); } } 29. Config Server with Git Backend 30. RESTful Configs /{application}/{profile}[/{label}] /{application}-{profile}.yml /{label}/{application}-{profile}.yml /{application}-{profile}.properties /{label}/{application}-{profile}.properties