microservices. the good, the bad and the ugly
TRANSCRIPT
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 1
@aahoogendoorn | www.ditisagile.nl
Microservices.Stairway to heaven or highway to hell?Sander Hoogendoornditisagile.nlMentoring ▪ Consulting ▪ TrainingAgile ▪ Software architecture ▪ Code
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 2
Sander Hoogendoorn
MeDadMentor, trainer, software architect, programmerBooks, articles, conferences
WorkOwner ditisagile.nlCTO Klaverblad Insurances
Webwww.sanderhoogendoorn.com@[email protected]
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 5
@aahoogendoorn | www.ditisagile.nl
Monoliths Hard to deliver, even harder to test and impossible to maintain
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 7
AdvantagesA single (layered) architectureA single technology stackA single code base maintained by multiple teams
DisadvantagesAll parts are interconnectedMany other systems are connected to your systemHard to change, hard to maintainLong time between releases, thereby increasing risksSlow innovationHard to move to newer technologiesDoesn’t scale very well
MonolithsAdvantages and disadvantages
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 8
Dependencies will kill youA typical systems landscape
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 9
@aahoogendoorn | www.ditisagile.nl
A brief history of components and services
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 11
Component based development
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 12
Service oriented architecture
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 15
@aahoogendoorn | www.ditisagile.nl
MicroservicesBeyond the hype?
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 16
MicroservicesBeyond the hype?
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 17
Gartner hype cycle
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 18
@aahoogendoorn | www.ditisagile.nl
MicroservicesThe clear benefits
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 19
But first … a definition
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 20
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.
These services are built around business capabilities and independently deployable by fully automated deployment machinery. There is a bare minimum of centralized management of these services, which may be written in different programming languages and use different data storage technologies.
Martin Fowler
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 21
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.
These services are built around business capabilities and independently deployable by fully automated deployment machinery. There is a bare minimum of centralized management of these services, which may be written in different programming languages and use different data storage technologies.
Martin Fowler
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 22
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.
These services are built around business capabilities and independently deployable by fully automated deployment machinery. There is a bare minimum of centralized management of these services, which may be written in different programming languages and use different data storage technologies.
Martin Fowler
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 23
MonolithsScalability
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 24
MicroservicesScalability
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 25
MicroservicesScalability
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 26
MicroservicesRunning in their own processes
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 27
MonolithsPersistence
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 28
MicroservicesPolyglot persistence
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 29
Products not projectsScalableDecentralized governanceReplaceable partsHigh performanceTechnology independentPolyglot persistenceEasy to buildEasy to testEasier deployment than monoliths
MicroservicesPromises
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 30
What is a microservice exactly?How small is a microservice?Requirements in a microservice worldComponents or servicesWho owns a microservice?What technologies do you use?What protocols do you apply?How to define messagesHow to test microservicesHow to coordinate when business services run across components?How to build deployment pipelines?
MicroservicesBut…
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 31
Opinions, opinions, opinions
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 32
@aahoogendoorn | www.ditisagile.nl
Are microservicesa stairway to heaven?
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 33
@aahoogendoorn | www.ditisagile.nl
Or are they a highway to hell?
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 34
@aahoogendoorn | www.ditisagile.nl
Two real world cases
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 35
A major insurance companyCase 1
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 36
Where do we come from?Case 1
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 37
Where do we come from?Case 1
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 38
Outsourcing didn’t workCase 1
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 39
Where are we going to?Case 1
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 40
A product development companyCase 2
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 41
Where do we come from?Case 2
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 42
Where do we come from?Case 2
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 44
For the things we have to learn before we can do them, we learn by doing them
Aristotle
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 45
@aahoogendoorn | www.ditisagile.nl
So what did we learn?
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 46
Microservices require an evolutionary architecture
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 47
@aahoogendoorn | www.ditisagile.nl
Start with some guiding principles
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 49
@aahoogendoorn | www.ditisagile.nl
Business processes firstCase 1
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 50
Different levels of processes (and requirements)
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 55
@aahoogendoorn | www.ditisagile.nl
Architecture firstCase 2
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 56
Current architectural layoutCase 2
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 57
New architectural layoutCase 2
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 58
New architectural layoutCase 2
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 59
Brownfield migration…Case 2
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 61
@aahoogendoorn | www.ditisagile.nl
Designing microservicesModular design and bounded contexts
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 62
Doing big up-front design is dumb,doing no design is even dumber
Dave Thomas
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 64
The single unified domain model
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 68
@aahoogendoorn | www.ditisagile.nl
Modeling resources
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 69
Interpretations of interpretations interpreted
James Joyce(on REST)
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 70
Root resource (component)
GET the collection, but only limited to this representation (but with locations likely)
GET a single item from the collection, but with representation
Modeling resources
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 72
@aahoogendoorn | www.ditisagile.nl
Being RESTfulis not as easy as it seems
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 73
HTTP return codes cheat sheet
1**. Hold on 2**. Here you go
3**. Go away 4**. You fucked up
5**. I fucked up
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 74
Be conservative in what you send, be liberal in what you accept
Postel’s Law
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 76
@aahoogendoorn | www.ditisagile.nl
Testing microservices
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 77
If you fail, fail fast
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 78
A service development lifecycle
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 80
Even though you might have brilliant testers…
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 81
… please automate your tests
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 82
What about these services being independently deployable?
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 83
@aahoogendoorn | www.ditisagile.nl
Deploying microservicesContinuous integrationand build pipelines
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 84
A typical build pipeline
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 85
A typical build pipeline
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 86
Build pipelines in Jenkins
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 89
There is no one tool to rule them allWe tried Jenkins, Bamboo, Team City, GoCD and then Jenkins again…
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 90
@aahoogendoorn | www.ditisagile.nl
DeployingmicroservicesKaizen, minimal viable products and continuous delivery
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 92
Small increments or big releases?What if Twitter…
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 93
Roadmaps over plansWhile there is value in the items on the right, we value the items on the left more
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 94
Minimal viable product
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 95
From projects to continuous delivery
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 97
You build it, you run itWerner Vogels
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 98
Moving towards DevOps is not easyIt feels like showing up at the wrong re-enactment
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 101
@aahoogendoorn | www.ditisagile.nl
In retrospectiveSome final thoughts
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 102
Microservices are not for everyone
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 103
Minimal viable product
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 104
@aahoogendoorn | www.ditisagile.nl
Allow your teams to learn continuously…
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 105
The hockey stick model
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 107
@aahoogendoorn | www.ditisagile.nl
And don’t forgetto have fun
@aahoogendoorn | www.ditisagile.nlMicroservices. The good, the bad and the ugly 108
@aahoogendoorn | www.ditisagile.nl
References and questionswww.sanderhoogendoorn.comwww.smartusecase.comwww.speedbird9.com
@aahoogendoorn