Introduction to Microservices Prepared for OpenLegacy Training Day Four Introduction to Microservices Prepared for
Agenda Introduction to Microservices Microservice Architecture Components and Frameworks Inter-Process Communications OpenLegacy Microservices
In the beginning, there was a Monolith … ? Explain about how applications were built before. Explain the problem with the old “Monolith” architecture.
What is a Microservices Architecture? Microservices architecture is a service‑oriented architecture composed of loosely coupled elements that have bounded contexts Scale out vs. Scale up If you keep scaling up, you’ll hit a limit Horizontal scaling gives you a longer runway Redundancy and Isolation For Resiliency Make more than one of anything Isolate the blast radius for any given failure - Loosely coupled means that you can update services independently
Tight Coupling Doesn’t Work
Loose Coupling
Microservices Architecture Example
Components and Frameworks Service Discovery (Netflix Eureka) Gateway (Netflix Zuul) Fault Tolerance (Netflix Hystrix) Config Server (Spring Cloud) UAA (Spring Security) Log Analysis and Aggregation (ELK Stack) - Fast slide, just to show the components in a list
Service Discovery Implemented using Netflix Eureka Eureka is a REST (Representational State Transfer) based service that is primarily used in AWS cloud to locate services for load balancing and failover of middle-tier servers
Gateway Implemented using Netflix Zuul Zuul is an edge service providing dynamic routing, monitoring, resiliency, security, etc.
Fault Tolerance Implemented using Netflix Hystrix Hystrix is a Latency and Fault Tolerance library designed to isolate points of access to remote systems, services and 3rd party libraries, stop cascading failures and enable resilience in complex distributed systems where failure is inevitable
Config Server Spring Cloud Config Server features: HTTP, resource-based API for external configuration (name-value pairs, or equivalent YAML content) Encrypt and decrypt property values (symmetric or asymmetric) Easily embeddable in a Spring Boot application using @EnableConfigServer Config Client features (for Spring applications): Bind to Config Server and initialize Spring Environment with remote property sources
UAA – User Account and Authentication UAA is a multi-tenant Identity Management service It is primarily an OAuth2 provider, issuing tokens for client applications to use when they act on behalf of business users UAA can also act as an SSO service using those credentials (or others) It has endpoints to manage user accounts and register OAuth2 clients, and a variety of other management functions
Log Analysis Logs are written using Spring Cloud Sleuth + Logback We can monitor logs in real-time using Zipkin Zipkin is a distributed tracing system. It helps gather timing data needed to troubleshoot latency problems in microservice architectures. It manages both collection and lookup of this data. Zipkin’s design is based on the Google Dapper paper.
Elasticsearch Logstash Kibana Log Aggregation Writing, indexing and viewing of logs in a distributed environment is implemented with the ELK stack. Elasticsearch Logstash Kibana
Elasticsearch
Logstash
Kibana
Inter-Process Communication (IPC) Netflix Ribbon Ribbon is a client-side IPC library that is battle-tested in Cloud @LoadBalanced Annotation to mark a RestTemplate bean to be configured to use a LoadBalancerClient
Demo
Deployment Packaging Docker Cloud Foundry
Packaging JAR Spring Boot Maven plugin A JAR (Java ARchive) is a package file format typically used to aggregate many Java class files and associated metadata and resources (text, images, etc.) into a single file for distribution Spring Boot Maven plugin Spring Boot Maven Plugin provides Spring Boot support in Maven, allowing you to package executable jars or war archives, and run an application “in-place” Can be packaged as JAR or WAR Can be deployed to traditional containers like Tomcat as a WAR Can be ran anywhere as a “self-executable” JAR Spring Boot also has a plugin for gradle
Docker Docker is the world’s leading software container platform Dockerfile Docker builds images automatically by reading instructions from a Dockerfile Docker Compose Compose is a tool to define and run multi-container Docker applications We provide dockerfiles with all of our projects We provide a default docker compose for the projects We provide a default docker compose for the ELK stack (pre-configured for openlegacy)
Cloud Foundry Cloud Foundry is the industry standard open source Cloud application platform to develop and deploy Enterprise Cloud applications. Manifest Manifest provides consistency and reproducibility, and helps automate deployment, especially of multiple concurrent applications Cloud Foundry is the industry standard open source cloud application platform for developing and deploying enterprise cloud applications. It automates, scales and manages cloud apps throughout their lifecycle. Applications can be written in just about any language and are deployed in containers on multiple cloud infrastructures. We provide default manifests for all of our projects
Exercise https://github.com/openlegacy/deloitte-training-2017 Username: ol-training Password: training2017
Tom Fingerman tom.f@openlegacy.com
Questions? Tom Fingerman tom.f@openlegacy.com