This is a talk I gave at PLoP 2017 - http://www.hillside.net/plop/2017/index.php?nav=program
The microservice architecture is growing in popularity. It is an architectural style that structures an application as a set of loosely coupled services that are organized around business capabilities. Its goal is to enable the continuous delivery of large, complex applications. However, the microservice architecture is not a silver bullet and it has some significant drawbacks.
The goal of the microservices pattern language is to enable software developers to apply the microservice architecture effectively. It is a collection of patterns that solve architecture, design, development and operational problems. In this talk, I’ll provide an overview of the microservice architecture and describe the motivations for the pattern language. You will learn about the key patterns in the pattern language.
5. @crichardson
About Chris
Founder of a startup that is creating
an open-source/SaaS platform
that simplifies the development of
transactional microservices
(http://eventuate.io)
10. @crichardson
How to move fast and not
break things?
Architecture:
Process:
Small,
autonomous teams
????
DevOps/Continuous delivery/deployment
Organization:
16. The microservice architecture is an
architectural style that
structures an application as a
set of loosely coupled, services
organized around business
capabilities
22. Scales development: develop, deploy
and scale each service independently
Small, autonomous teams
Clearly defined
responsibilities
Catalog
Service
Review
Service
Order
Service
…
Service
Catalog
Team
Review
Team
Order
Team
…
Team
Responsible
for
36. @crichardson
When using microservices:
How to decompose an application into services?
How to deploy an application’s services?
How to handle cross cutting concerns?
Which communication mechanisms to use?
How do external clients communicate with the services?
How does a client discover the network location of a service instance?
How to prevent a network or service failure from cascading to other services?
How to maintain data consistency and implement queries?
How to make testing easier?
How to understand the behavior of an application and troubleshoot problems?
How to implement a UI screen or page that displays data from multiple services?
39. @crichardson
The structure of a pattern
encourages objectivity
Resulting context
aka the situation
Name
Context
Problem
Related patterns
(conflicting) issues
etc to address
Forces
Solution Benefits
Drawbacks
Issues to resolve
Alternatives
Solutions to issues
40. @crichardson
Microservice architecture pattern
Context Developing large, complex architecture
Problem What’s the runtime architecture?
Benefits Faster development
Easy adopt new technologies
Drawbacks Complexity of a distributed system
Issues Decomposition
Distributed system issues: IPC, discovery, …
Alternative patterns Monolithic architecture
Successor patterns Service Registry, API Gateway, …
44. @crichardson
The pattern language guides you
when developing an architecture
What architectural decisions you must make
For each decision:
Available options
Trade-offs of each option
48. Problem: How to decompose
an application into services?
Forces
Stability
Cohesive
Loosely coupled
Not too large
Decompose by
business capability
Decompose by
subdomain
Organize around
business capabilities
Organize around DDD
subdomains
49. Problem: how to ensure
services are loosely coupled?
Forces:
Services must be
loosely coupled
Evolving schema of
shared database =
coordination
… Ensures loose coupling
50. @crichardson
Problem: how to maintain
data consistency?
Context
• Each service has its own
database
• Data is private to a service
Forces
Transactional data consistency
must be maintained across
multiple services
2PC is not an option
51. @crichardson
Problem: how to perform
queries?
CQRS
Context
Each service has its own
database
Forces
Queries must join data
from multiple services
Data is private to a service
Maintain query views by
subscribing to events
API
Composition
52. @crichardson
Problem: How do services
communicate?
Messaging
Remote Procedure
Invocation
Domain-specific
Forces
Services must
communicate
Usually processes on
different machines
…
54. @crichardson
Problem: How to handle cross
cutting concerns?
Microservice
Chassis
Forces
Every service must
implement logging;
externalize configuration;
health check endpoint;
metrics; …
55. Problem: How to deploy an
application’s services?
Multiple Services
per host
Single Service per
Host
Service-per-
Container
Service-per-VM
Serverless
deployment
Service deployment
platform
Forces
Multiple languages
Isolated
Constrained
Monitor-able
Reliable
Efficient
56. @crichardson
Problem: How to discover a service
instance’s network location?
Client-side discovery
Server-side
discovery
Service registry
Self registration
3rd party registration
Forces
Client needs IP address of
service instance
Dynamic IP addresses
Dynamically provisioned
instances
59. @crichardson
Problem: how to monitor the
behavior of your application?
Exception
tracking
Distributed
tracing
Audit logging
Application
metrics
Log
aggregation
Health check
API
60. @crichardson
Summary
The monolithic architecture is a good choice for small/simple
applications
Use the microservice architecture for large/complex
applications
Microservice architecture != silver bullet
Use the microservice architecture pattern language to guide
your decision making