size does matter - how to cut (micro-)services correctly

62
Size does(n’t) matter! How to cut a (Micro)Service correctly? Lars Röwekamp CIO New Technologies #wissenteilen @mobileLarson @_openKnowledge

Upload: open-knowledge-gmbh

Post on 13-Apr-2017

405 views

Category:

Software


0 download

TRANSCRIPT

Size does(n’t) matter! How to cut a (Micro)Service correctly?

Lars Röwekamp CIO New Technologies

#wissenteilen

@mobileLarson @_openKnowledge

Microservices Monolithic Design

Microservice Design Surviving Service Design

„Monolithic Design”

What’s your problem?

‣ Building features takes too long ‣ Architectural quality has degraded ‣ Technical debt is well-known and not addressed ‣ „-ility“ problems abound ‣ Deployment is way to complicated and slow ‣ Scalability has reached its limit

‣ Replacement would be way too expensive

#WISSENTEILENOFFENKUNDIGGUT

„For a monolithic to change all must agree on each

change.

Each change has unanticipated effects

requiring testing beforehand.“

What’s the problem?

#WISSENTEILENOFFENKUNDIGGUT

Monolithic „Module“ Release

What’s the problem?

#WISSENTEILENOFFENKUNDIGGUT

Monolithic „Module“ Release

What’s the problem?

#WISSENTEILENOFFENKUNDIGGUT

Monolithic „Module“ Release

What’s the problem?

#WISSENTEILENOFFENKUNDIGGUT

Monolithic „Module“ Release

Scary!

What’s the problem?

#WISSENTEILENOFFENKUNDIGGUT

What’s the problem? You want to be here.

#WISSENTEILENOFFENKUNDIGGUT

Load Balancer Multi Tenancy

Mic

rose

rvic

es

What’s the problem? You want to be here.

#WISSENTEILENOFFENKUNDIGGUT

@Runtime@Runtim

e

a.k.

a. „

Tim

e to

Mar

ket“

What’s the problem? You want to be here.

#WISSENTEILENOFFENKUNDIGGUT

„Help; needed it is.”

Microservices Monolithic Design

Microservice Design Surviving Microservice Design

Kind of Definition

#WISSENTEILENOFFENKUNDIGGUT

„In short, the microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API.”

Martin Fowler (thoughtworks)

„As wel l as the fact that serv ices are independently deployable and scalable, each service also provides a firm module boundary, even allowing for different services to be written in different programming languages. They can also be managed by different teams.”

Martin Fowler (thoughtworks)

Microservice Design

Charakteristika

Microservices

Monolith are you kidding?

#WISSENTEILENOFFENKUNDIGGUT

Charakteristika

Microservice Design Conway’s Law

#WISSENTEILENOFFENKUNDIGGUT

Charakteristika

„Any organization that designs a system (defined broadly) will

produce a design whose structure is a copy of the organization's

communication structure.“Conway’s Law (1967)

Microservice Design

#WISSENTEILENOFFENKUNDIGGUT

Microservice Design

Charakteristikafree choice of languagefree choice of DB

business driven teams„DevOps“

#WISSENTEILENOFFENKUNDIGGUT

‣Maintainability ‣ Freedom of Evolution ‣ Replaceability ‣ Scalability ‣ Reliability & Resilience ‣ Fault Tolerance

‣ „Time to Market“

Microservice Design

Sounds great, doesn’t it!

#WISSENTEILENOFFENKUNDIGGUT

Microservices Monolithic Design

Service Design Surviving Service Design

Charakteristika

Surviving Service Design Microservices?

#WISSENTEILENOFFENKUNDIGGUT

Charakteristika

Surviving Service Design

#WISSENTEILENOFFENKUNDIGGUT

Charakteristika

Surviving Service Design

„For most software projects, the primary focus should be on the domain and domain logic.“

Eric Evans, 2004

#WISSENTEILENOFFENKUNDIGGUT

Charakteristika

Surviving Service Design

„Complex domain design should be based on a model.“

Eric Evans, 2004

Abstraction of the domain!

#WISSENTEILENOFFENKUNDIGGUT

Surviving Service DesignSo, what is your Domain Model?

#WISSENTEILENOFFENKUNDIGGUT

Surviving Service Design

Domain Model

‣ Derive Objects (names) from shared language ‣ Evolve Model with the help

of all participants

‣ BTW: Changes in language lead to changes in model

#WISSENTEILENOFFENKUNDIGGUT

Surviving Service Design One model to rule them all.

#WISSENTEILENOFFENKUNDIGGUT

Surviving Service Design

Customer

ShoppingCart

Product

Kind of BIG, isn’t it?

#WISSENTEILENOFFENKUNDIGGUT

„A Unit, that can be handled in all aspects

by a small Team, a.k.a. two Pizza Team”

Oliver Wegner (OTTO)

Surviving Service Design

Customer

ShoppingCart

Product

How to split?

#WISSENTEILENOFFENKUNDIGGUT

Surviving Service Design

Customer

ShoppingCart

Product

The challenge:

‣ Split model into smaller parts without lost of DDD benefits

Possible conflicts:

‣ „different“ models ‣ „different“ understanding

#WISSENTEILENOFFENKUNDIGGUT

Surviving Service Design

Customer

ShoppingCart

Product

Split strategy: „Domain objects“

#WISSENTEILENOFFENKUNDIGGUT

„If every Service has to be updated at the same time, it’s

not loosely coupled!”by Adrian Cockcroft (ehemals Netflix)

„If you have to know too much about the surrounding services you don’t

have a bounded context!”by Adrian Cockcroft (ehemals Netflix)

Split strategy: „Domain objects“

Surviving Service Design

Customer

ShoppingCart

Product

#WISSENTEILENOFFENKUNDIGGUT

Surviving Service DesignSplit strategy:

„Bounded Context“

#WISSENTEILENOFFENKUNDIGGUT

Charakteristika

Surviving Service Design

Bounded Context, but how?

‣ clear borders ‣ business processes ‣ avoid inconsistencies

‣ e.g. check out ‣ e.g. present product ‣ e.g. „my“ recommendations

#WISSENTEILENOFFENKUNDIGGUT

Charakteristika

Surviving Service Design Dependencies?

Know your Neighbors!

#WISSENTEILENOFFENKUNDIGGUT

Surviving Service Design Context Map

Model still consistent?

Data Owner? Data still consistent?

#WISSENTEILENOFFENKUNDIGGUT

„Starbucks does not use Two-Phase Commit“http://www.enterpriseintegrationpatterns.com/ramblings/18_starbucks.html

Surviving Service Design Shared Kernel

Mine? Yours?

#WISSENTEILENOFFENKUNDIGGUT

Surviving Service Design Shared Kernel

Versioning?

#WISSENTEILENOFFENKUNDIGGUT

„Be conservative in what you do, be liberal in what you expect.“

Postel’s Law (a.k.a. robustness principle)

Surviving Service Design Versioning?

#WISSENTEILENOFFENKUNDIGGUT

Surviving Service Design Shared Kernel

Me, too!

And me, too!I need this!

#WISSENTEILENOFFENKUNDIGGUT

Surviving Service Design

Customer

ShoppingCart

Product

Core Domain

#WISSENTEILENOFFENKUNDIGGUT

Surviving Service Design Evolution?

#WISSENTEILENOFFENKUNDIGGUT

Charakteristika

Surviving Service Design

http://techblog.net.lix.com/2013/01/announcing-ribbon-tying-net.lix-mid.html

#WISSENTEILENOFFENKUNDIGGUT

Charakteristika„A Microservice never walks alone!“

me, myself and I (2015)

Surviving Service Design

#WISSENTEILENOFFENKUNDIGGUT

Surviving Service Design

Bounded Context

Ubiquitous Language

names enter

Continous Integration

keep model unified by

Context Map assess/overview relationships with

Shared Kernel

Overlap allied contexts through Customer Supplier Teams relate allied contexts as

Conformist overlap unilaterally as

Open Host Service

support multiple clients through

Published Language

formalize as

Separate Ways

free teams to go

Anticorruption Layer

translate and insulate unilaterally with

#WISSENTEILENOFFENKUNDIGGUT

Surviving Service Design

Bounded Context

Ubiquitous Language

names enter

Continous Integration

keep model unified by

Context Map assess/overview relationships with

Shared Kernel

Overlap allied contexts through Customer Supplier Teams relate allied contexts as

Conformist overlap unilaterally as

Open Host Service

support multiple clients through

Published Language

formalize as

Separate Ways

free teams to go

Anticorruption Layer

translate and insulate unilaterally with

#WISSENTEILENOFFENKUNDIGGUT

Surviving Service Design

Bounded Context

Ubiquitous Language

names enter

Continous Integration

keep model unified by

Context Map assess/overview relationships with

Shared Kernel

Overlap allied contexts through Customer Supplier Teams relate allied contexts as

Conformist overlap unilaterally as

Open Host Service

support multiple clients through

Published Language

formalize as

Separate Ways

free teams to go

Anticorruption Layer

translate and insulate unilaterally with

#WISSENTEILENOFFENKUNDIGGUT

Charakteristika

Surviving Service Design Microservices?

#WISSENTEILENOFFENKUNDIGGUT

Surviving Service Design

Search

History

Recommendations

User ManagementShopping Cart

Check out!

#WISSENTEILENOFFENKUNDIGGUT

Surviving Service Design

Product

User ManagementShopping Cart

History

Recommendations

Product presentation!

#WISSENTEILENOFFENKUNDIGGUT

„Size does matter" by Lars Röwekamp (open knowledge GmbH)

Surviving Service Design

Shopping Cart

HistoryShipping

User Management

Customer Self Care!

Size does(n’t) matter A personal point of View

My point of view

‣ „Use a shared common Language“

‣ „Know your Domain Model“ ‣ „Know your Bounded Contexts“ ‣ „Know your Neighbors“

‣ „Think (also) in Processes not only in Objects“ ‣ „Be a tolerant Reader and a strict Supplier“

‣ BTW: „Talking to each other is still allowed!“#WISSENTEILENOFFENKUNDIGGUT

Charakteristika? ? ?#WISSENTEILENOFFENKUNDIGGUT

Charakteristika

#WISSENTEILENOFFENKUNDIGGUT

Picture Credits …

‣ #1: iStock.com / Andrew Rich (000029536120) ‣ #3: photo © Daniel Steger for openphoto.net ‣ #10: The Art of Scalability / theartofscalability.com ‣ #13: iStock.com / jpgfactory (000059091620) ‣ #15: iStock.com / VisualField (3096596) ‣ #16: Wikimedia / Webysther 20150414193208 ‣ #25: iStock.com / PeopleImages (62387488) ‣ #26: dddcommunity.org/uncategorized/about_the_cover ‣ #32: twitter.com/olliwegner ‣ #36: aws.amazon.com/de/heroes/usa/adrian-cockcroft/ ‣ #44: pixabay.com ‣ #51: techblog.netflix.com/2013/01/announcing-ribbon-tying-netflix-mid.html