Microservices vs The distributed monolith
Christopher Riley
PHP Scotland 2016
1
Slide 2
Slide 2 text
Introduction
Slide 3
Slide 3 text
Monolith vs Microservices
2
Slide 4
Slide 4 text
Key features of a monolith architecture
• A monolith is a single app combining multiple business
functions.
3
Slide 5
Slide 5 text
Key features of a monolith architecture
• A monolith is a single app combining multiple business
functions.
• A monolith is deployed and scaled as a whole.
3
Slide 6
Slide 6 text
Key features of a monolith architecture
• A monolith is a single app combining multiple business
functions.
• A monolith is deployed and scaled as a whole.
• A monolith is developed on a single technology stack.
3
Slide 7
Slide 7 text
Key features of a microservice architecture
• A microservice should have one responsibility.
4
Slide 8
Slide 8 text
Key features of a microservice architecture
• A microservice should have one responsibility.
• Each microservice should be independent.
4
Slide 9
Slide 9 text
Key features of a microservice architecture
• A microservice should have one responsibility.
• Each microservice should be independent.
• A microservice should have a defined API.
4
Slide 10
Slide 10 text
Key features of a microservice architecture
• A microservice should have one responsibility.
• Each microservice should be independent.
• A microservice should have a defined API.
• Smart endpoints, dumb pipes
4
Slide 11
Slide 11 text
Advantages of microservices
• Improved modularisation of code
5
Slide 12
Slide 12 text
Advantages of microservices
• Improved modularisation of code
• Allows diverse technology stacks
5
Slide 13
Slide 13 text
Advantages of microservices
• Improved modularisation of code
• Allows diverse technology stacks
• Independent deployment and scaling
5
Slide 14
Slide 14 text
Advantages of microservices
• Improved modularisation of code
• Allows diverse technology stacks
• Independent deployment and scaling
• Smaller code base
5
Slide 15
Slide 15 text
Disadvantages of microservices
• Availability
6
Slide 16
Slide 16 text
Disadvantages of microservices
• Availability
• Knowledge siloing
6
Slide 17
Slide 17 text
Disadvantages of microservices
• Availability
• Knowledge siloing
• Testing of whole system is complex
6
Slide 18
Slide 18 text
Disadvantages of microservices
• Availability
• Knowledge siloing
• Testing of whole system is complex
• Orchestration of system is harder
6
Slide 19
Slide 19 text
The Distributed Monolith
Slide 20
Slide 20 text
Don’t panic
6
Slide 21
Slide 21 text
The common library
Slide 22
Slide 22 text
What makes this so bad?
• Microservices loose their independence.
7
Slide 23
Slide 23 text
What makes this so bad?
• Microservices loose their independence.
• The common library becomes huge.
7
Slide 24
Slide 24 text
What makes this so bad?
• Microservices loose their independence.
• The common library becomes huge.
• The common library becomes unstable.
7
Slide 25
Slide 25 text
What makes this so bad?
• Microservices loose their independence.
• The common library becomes huge.
• The common library becomes unstable.
• Discourages technological diversity.
7
Slide 26
Slide 26 text
What is the solution?
• Small focused libraries
8
Slide 27
Slide 27 text
What is the solution?
• Small focused libraries
• Only include what is required
8
Slide 28
Slide 28 text
What is the solution?
• Small focused libraries
• Only include what is required
• Composer can help you
8
Slide 29
Slide 29 text
What is the solution?
• Small focused libraries
• Only include what is required
• Composer can help you
• Sometimes you just have to copy + paste
8
Slide 30
Slide 30 text
Interdependent deployments
Slide 31
Slide 31 text
What makes this so bad?
• Live demo!
9
Slide 32
Slide 32 text
What makes this so bad?
• Live demo!
• Each simultaneous deployment increases risk
9
Slide 33
Slide 33 text
What makes this so bad?
• Live demo!
• Each simultaneous deployment increases risk
• What about rollbacks?
9
Slide 34
Slide 34 text
What is the solution?
• API versioning
10
Slide 35
Slide 35 text
What is the solution?
• API versioning
• Feature flags
10
Slide 36
Slide 36 text
What is the solution?
• API versioning
• Feature flags
• Automation
10
Slide 37
Slide 37 text
Temporal coupling
Slide 38
Slide 38 text
Booking a ticket
11
Slide 39
Slide 39 text
Booking a ticket
11
Slide 40
Slide 40 text
Booking a ticket
11
Slide 41
Slide 41 text
Booking a ticket
11
Slide 42
Slide 42 text
Booking a ticket
11
Slide 43
Slide 43 text
Booking a ticket
11
Slide 44
Slide 44 text
Booking a ticket
11
Slide 45
Slide 45 text
Booking a ticket
11
Slide 46
Slide 46 text
Booking a ticket
11
Slide 47
Slide 47 text
What makes this so bad?
• Performance
12
Slide 48
Slide 48 text
What makes this so bad?
• Performance
• Services must wait for a response
12
Slide 49
Slide 49 text
What makes this so bad?
• Performance
• Services must wait for a response
• What happens when something fails?
12