Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s...
Transcript of Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s...
![Page 1: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/1.jpg)
Microservices Smaller is Better?
Eberhard Wolff Freelance consultant & trainer
http://ewolff.com
![Page 2: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/2.jpg)
Eberhard Wolff - @ewolff
Why Microservices?
![Page 3: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/3.jpg)
Eberhard Wolff - @ewolff
Why Microservices? Strong
modularization Replaceability
Small units
Sustainable Development
speed
Continuous Delivery
Deployment less risky
Free Choice of technology
![Page 4: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/4.jpg)
Eberhard Wolff - @ewolff
Microservice =
Micro?
![Page 5: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/5.jpg)
Eberhard Wolff - @ewolff
10-100LOChttp://yobriefca.se/blog/ 2013/04/28/micro-service-architecture/
Smaller modules better
![Page 6: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/6.jpg)
Eberhard Wolff - @ewolff
10-100LOChttp://yobriefca.se/blog/ 2013/04/28/micro-service-architecture/
Smaller modules better
![Page 7: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/7.jpg)
Eberhard Wolff - @ewolff
Game of Life
![Page 8: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/8.jpg)
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 9: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/9.jpg)
Eberhard Wolff - @ewolff
Larger? • Microservices have an overhead
• Build & deployment pipeline
• Version control
![Page 10: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/10.jpg)
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 11: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/11.jpg)
Eberhard Wolff - @ewolff
Request
Response
Processing
Latency Round Trip: 0,2-0,5 ms = 600.000-1.500.000 instructions@3GHz
![Page 12: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/12.jpg)
Eberhard Wolff - @ewolff
1st Law of Distributed Objects & Microservices
• Small Microservices = lot of communication
• Violates the 1st Law • Seems to work, though
• http://martinfowler.com/articles/distributed-objects-microservices.html
![Page 13: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/13.jpg)
Eberhard Wolff - @ewolff
Too small = too much
communication
![Page 14: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/14.jpg)
Eberhard Wolff - @ewolff L
![Page 15: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/15.jpg)
Eberhard Wolff - @ewolff
Again: Why
Microservices?
![Page 16: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/16.jpg)
Eberhard Wolff - @ewolff
The main reason
![Page 17: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/17.jpg)
Eberhard Wolff - @ewolff
Business relevant
![Page 18: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/18.jpg)
Eberhard Wolff - @ewolff
How to scale agile?
Implement more feature
![Page 19: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/19.jpg)
Eberhard Wolff - @ewolff
Conways Law
![Page 20: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/20.jpg)
Eberhard Wolff - @ewolff
The Law That I Must Not Name
Architecture copies
communication structures of the organization
![Page 21: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/21.jpg)
Eberhard Wolff - @ewolff
Conway’s Law as an Enabler • Desired architecture =
project structure • Microservices belong to one team • Team should be responsible for
meaningful features • Ideal: Independent features
![Page 22: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/22.jpg)
Eberhard Wolff - @ewolff
Each team can build and
deploy features independently!
![Page 23: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/23.jpg)
Eberhard Wolff - @ewolff
Microservices must provide a sensible set of functionality
![Page 24: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/24.jpg)
Eberhard Wolff - @ewolff
Conway’s Law & Microservice 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 25: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/25.jpg)
Eberhard Wolff - @ewolff
Microservice = Micro? • Size doesn’t matter too much
• Teams must be able to work independently
• Small enough for one team • Not too much overhead
![Page 26: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/26.jpg)
Eberhard Wolff - @ewolff
Conway’s Law Product Owner
Service
Feature
Service
![Page 27: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/27.jpg)
Eberhard Wolff - @ewolff
Bad architecture?
Still can’t be avoided!
![Page 28: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/28.jpg)
Eberhard Wolff - @ewolff
Conway’s Law Product Owner
Service Service
Feature Product Owner
Communication
Priority?
Slow
![Page 29: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/29.jpg)
Eberhard Wolff - @ewolff
Conway’s Law • Software Interface =
Team Communication • Too much communication if you get
the architecture wrong.
• Slows down the process
![Page 30: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/30.jpg)
Collective Code
Ownership
![Page 31: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/31.jpg)
Eberhard Wolff - @ewolff
Conway’s Law Product Owner
Service Service
Feature Product Owner
Change
Review Pull Request
![Page 32: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/32.jpg)
Eberhard Wolff - @ewolff
Microservice & 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 33: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/33.jpg)
Eberhard Wolff - @ewolff
Microservice & Collective Code Ownership
• Team must understand bigger parts of the code
• Technology freedom?
![Page 34: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/34.jpg)
Refactoring
![Page 35: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/35.jpg)
Eberhard Wolff - @ewolff
Refactoring
Service Service
Different libraries Different language Possibly a rewrite
![Page 36: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/36.jpg)
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 37: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/37.jpg)
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 38: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/38.jpg)
Eberhard Wolff - @ewolff
Refactoring
Service Service
Service Remote communication
Unreliable network Slower calls
Not great But best option
![Page 39: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/39.jpg)
Number of Services
will increase
![Page 40: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/40.jpg)
Refactoring across
Services hard
![Page 41: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/41.jpg)
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 Microservices are used • Number will increase anyway • Tear apart easier than join
![Page 42: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/42.jpg)
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 43: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/43.jpg)
Systems can not be
engineered
![Page 44: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/44.jpg)
Systems grow.
![Page 45: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/45.jpg)
Guide growth.
![Page 46: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/46.jpg)
Sum Up
![Page 47: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/47.jpg)
Eberhard Wolff - @ewolff
Faster Time-to-Market
Microservices Refactoring
Conway’s Law Collective Code Ownership
Start BIG
or
![Page 48: Microservices Smaller is Better? - microXchg · Eberhard Wolff - @ewolff Start BIG • Conway’s law: Upper size = what a team can handle • Refactoring inside a service easier](https://reader030.fdocuments.net/reader030/viewer/2022041014/5ec5b5efed9bba756104289b/html5/thumbnails/48.jpg)
Eberhard Wolff - @ewolff
Thank You!