Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Microservices Architecture with Spring Cloud Stack

Microservices Architecture with Spring Cloud Stack

An introduction to microservice architecture over monilith, and how Spring Cloud Stack would help us with this tech with less pain.

Maikel Chandika

January 13, 2018
Tweet

More Decks by Maikel Chandika

Other Decks in Programming

Transcript

  1. The Speaker • Maikel Chandika, S.Kom, OCA • ICT Manager

    at Waruna-Group • Java Ecosystem Enthusiast • mkdika@gmail.com • Github: @mkdika • LinkedIn: @maikelchandika Microservice Architecture with Spring Cloud (Maikel Chandika, 2018) 2
  2. The Rundown • 2.00 pm - 2.40 pm Microservice &

    Spring Cloud Stack • 2.40 pm - 3.00 pm Demo To-do Apps • 3.00 pm - 3.15 pm Break & Networking • 3.15 pm - 4.00 pm Features Demo & Live Code • 4.00 pm - 4.20 pm Q & A • 4.20 pm Networking & Documentation Microservice Architecture with Spring Cloud (Maikel Chandika, 2018) 3
  3. Meetup URLs • Q & A http://sli.do Code: 2250 •

    Meetup Feedback https://goo.gl/kagtmg Microservice Architecture with Spring Cloud (Maikel Chandika, 2018) 4
  4. What is Microservice Architecture? Microservice Architecture with Spring Cloud (Maikel

    Chandika, 2018) 6 "The microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery. There is a bare minimum of centralized management of these services, which may be written in different programming languages and use different data storage technologies. “ (Martin Fowler)
  5. Microservice Catalyst • Business Demand • Enterprises find new ways

    to quickly penetrate the market • No longer interested developing consolidated & managing end-to-end business functions. • To be more agility, speed of delivery, and scale to compete market. • Technology • Emergence of HTML5, CSS3, Client-side JavaScript framework, mobile platform & apps. • Revolutionized space of the database, NoSQL. • Infrastructure Management, PaaS, Container revolution & orchestration. Microservice Architecture with Spring Cloud (Maikel Chandika, 2018) 7
  6. Popularized By Agility Speed of Delivery Scale Microservice Architecture with

    Spring Cloud (Maikel Chandika, 2018) 8 And many others… To achieve higher degree of
  7. Microservices The Honey Comb Analogy “ In the real world,

    bees build a honeycomb by aligning hexagonal wax cells. They start small, using different materials to build the cells. Construction is based on what is available at the time of building. Repetitive cells form a pattern, and result in a strong fabric structure. Each cell in the honeycomb is independent, but also integrated with other cells. By adding new cells, the honeycomb grows organically to a big, solid structure. The content inside the cell is abstracted and is not visible outside. Damage to one cell does not damage other cells, and bees can reconstruct those cells without impacting the overall honeycomb. “ Microservice Architecture with Spring Cloud (Maikel Chandika, 2018) 9
  8. Principle of Microservices 1. Single Responsibility per Service (SOLID Principle)

    2. Self Contained & Autonomous Microservice Architecture with Spring Cloud (Maikel Chandika, 2018) 11
  9. Cloud Native Application Methodology • 12 Factor App Microservice Architecture

    with Spring Cloud (Maikel Chandika, 2018) 12 Ah…Uda Lah!
  10. Spring Framework != Spring MVC != Spring Boot && Spring

    Cloud != Spring Cloud Foundry… ;) Microservice Architecture with Spring Cloud (Maikel Chandika, 2018) 13
  11. Spring Cloud Stack • Spring Boot Simplify Bootstrapping, automate configuration

    and reduce boilerplate code. • Spring Config Server Externalize Configuration • Netflix Eureka Service Discovery/ Dynamic Service Registration, mid-tier load balancing & failover. • Netflix Zuul Service Proxy/ Gateway API. • Netflix Hystrix Circuit Breaker / Self Healing • Netflix Ribbon Inter Process Communication (remote procedure calls) library with built in load balancers. • Feign Declarative HTTP Client Microservice Architecture with Spring Cloud (Maikel Chandika, 2018) 14 And many more….
  12. Spring Cloud To-do Application • Spring Cloud To-do App is

    limited to: • Cross-Cutting Concern (Security, Logging, etc.) • Event-Driven Architecture & Reactive Programming (some part only) Microservice Architecture with Spring Cloud (Maikel Chandika, 2018) 17
  13. To-do App Microservices • Overhead Domain • Config Service •

    Discovery Service • Business Domain • To-do Service • Audit Trail Service • Integration Domain • Message Service • Front End • Vue.Js Microservice Architecture with Spring Cloud (Maikel Chandika, 2018) 18
  14. App Features Demo • Spring Cloud • Eureka Frontpage •

    Externalized Config • Git Repository • Local File • Config Changes • Manual Refresh • Automatic Refresh/ Dynamic • Feign Client • API Gateway • Hystrix Fallback • Ribbon Failed-over • Hystrix Dashboard • Turbine Dashboard • Event/ Message Driven with Spring Cloud Stream Microservice Architecture with Spring Cloud (Maikel Chandika, 2018) 21
  15. App Features Demo • Spring Boot • Production Ready End-points

    • Swagger & Web UI • H2 Web Console • HATEOAS • WebTools • Project Starter • Web (http://start.spring.io) • IntelliJ IDEA • And many more… Microservice Architecture with Spring Cloud (Maikel Chandika, 2018) 22
  16. Common Dependencies Reference Config Service Discovery Service Gateway Service Monitoring

    Config Server Eureka Server Zuul Config Client Eureka Discovery Config Client Config Client Eureka Discovery Actuator Actuator Eureka Discovery Actuator Actuator Hystrix Dashboard Turbine Microservice Architecture with Spring Cloud (Maikel Chandika, 2018) 23
  17. Common Dependencies Reference REST API Web Interface Config Client Config

    Client Eureka Discovery Eureka Discovery Actuator Actuator Hystrix Hystrix Feign Feign Web Web HATEOAS HATEOAS JPA JPA Lombok Lombok Devtools Devtools Thymeleaf Microservice Architecture with Spring Cloud (Maikel Chandika, 2018) 24
  18. Microservice Architecture Drawbacks • Overhead cost, increasing of resource usage.

    • Developing distributed system can be complex (request & latency) • Deploying microservice can be complex (coordination). • Testing of application are harder. Microservice Architecture with Spring Cloud (Maikel Chandika, 2018) 25
  19. To Go Further Microservice Architecture with Spring Cloud (Maikel Chandika,

    2018) 26 Spring 5.0 Microservices 2nd Ed Mastering Spring 5.0 Spring Microservices in Action
  20. To Go Futher “ A working code tells more than

    hundred blog “ (Anonymous) App Demo Repository: https://github.com/KongkowITMedan/spring-cloud-todo Microservice Architecture with Spring Cloud (Maikel Chandika, 2018) 27
  21. What Next? • Development and scaling scenario • Add cross-cutting

    concern (Security, Auth, Logging, etc). • Add more tech Integration (Elastic Search/ NoSQL). • Refactor to Event-driven/Message-driven Architecture. • Add CI/CD & Container base deployment to Cloud. • Develop small Market Place project. • And many more… Microservice Architecture with Spring Cloud (Maikel Chandika, 2018) 28