@crichardson Microservices - an architecture that enables DevOps Chris Richardson Microservice architecture consultant and trainer Founder of Eventuate.io Founder of the original CloudFoundry.com Author of POJOs in Action and Microservices Patterns @crichardson chris@chrisrichardson.net http://adopt.microservices.io Copyright © 2020. Chris Richardson Consulting, Inc. All rights reserved
@crichardson What you will learn Answers to Frequently Asked Questions about the Microservice Architecture
@crichardson About Chris http://adopt.microservices.io
@crichardson Discounts 35% discount mtpsystems20 $120 discount coupon KLDPZOJE http://adopt.microservices.io
@crichardson Agenda 1. What is the microservice architecture? 2. How small is a microservice? 3. Why is the microservice architecture important? 4. Is the monolithic architecture an anti-pattern? 5. What are the key challenges with using microservices? 6. How do you migrate a monolith to a microservice architecture?
Pattern: microservice architecture Highly maintainable and testable Minimal lead time (time from commit to deploy) Loosely coupled Independently deployable Implements a business capability Owned/developed/tested/ deployed by a small team An architectural style that structures an application as a set of deployable/ executable units, a.k.a. services A service is:
@crichardson Food to Go: Microservice architecture Browser Mobile Application API Gateway Order Service Restaurant Service Delivery Service … Service Order Database Restaurant Database Delivery Database … Database REST REST JavaScript Message Broker
@crichardson Service architecture “mirrors” the business FTGO business Kitchen Service Delivery Service Order Taking Kitchen Delivery Accounting …. …. Service Order Service Accounting Service Maps to Maps to Maps to Maps to Maps to Area of the business, a.k.a. Subdomain or Business Capability
@crichardson API The structure of a service Operations Event Publisher Commands Queries Synchronous REST/gRPC Asynchronous Messaging Events Event Subscriber API Client Invokes Operations Events Service Database Private!
@crichardson Agenda 1. What is the microservice architecture? 2. How small is a microservice? 3. Why is the microservice architecture important? 4. Is the monolithic architecture an anti-pattern? 5. What are the key challenges with using microservices? 6. How do you migrate a monolith to a microservice architecture?
@crichardson Microservices should be team-sized Service https://microservices.io/patterns/decomposition/service-per-team.html Owned by a team Owns one service Not to exceed cognitive capacity of team
@crichardson Service too large*: split service Service Small, autonomous team Service Service *Too large => unable to achieve desired -ilities, e.g. short lead time (build/test/deploy time)
@crichardson Agenda 1. What is the microservice architecture? 2. How small is a microservice? 3. Why is the microservice architecture important? 4. Is the monolithic architecture an anti-pattern? 5. What are the key challenges with using microservices? 6. How do you migrate a monolith to a microservice architecture?
@crichardson https://www.ft.com/content/f9356bdc-3102-11ea-a329-0bcf87a328f2 https://www.ft.com/content/3f498e64-1aa6-11ea-97df-cc63de1d73f4 https://techcrunch.com/2019/06/18/the-rise-of-the-gig-economy-helps-london-based-insurtech-zego-to-raise-42m/ C O VID -19 The marketplace/world is Volatile, Uncertain,Complex, Ambiguous Businesses must be nimble, agile, and innovate faster IT must deliver software rapidly, frequently and reliably
@crichardson Key development metrics Faster More reliable
@crichardson Success triangle Process: Lean + DevOps/Continuous Delivery & Deployment Organization: Small, loosely coupled, teams Architecture: ???? Deliver software rapidly, frequently, reliably and sustainably Enables Enables
Required architectural quality attributes (a.k.a. -ilities) “Complete their work without communicating and coordinating with people outside their team” “Make large-scale changes to the design of their system without depending on other teams to make changes in their systems or creating significant work for other teams” “We can do most of our testing without requiring an integrated environment.” “We can and do deploy or release our application independently of other applications/services it depends on.” Loosely coupled (Conway’s law) Modular Testable Deployable API encapsulates design decisions
@crichardson Architecture quality attributes for sustainable development Time Technology A Technology B V1 V2 V3 V… Importance The importance of a technology changes over time Evolvability - Must be able to upgrade the technology stack of long-lived applications
@crichardson Process: Lean + DevOps/Continuous Delivery & Deployment Architecture: microservices Testability Deployability Loose coupling Deliver changes to long-lived applications rapidly, frequently and reliably Organization: Small, long- lived, product-centric, autonomous teams
@crichardson Microservices experiment safely and evolve the technology stack Java Java Java Java Java Golang “GoLang is cool!” Java Java Java “Kotlin is better!” Java Kotlin
@crichardson Agenda 1. What is the microservice architecture? 2. How small is a microservice? 3. Why is the microservice architecture important? 4. Is the monolithic architecture an anti-pattern? 5. What are the key challenges with using microservices? 6. How do you migrate a monolith to a microservice architecture?
@crichardson Tomcat/App. Server Food To Go: Monolithic architecture Browser/ Client WAR/EAR MySQL Database Delivery management Order Management Kitchen Management Web UI Restaurant Management HTML REST/JSON The application
-ilities of small monoliths Testability Deployability Maintainability Modularity Evolvability ✅ ✅ ✅ ✅ ✅ (full rewrite)
@crichardson Rapid, frequent and reliable delivery eventually becomes impossible Time Maintainability Testability Deployability Modularity Evolvability Size/ Complexity -ilities required to be competitive Risk of disruption
@crichardson Lack of sustainability: Many decisions are global = difficult/ impossible to change incrementally Programming language Versions of dependencies - libraries and frameworks …
@crichardson Agenda 1. What is the microservice architecture? 2. How small is a microservice? 3. Why is the microservice architecture important? 4. Is the monolithic architecture an anti-pattern? 5. What are the key challenges with using microservices? 6. How do you migrate a monolith to a microservice architecture?
@crichardson Challenge: complexity of building a distributed system Development: IPC, partial failure Distributed data - sagas etc Testing: Integration, end to end, … Deployment …
@crichardson Challenge: minimizing coupling between services Minimize design-time coupling Design-time coupling = services changing in lockdown Reduces productivity by increasing coordination between teams How: DRY services, Iceberg services, avoiding shared database/ business logic libraries Minimize runtime coupling Runtime coupling - e.g. chains of REST calls Reduces availability How: use Self-contained services
@crichardson Agenda 1. What is the microservice architecture? 2. How small is a microservice? 3. Why is the microservice architecture important? 4. Is the monolithic architecture an anti-pattern? 5. What are the key challenges with using microservices? 6. How do you migrate a monolith to a microservice architecture?
@crichardson Strangler Application http://www.martinfowler.com/bliki/StranglerApplication.html Incrementally migrate functionality from existing application to new (strangler) application
@crichardson Strangling the monolith Monolith Time Monolith Service Monolith Service Service Monolith Service Service Service Service …. Monolith Service Service Service Service Service Service Service Service Service Service Service Service Service Service Service Service …. Strangler application The strangler application grows larger over time The monolith shrinks over time Service Service Service Service Service Service Service Service New features
@crichardsonDatabase Module Iteratively: Module => Service Monolith Service API Gateway Request Module Request Monolith Database Module Database Module Integration glue API API
@crichardson Start with the modules that give you the greatest return on investment (ROI)
Cost vs. Benefit of extraction Benefit Solves a significant problem Velocity frequently updated Scalability Conflicting resource requirements … Cost Cost of changing the monolith and adapting/ rewriting module Difficulty in decoupling/ breaking dependencies Need to participate in sagas/compensating transactions
@crichardson Iteratively: New feature = Service Monolith Service API Gateway Request DatabaseDatabase Integration glue
@crichardson Measuring success Success != Number of Microservices Improved metrics: Reduced lead time Increased deployment frequency Reduced changed failure rate Improvements in other -ilities … Anti-pattern: Microservices as the goal https://chrisrichardson.net/post/antipatterns/2019/01/14/antipattern-microservices-are-the-goal.html
@crichardson Summary Modern enterprises need to deliver software rapidly frequently, reliably and sustainably This requires a loosely coupled, modular, testable and deployable architecture The monolithic architecture is not anti-pattern but its often best for smaller applications The microservice architecture is often better for large/complex applications Loosely coupled services are essential Use the Strangler pattern to migrate a monolith to microservices
@crichardson @crichardson chris@chrisrichardson.net http://adopt.microservices.io Questions? mtpsystems20 KLDPZOJE

Microservices - an architecture that enables DevOps (T Systems DevOps day)