Top Banner
Micro Services – The New Architecture Paradigm Eberhard Wolff Freelancer Head Technology Advisory Board adesso AG http://ewolff.com
69
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Micro Service – The New Architecture Paradigm

Micro Services – The New Architecture Paradigm

Eberhard Wolff Freelancer

Head Technology Advisory Board adesso AG

http://ewolff.com

Page 2: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Leseprobe: http://bit.ly/CD-Buch

Page 3: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

GUI

Logic

DB

E Commerce Shop

Change Order

Process!

Page 4: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Thou shalt not organize teams by

technology!

Page 5: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Common libraries & technical foundation

Order Billing Search Catalog

E Commerce Shop

Deployment monolith

Global code integration & coordination needed Code changes to production takes loooong Architecture can be non-monolithic but dependencies might sneak in

How to introduce e.g. Elasticsearch for Search?

Page 6: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Micro Services: Definition •  Small •  Independent deployment units •  i.e. processes

•  Any technology •  Any infrastructure

Micro Service

Server

Micro Service

Server

Page 7: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Micro Services •  Component Model

•  Component… •  Separate process •  Individual deployment unit •  GUI+Logic

Page 8: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Micro Services vs. SOA •  Micro Service: 1 service = 1 deployment unit Service + GUI

•  SOA: 1 deloyment unit = n services Service / GUI separate

Page 9: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Components Collaborate

Micro Service

Micro Service

Link

Data Replication

REST Messaging

Page 10: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Common libraries & technical foundation

Order Billing Search Catalog

Global code integration & coordination needed Code changes to production takes loooong Architecture can be non-monolithic but dependencies might sneak in

How to introduce e.g. Elasticsearch for Search?

E Commerce Shop

Deployment monolith

Page 11: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Common libraries & technical foundation

Order Billing Search Catalog

Global code integration & coordination needed Code changes to production takes loooong Architecture can be non-monolithic but dependencies might sneak in

How to introduce e.g. Elasticsearch for Search?

Order Catalog Search Billing

Micro Services

Team can deploy without integration Changes can be deployed independently & quickly

Technology stack per Micro Service One or many Micro Services per Team

Page 12: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Order Billing Search Catalog

Order Catalog Search Billing

Micro Services

Team can deploy without integration Changes can be deployed independently & quickly

Strong & enforced modularization

Technology stack per Micro Service One or many Micro Services per Team

Page 13: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Online Shop

Order

Catalog

Search

Billing

Customer

HTML / HTTP

Page 14: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Online Shop

Elasticsearch

Spring Batch Oracle

Spring MVC MongoDB

Order

Catalog

Search

Billing

Page 15: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Deploy & Operate?

Page 16: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Component Model •  No restriction on language etc •  Individual processes •  + infrastructure (database etc) •  JARs, WARs, EARs: No good fit

•  Monitoring •  Logging

Page 17: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Possible Component Models •  Virtual machine

•  Docker container

•  Installable software (RPM, deb) •  + deployment / config scripts

Page 18: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Why Micro Services?

Page 19: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

How to scale agile?

Implement more feature

Page 20: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Conway‘s Law

Architecture copies

communication structures of the organization

Page 21: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Conway’s Law as a Limit •  Won’t be able to create an

architecture different from your organization

•  I.e. mobile, GUI & database team •  Three technical artifacts

Page 22: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Conway’s Law as an Enabler •  Desired architecture =

project structure •  Team for each Micro Service •  Team should be responsible for

meaningful features •  Ideal: Independent features

Page 23: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

One team can build and

deploy features independently!

Page 24: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Team must be responsible for a sensible set

of functionality

Page 25: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Conway’s Law & Size •  Upper limit: What a (small) team

can handle •  …and a meaningful set of features •  Probably not too small •  Smaller modules might be better •  Lower limit: Depends on overhead /

technology

Page 26: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Legacy Apps

Page 27: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Page 28: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Page 29: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

How can I implement a

new feature???

Page 30: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff L

Page 31: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

HTTP

New Stuff

Links

No legacy code Any technology

J Small code base

Page 32: Micro Service – The New Architecture Paradigm

Little programs are delightful to write in

isolation, but the process of

maintaining large-scale software is always

miserable.

Jaron Lanier

Page 33: Micro Service – The New Architecture Paradigm

Friedenspreis des deutschen Buchhandels

Page 34: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Sustainable Development

Page 35: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Monoliths •  Architecture rot •  …not maintainable any more •  …and can’t be rewritten / replaced

Page 36: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Micro Services •  Distributed system of small units •  Architecture violations harder

•  Small units •  Easy to replace

Page 37: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Continuous Delivery

Page 38: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Monolith

ECommerce System

3rd party systems

Database

Page 39: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Continuous Delivery: Build Pipeline

Commit Stage

Automated Acceptance

Testing

Automated Capacity Testing

Manual Explorative

Testing

Release

ECommerce System

Page 40: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Build Pipeline: Problems •  Complex infrastructure •  Huge database •  3rd party integration

•  Slow feedback •  Test everything for each commit •  Huge deployment unit •  Deployment slow

Page 41: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Micro Services

ECommerce System

3rd party systems

Database

Order

Catalog

Billing Search

Page 42: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

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 Order

Billing

Customer

Page 43: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Build Pipeline for Micro Services

•  Independent deployment •  Build pipeline per Micro Service

•  Smaller •  Easier to set up •  Less features (3rd party systems) •  Faster Feedback: Less tests

Page 44: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Quick Deployments Time

Size & Risk

Manual Deployment

Pipeline

Continuous Delivery Pipeline

Monolith Micro Services

Page 45: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Why Micro Services? •  Strong modularization •  Small deployment units •  Faster & easier deployment •  Sustainable development speed •  Continuous Delivery •  Less risk in deployment •  Best technology for each service

Page 46: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Challenges

Page 47: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Distributed System

Page 48: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

1st Law of Distributed Objects •  Don’t Distribute Your Objects! •  Too much remote communication &

overhead •  Lesson learned from CORBA etc •  Micro Service should include a GUI

•  http://martinfowler.com/bliki/FirstLaw.html

Page 49: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Request

Response

Processing

Latency Round Trip: 0,2-0,5 ms = 600.000-1.500.000 instructions@3GHz

Page 50: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

1st Law of Distributed Objects & Micro Services

•  Small Micro Services mean a lot of communication

•  Violate the 1st Law •  Seems to work, though

•  http://martinfowler.com/articles/distributed-objects-microservices.html

Page 51: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Too small = too much

communication

Page 52: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Code Reuse •  Reuse across technology stacks hard •  Code dependencies are evil! •  Deployment dependency •  No more independent deployment •  Update hell

•  Avoid code reuse! •  Or make it Open Source projects (Netflix) •  Service reuse is fine

Page 53: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Global Refactorings? •  Move code from service to service •  Might be a port to a different

language •  Separate in a new service? •  More services = more complex

•  Very hard

Page 54: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Functional Architecture •  Teams should be independent •  i.e. one team = one functionality •  Otherwise: Coordination hard

•  Functional architecture much more important

Page 55: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Refactoring & Code Reuse

Individual Technology Stacks

Page 56: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Refactoring hard

Functional architecture much

more important

Page 57: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Need to get architecture

right first time

Architecture evolves

Page 58: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Start BIG •  Won’t have too much code at the

start anyway •  Refactoring easier •  Can build architecture as you go

•  Let the functional architecture grow!

Page 59: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Handling Interfaces •  Independent deployments =

backwards compatibility •  Different versions of the same service

run at the same time •  Only to allow updates •  i.e. transient

•  Minor issue

Page 60: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Managing Dependencies Between (>100) Services?

•  Monoliths can be easily analyzed •  Micro Services? •  With heterogeneous technology

stacks?

•  Need to come up with your own solution

Page 61: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Global Architecture? •  Manages dependencies •  Which service/team does what? •  Defines common communication

infrastructure •  Optional: Common Ops

•  Very different from usual architecture

Page 62: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Network? •  Micro Services = Distributed Systems •  Services & network might fail •  Need to deal with failure

•  Resilience: System must survive failure of parts

•  Makes system highly available

Page 63: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Deployment? •  One Deployment Pipeline per

services •  Should be fully automated •  Too many services for manual steps

•  Infrastructure investment needed •  Common deployment?

Page 64: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Infrastructure? •  >50 server per system •  Resource consumption probably

high

•  Virtualization must be fully automated

•  Docker might save ressources

Page 65: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Conclusion

Page 66: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Conclusion: Micro Services •  Micro Services are a new way of

modularization •  More technological freedom •  Easier, faster and less risky

deployment

Page 67: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Use If… •  Time to market is important •  Legacy systems must be

modernized •  Sustained development speed •  Continuous Delivery should be

implemented •  Large enough project

Page 68: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Don’t Use If… •  Infrastructure complexity cannot be

handled •  Architectural complexity cannot be

handled

Page 69: Micro Service – The New Architecture Paradigm

Eberhard Wolff - @ewolff

Thank You!