75
Microservices: Architecture for Agile Software Development Eberhard Wolff Fellow, innoQ @ewolff

Microservices: Architecture to Support Agile

Embed Size (px)

Citation preview

Page 1: Microservices: Architecture to Support Agile

Microservices: Architecture for Agile

Software DevelopmentEberhard WolffFellow, innoQ

@ewolff

Page 2: Microservices: Architecture to Support Agile
Page 3: Microservices: Architecture to Support Agile

http://microservices-buch.de/ http://microservices-book.com/

Page 4: Microservices: Architecture to Support Agile

http://microservices-book.com/primer.html

FREE!!!!

Page 5: Microservices: Architecture to Support Agile

Microservice Definition

Page 6: Microservices: Architecture to Support Agile

Server Server

Microservices: Definition

> Small

> Independent deployment units

> Separate VM / process

> Any technology

> Any infrastructure

MicroService

MicroService

Page 7: Microservices: Architecture to Support Agile

Components Collaborate

MicroService

MicroService

Link

Data Replication

REST

Messaging

Page 8: Microservices: Architecture to Support Agile

Microservices

> Component Model

> Component…

> Individual deployment unit

> GUI+Logic?

Page 9: Microservices: Architecture to Support Agile

Layered

iOS Android Web

Order Search Catalog

BillingCustomer

Backend Backend Backend

Page 10: Microservices: Architecture to Support Agile

Layered

> Reusable Backend Services

> Mobile client / Web App as frontend

> Backend for frontend (BFF): Custom backend services

> ...to implement frontend specific logic

Page 11: Microservices: Architecture to Support Agile

Layered: Issues

> All BFF support the same processes

> BFF contain most relevant logic

> Change to a business process means changing many services

> Lots of communication

Page 12: Microservices: Architecture to Support Agile

Self-contained Systems

Order Search CatalogBilling

Web Web Web Web

Page 13: Microservices: Architecture to Support Agile

Self-contained Systems (SCS)

> SCS: Autonomous web application

> Optional service API (e.g. for mobile clients)

> Includes data & logic

> Might contain several microservices

> No shared UI

> No shared business code

> E.g. Otto, Kaufhof ...

Page 14: Microservices: Architecture to Support Agile

SCS: Benefits

> Business logic for one domain in one SCS

> Change usually local to one SCS

> Less communication between SCS

> I think this should be the goal

> http://scs-architecture.org

Page 15: Microservices: Architecture to Support Agile

Online Shop

Order

Catalog

Search

Billing

Customer

HTML /HTTP

Page 16: Microservices: Architecture to Support Agile

Online Shop

Elasticsearch

Spring BatchOracle

Spring MVCMongoDB

Order

Catalog

Search

Billing

Page 17: Microservices: Architecture to Support Agile

Agility

Page 18: Microservices: Architecture to Support Agile

Agile Manifesto> Individuals and Interaction

> Over processes and tools

> Working Software

> Over comprehensive documentation

> Customer Collaboration

> Over contract negotation

> Responding to change

> Over following a plan

Page 19: Microservices: Architecture to Support Agile

Agile Manifesto:Individuals and

Interactions

Page 20: Microservices: Architecture to Support Agile

Software Architecture& Individuals

Page 21: Microservices: Architecture to Support Agile

Software Architecture& Individuals

Unrelated?

Page 22: Microservices: Architecture to Support Agile

Does Your Architecture Take Individuals Into

Account?

Page 23: Microservices: Architecture to Support Agile

Conway‘s Law

Architecture

copies

communication structures

of the organization

Page 24: Microservices: Architecture to Support Agile

Conway‘s Law: ImpactArchitecture

and

communication structures

in the organization

are the same thing.

Page 25: Microservices: Architecture to Support Agile

Conway’s Law as a Limit

> Organization drives architecture

> I.e. GUI, logic & database team

> Three technical artifacts

Page 26: Microservices: Architecture to Support Agile

E CommerceShop

Change Order

Process!

UI

Backend

DB

Page 27: Microservices: Architecture to Support Agile

time

DBTeam Sprint

BackendTeam Sprint

UITeam Sprint

3 sprints

Page 28: Microservices: Architecture to Support Agile

Deployment Monolith

Deployment Monolith

Stories

Technical Coordination

Coordinating Releases

Page 29: Microservices: Architecture to Support Agile

Order SearchBilling

Team for each business feature

Let architecture drive the organization

Order Billing Search

Page 30: Microservices: Architecture to Support Agile

Deployment Monolith + Conway’s Law

Deployment Monolith

Stories

Technical Coordination

Coordinating Releases

StoriesStories

Order Billing Search

Page 31: Microservices: Architecture to Support Agile

Microservices +Conway’s Law

> Let architecture drive the organization

> Team for each Microservice

> Team responsible for business features

> Ideal: Independent features

Page 32: Microservices: Architecture to Support Agile

Order SearchBilling

Order Billing Search

Team can deploy without integrationChanges can be deployed independently & quickly

Strong & enforced modularization

Technology stack per MicroserviceOne or many Microservices per Team

Synergy Microservices / Conway’s Law

Page 33: Microservices: Architecture to Support Agile

Microservices

Microservice

Stories

TechnicalCoordination

Microservice

Stories

TechnicalCoordination

Microservice

Stories

TechnicalCoordination

Order Billing Search

Release Release Release

Page 34: Microservices: Architecture to Support Agile

How to scale agile?

Page 35: Microservices: Architecture to Support Agile

Define architecture to

limit communication

needs

Page 36: Microservices: Architecture to Support Agile

One team can build and deploy features independently!

Page 37: Microservices: Architecture to Support Agile

Team must be responsible for a

sensible set of functionality

Page 38: Microservices: Architecture to Support Agile

Less Technical Coordination

Page 39: Microservices: Architecture to Support Agile

Agile Manifesto:Working Software

Page 40: Microservices: Architecture to Support Agile

Scrum

> PSI

> Potentially shippable increment

> Why?

Page 41: Microservices: Architecture to Support Agile

Principles behind the Agile Manifesto

Our highest priority is

to satisfy the customer

through early and

continuous delivery

of valuable software.

Page 42: Microservices: Architecture to Support Agile

Potentially Shippable Increment

Continuous Delivery

Page 43: Microservices: Architecture to Support Agile

Monolith

ECommerceSystem

3rd partysystems

Database

Page 44: Microservices: Architecture to Support Agile

Continuous Delivery:Build Pipeline

ECommerceSystem

CommitStage

AutomatedAcceptance

Testing

AutomatedCapacityTesting

ManualExplorative

TestingRelease

Page 45: Microservices: Architecture to Support Agile

Build Pipeline:Complex Infrastructure

> Huge database

> 3rd party integration

Page 46: Microservices: Architecture to Support Agile

Build Pipeline:Slow Feedback

> Slow feedback

> Test everything for each commit

> Huge deployment unit

> Deployment slow

Page 47: Microservices: Architecture to Support Agile

Monolith:Deployment

> Huge deployment

> Risky

> Hard to mitigate risk

> Blue / Green: Create a separate environment

> Canary: Deploy to one server first

Page 48: Microservices: Architecture to Support Agile

Microservices

ECommerceSystem

3rd partysystems

Database

Page 49: Microservices: Architecture to Support Agile

Microservices

3rd partysystems

Database

Order

Catalog

Billing

Search

Page 50: Microservices: Architecture to Support Agile

Order

Billing

Customer

Commit!Stage!

Automated!Acceptance!Testing!

Automated!Capacity!Testing!

Manual!Explorative!Testing!

Release!

Commit!Stage!

Automated!Acceptance!Testing!

Automated!Capacity!Testing!

Manual!Explorative!Testing!

Release!

Commit!Stage!

Automated!Acceptance!Testing!

Automated!Capacity!Testing!

Manual!Explorative!Testing!

Release!

Page 51: Microservices: Architecture to Support Agile

Build Pipeline forMicroservices

> Independent deployment

> Build pipeline per Microservice

> Small

> Easier to set up

> Less features (3rd party systems)

> Faster Feedback: Less tests

Page 52: Microservices: Architecture to Support Agile

Microservice:Deployment

> Small deployment

> Less risky

> Other Microservices resilient to failing microservice

> Easy to create new environments

> E.g. for Blue / Green or Canary

Page 53: Microservices: Architecture to Support Agile

Quick DeploymentsTime

Size & Risk

Manual Deployment

Pipeline

Continuous Delivery Pipeline

MonolithMicroservices

Page 54: Microservices: Architecture to Support Agile

Potentially shippable increment?

Page 55: Microservices: Architecture to Support Agile

SHIP!!!

Page 56: Microservices: Architecture to Support Agile

Agile Manifesto:Customer

Collaboration

Page 57: Microservices: Architecture to Support Agile

Customer Collaboration &

Architecture?

Page 58: Microservices: Architecture to Support Agile

Microservices & Departments

StoriesStories Stories

Customer Billing OrderProcess

ProductOwner

ProductOwner

ProductOwner

Department Department Department

Page 59: Microservices: Architecture to Support Agile

Microservices & Departments

> Ideal: One team per department

> Ideal: Change local to one team / Microservice

> Otherwise: Coordination needed

Page 60: Microservices: Architecture to Support Agile

Customer should own Microservice

Page 61: Microservices: Architecture to Support Agile

Agile Manifesto:Responding to change

Page 62: Microservices: Architecture to Support Agile

Monoliths

> Architecture rot

> …not maintainable any more

> …and can’t be rewritten / replaced

Page 63: Microservices: Architecture to Support Agile

Deployment Monolith

> Cyclic dependency

> …because the IDE suggested some class

> Might not even be noticed

Module

Class

Module

Class

Class Class

Page 64: Microservices: Architecture to Support Agile

Microservices

> Need to use the API

> Different team

> More effort - will think about it

> Rot less likely

Microservice

Class

Microservice

Class

Class Class

Page 65: Microservices: Architecture to Support Agile

Global Refactorings?

> Move code from service to service

> Might be a port to a different language

> Separate in a new service

> Harder than in a Deployment Monolith

Page 66: Microservices: Architecture to Support Agile

Microservices

> Small

> Easy to change

> Architectural problems in Microservice unlikely

> Can be replaced

Microservice

Class

Class

Page 67: Microservices: Architecture to Support Agile

Microservices – Easy to Recycle

Page 68: Microservices: Architecture to Support Agile

Conclusion

Page 69: Microservices: Architecture to Support Agile

Conclusion: Microservices & Agility

> Individuals over tools

> Architecture drives organization

> Scale by architecture not process

> Working software

> Actually ship software

> Continuous Delivery

Page 70: Microservices: Architecture to Support Agile

Conclusion: Microservices & Agility

> Customer collaboration

> Customer should own services

> i.e. organization beyond the project = architecture

Page 71: Microservices: Architecture to Support Agile

Conclusion: Microservices & Agility

> Responding to change

> Individual Microservices small

> Easy to change

> …and replace

> Unwanted dependencies won’t sneak in

> But: Global refactoring hard, too

Page 72: Microservices: Architecture to Support Agile

Meta-Conclusion

Page 73: Microservices: Architecture to Support Agile

How To Think About Architecture

> Process has an impact on architecture

> Software architecture & organization are the same

> Build recyclable software!

Page 74: Microservices: Architecture to Support Agile

Microservice > Agile Achitecture

Strong Modularization

Scaled Agile Architecture

Sustainable development speed Replaceable Services

Continuous Delivery

Choose best technology for job!

Handle Legacy more efficient

Independent Scaling

Robustness

Page 75: Microservices: Architecture to Support Agile

Thank You!

@ewolff

https://github.com/ewolff/microservice

https://leanpub.com/microservices-primer

http://microservices-buch.de/

http://scs-architecture.org