5. @crichardson
Agenda
1. What is the microservice architecture?
2. How small is a microservice?
3. Why is the microservice architecture important?
4. Is the monolithic architecture an anti-pattern?
5. What are the key challenges with using microservices?
6. How do you migrate a monolith to a microservice
architecture?
6. Pattern: microservice
architecture
Highly maintainable and
testable
Minimal lead time (time from
commit to deploy)
Loosely coupled
Independently deployable
Implements a business
capability
Owned/developed/tested/
deployed by a small team
An architectural
style
that structures an
application as a
set of deployable/
executable units,
a.k.a. services
A service is:
7. @crichardson
Food to Go: Microservice
architecture
Browser
Mobile
Application
API
Gateway
Order
Service
Restaurant
Service
Delivery
Service
…
Service
Order
Database
Restaurant
Database
Delivery
Database
…
Database
REST
REST
JavaScript
Message
Broker
8. @crichardson
Service architecture “mirrors”
the business
FTGO business
Kitchen Service
Delivery Service
Order Taking
Kitchen
Delivery
Accounting
….
….
Service
Order Service
Accounting Service
Maps to
Maps to
Maps to
Maps to
Maps to
Area of the business,
a.k.a.
Subdomain or Business Capability
9. @crichardson
API
The structure of a service
Operations
Event
Publisher
Commands
Queries
Synchronous
REST/gRPC
Asynchronous
Messaging
Events
Event
Subscriber
API
Client
Invokes
Operations
Events
Service
Database
Private!
10. @crichardson
Agenda
1. What is the microservice architecture?
2. How small is a microservice?
3. Why is the microservice architecture important?
4. Is the monolithic architecture an anti-pattern?
5. What are the key challenges with using microservices?
6. How do you migrate a monolith to a microservice
architecture?
12. @crichardson
Service too large*: split service
Service
Small, autonomous
team
Service
Service
*Too large => unable to achieve desired -ilities, e.g.
short lead time (build/test/deploy time)
13. @crichardson
Agenda
1. What is the microservice architecture?
2. How small is a microservice?
3. Why is the microservice architecture important?
4. Is the monolithic architecture an anti-pattern?
5. What are the key challenges with using microservices?
6. How do you migrate a monolith to a microservice
architecture?
17. Required architectural quality
attributes (a.k.a. -ilities)
“Complete their work without
communicating and coordinating with
people outside their team”
“Make large-scale changes to the design
of their system without depending on
other teams to make changes in their
systems or creating significant work for
other teams”
“We can do most of our testing without
requiring an integrated environment.”
“We can and do deploy or release our
application independently of other
applications/services it depends on.”
Loosely coupled
(Conway’s law)
Modular
Testable
Deployable
API encapsulates design decisions
18. @crichardson
Architecture quality attributes
for sustainable development
Time
Technology A Technology B
V1 V2 V3 V…
Importance
The importance of a technology changes over time
Evolvability - Must be able to upgrade the
technology stack of long-lived applications
21. @crichardson
Agenda
1. What is the microservice architecture?
2. How small is a microservice?
3. Why is the microservice architecture important?
4. Is the monolithic architecture an anti-pattern?
5. What are the key challenges with using microservices?
6. How do you migrate a monolith to a microservice
architecture?
22. @crichardson
Tomcat/App. Server
Food To Go: Monolithic
architecture
Browser/
Client
WAR/EAR
MySQL
Database
Delivery
management
Order
Management
Kitchen
Management
Web UI
Restaurant
Management
HTML
REST/JSON
The application
23. -ilities of small monoliths
Testability
Deployability
Maintainability
Modularity
Evolvability
✅
✅
✅
✅
✅
(full rewrite)
24. @crichardson
Rapid, frequent and reliable delivery
eventually becomes impossible
Time
Maintainability
Testability
Deployability
Modularity
Evolvability
Size/
Complexity
-ilities required to be competitive
Risk of
disruption
25. @crichardson
Lack of sustainability:
Many decisions are global = difficult/
impossible to change incrementally
Programming language
Versions of dependencies - libraries and
frameworks
…
26. @crichardson
Agenda
1. What is the microservice architecture?
2. How small is a microservice?
3. Why is the microservice architecture important?
4. Is the monolithic architecture an anti-pattern?
5. What are the key challenges with using microservices?
6. How do you migrate a monolith to a microservice
architecture?
28. @crichardson
Challenge: minimizing
coupling between services
Minimize design-time coupling
Design-time coupling = services changing in lockdown
Reduces productivity by increasing coordination between teams
How: DRY services, Iceberg services, avoiding shared database/
business logic libraries
Minimize runtime coupling
Runtime coupling - e.g. chains of REST calls
Reduces availability
How: use Self-contained services
29. @crichardson
Agenda
1. What is the microservice architecture?
2. How small is a microservice?
3. Why is the microservice architecture important?
4. Is the monolithic architecture an anti-pattern?
5. What are the key challenges with using microservices?
6. How do you migrate a monolith to a microservice
architecture?
34. Cost vs. Benefit of extraction
Benefit
Solves a significant
problem
Velocity frequently
updated
Scalability Conflicting
resource requirements
…
Cost
Cost of changing the
monolith and adapting/
rewriting module
Difficulty in decoupling/
breaking dependencies
Need to participate in
sagas/compensating
transactions
36. @crichardson
Measuring success
Success != Number of Microservices
Improved metrics:
Reduced lead time
Increased deployment frequency
Reduced changed failure rate
Improvements in other -ilities
…
Anti-pattern:
Microservices as the goal
https://chrisrichardson.net/post/antipatterns/2019/01/14/antipattern-microservices-are-the-goal.html
37. @crichardson
Summary
Modern enterprises need to deliver software rapidly frequently, reliably and
sustainably
This requires a loosely coupled, modular, testable and deployable
architecture
The monolithic architecture is not anti-pattern but its often best for smaller
applications
The microservice architecture is often better for large/complex
applications
Loosely coupled services are essential
Use the Strangler pattern to migrate a monolith to microservices