Top Banner

Click here to load reader

55
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 Services - Smaller is Better?

Micro Services Smaller is Better?

Eberhard Wolff Freelance consultant & trainer

http://ewolff.com

Page 2: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

Who has seen a system that

was too large?

Page 3: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

Who has seen a system that

was too small?

Page 4: Micro Services - Smaller is Better?

Little programs are delightful to write in

isolation, but the process of

maintaining large-scale software is always

miserable.

Jaron Lanier

Page 5: Micro Services - Smaller is Better?
Page 6: Micro Services - Smaller is Better?

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 Services - Smaller is Better?

Eberhard Wolff - @ewolff

Components Collaborate

Micro Service

Micro Service

Link

Data Replication

REST Messaging

Page 8: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

Why Micro Services? Strong

modularization Replaceability

Small units

Sustainable Development

speed

Continuous Delivery

Deployment less risky

Free Choice of technology

Page 9: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

Micro Service =

Micro?

Page 10: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

10-100LOChttp://yobriefca.se/blog/ 2013/04/28/micro-service-architecture/

Smaller modules better

Page 11: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

10-100LOChttp://yobriefca.se/blog/ 2013/04/28/micro-service-architecture/

Smaller modules better

Page 12: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

Game of Life

Page 13: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

life←{ ⍝ John Conway's "Game of Life". ↑1 ⍵∨.∧3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵ ⍝ Expression for next generation. }

Game of Life in one line of APL

dyalog.com LOC is really a bad metric

Page 14: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

Larger? •  Micro Services have an overhead

•  Build & deployment pipeline

•  Version control

Page 15: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

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

overhead •  Lesson learned from CORBA etc

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

Page 16: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

Request

Response

Processing

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

Page 17: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

1st Law of Distributed Objects & Micro Services

•  Small Micro Services = lot of communication

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

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

Page 18: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

Too small = too much

communication

Page 19: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff L

Page 20: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

Again: Why Micro Services?

Page 21: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

The main reason

Page 22: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

Business relevant

Page 23: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

How to scale agile?

Implement more feature

Page 24: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

Conways Law

Architecture copies

communication structures of the organization

Page 25: Micro Services - Smaller is Better?

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 26: Micro Services - Smaller is Better?

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 27: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

Each team can build and

deploy features independently!

Page 28: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

Micro Services must provide a sensible set of functionality

Page 29: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

Conway’s Law & Micro Service Size

•  Upper limit: What a (small) team can handle

•  …and a meaningful set of features •  Probably not too small •  Lower limit: Depends on overhead /

technology

Page 30: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

Micro Service = Micro? •  Size doesn’t matter too much

•  Teams must be able to work independently

•  Small enough for one team •  Not too much overhead

Page 31: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

Conway’s Law Product Owner

Service

Feature

Service

Page 32: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

Bad architecture?

Still can’t be avoided!

Page 33: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

Conway’s Law Product Owner

Service Service

Feature Product Owner

Communication

Priority?

Slow

Page 34: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

Conway’s Law •  Software Interface =

Team Communication •  Too much communication if you get

the architecture wrong.

•  Slows down the process

Page 35: Micro Services - Smaller is Better?

Collective Code

Ownership

Page 36: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

Conway’s Law Product Owner

Service Service

Feature Product Owner

Change

Review Pull Request

Page 37: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

Micro Service & Collective Code Ownership

•  Team might change any service •  Reviews can still be done •  …or use Pull Requests

•  More devs can work on a services •  Resilience against personnel turnover •  Faster

Page 38: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

Micro Service & Collective Code Ownership

•  Team must understand bigger parts of the code

•  Technology freedom?

Page 39: Micro Services - Smaller is Better?

Refactoring

Page 40: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

Refactoring

Service Service

Different libraries Different language Possibly a rewrite

Page 41: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

Limited Technology Set •  Easier Refactoring •  Easier to follow standards for deployment, monitoring etc •  Easier to implement e.g. resilience

•  Netflix uses a lot of Java

Page 42: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

Refactoring

Service Service

Library Releases must be coordinated

Hard to implement really reusable code Enforces same language / platform

Like: really, really hard

…and we want independent releases

Page 43: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

Refactoring

Service Service

Service Remote communication

Unreliable network Slower calls

Not great But best option

Page 44: Micro Services - Smaller is Better?

Number of Services

will increase

Page 45: Micro Services - Smaller is Better?

Refactoring across

Services hard

Page 46: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

Start BIG •  Conway’s law: Upper size =

what a team can handle •  Refactoring inside a service easier •  …needed for agile environments •  …where Micro Services are used •  Number will increase anyway •  Tear apart easier than join

Page 47: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

If You Start Small… •  You will get the architecture wrong •  Functionality hard to move •  Services not too large at the

beginning anyway •  Fast deployment still possible

Page 48: Micro Services - Smaller is Better?

Systems can not be

engineered

Page 49: Micro Services - Smaller is Better?

Systems grow.

Page 50: Micro Services - Smaller is Better?

Guide growth.

Page 51: Micro Services - Smaller is Better?

Sum Up

Page 52: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

Faster Time-to-Market

Micro Services Refactoring

Conway’s Law Collective Code Ownership

Start BIG

or

Page 53: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

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

Page 54: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

Leading Micro Services Conference

Berlin, 2015-2-12/13 http://microxchg.io/

Page 55: Micro Services - Smaller is Better?

Eberhard Wolff - @ewolff

Thank You!