There are many design patterns for building microservices, and most of them are wrong. Actually, that is not true. The fundamental objectives for implementing microservice systems are speed and agility. Speed, of course, is how quickly you can get things done. Regardless of what design patterns you ...
There are many design patterns for building microservices, and most of them are wrong. Actually, that is not true. The fundamental objectives for implementing microservice systems are speed and agility. Speed, of course, is how quickly you can get things done. Regardless of what design patterns you use, if you can quickly build, fix, enhance, and rapidly evolve your microservices, you are heading in the right direction. Agility is the flexibility to move rapidly across the entire development lifecycle while living happily in production.
But we can always do better. Right?
That is what this talk is about. We will take a look at some of the more common microservice design patterns. And we will compare them to some of the alternatives. For example, what is the more common microlith design pattern, and how getting serious about loose coupling guides the evolution to ways that increase your speed and agility? We will also look at why it is micro at the code level and the data level. Finally, we will cover some practical guidelines, such as why your microservices should do the least amount of work while your users are waiting and techniques for doing that.
What is a Microlith?
A microlith is a distributed monolith.
●Microservices are tightly coupled
●Monolithic database
What are tightly coupled
microservices?
Have RPC dependencies with other
microservices.
Communicate synchronously via RESTful
RPC calls with other microservices.
What happens
when, not if, WHEN
something fails?
Something
went wrong.
Please try
again later.
Tightly coupled synchronous RESTful RPC
Tightly coupled synchronous RESTful RPC
Tightly coupled synchronous RESTful RPC
Tightly coupled synchronous RESTful RPC
Loose Coupling
Event driven asynchronous communication
Loosely coupled asynchronous messaging
Loosely coupled asynchronous messaging
Loosely coupled asynchronous messaging
Loosely coupled asynchronous messaging
Still a Microlith?
Best effort to decouple all or most
microservices.
Database is still monolithic.
Loosely coupled microservices
Asynchronous intra service
messaging
Each service owns its own
schema/data
Shared outside perspective
Hidden private inside perspective
Each microservice owns its own schema/data
Outside perspective
Inside perspective
Outside perspective
Event Oriented Microservices
Do the least amount of work while
someone or something is waiting
Push work out-of-band done
asynchronously in the background
Goals - not rules - to guide how you build your microservices
Implement loosely coupled microservices - asynchronous messaging
Make asynchronous messaging the norm, synchronous messaging the exception
Each microservice owns its own schema
Turn data reference sources (e.g. customer data) into data change publishers
Make event-oriented the norm, traditional CRUD the exception
Always do the - when this thing breaks - analysis to uncover weak, brittle patterns
Goals - not rules - to guide how you build your microservices
Implement loosely coupled microservices - asynchronous messaging
Make asynchronous messaging the norm, synchronous messaging the exception
Each microservice owns its own schema
Turn data reference sources (e.g. customer data) into data change publishers
Make event-oriented the norm, traditional CRUD the exception
Always do the - when this thing breaks - analysis to uncover weak, brittle patterns
Goals - not rules - to guide how you build your microservices
Implement loosely coupled microservices - asynchronous messaging
Make asynchronous messaging the norm, synchronous messaging the exception
Each microservice owns its own schema
Turn data reference sources (e.g. customer data) into data change publishers
Make event-oriented the norm, traditional CRUD the exception
Always do the - when this thing breaks - analysis to uncover weak, brittle patterns
Goals - not rules - to guide how you build your microservices
Implement loosely coupled microservices - asynchronous messaging
Make asynchronous messaging the norm, synchronous messaging the exception
Each microservice owns its own schema
Turn data reference sources (e.g. customer data) into data change publishers
Make event-oriented the norm, traditional CRUD the exception
Always do the - when this thing breaks - analysis to uncover weak, brittle patterns
Goals - not rules - to guide how you build your microservices
Implement loosely coupled microservices - asynchronous messaging
Make asynchronous messaging the norm, synchronous messaging the exception
Each microservice owns its own schema
Turn data reference sources (e.g. customer data) into data change publishers
Make event-oriented the norm, traditional CRUD the exception
Always do the - when this thing breaks - analysis to uncover weak, brittle patterns
Goals - not rules - to guide how you build your microservices
Implement loosely coupled microservices - asynchronous messaging
Make asynchronous messaging the norm, synchronous messaging the exception
Each microservice owns its own schema
Turn data reference sources (e.g. customer data) into data change publishers
Make event-oriented the norm, traditional CRUD the exception
Always do the - when this thing breaks - analysis to uncover weak, brittle patterns
Goals - not rules - to guide how you build your microservices
Implement loosely coupled microservices - asynchronous messaging
Make asynchronous messaging the norm, synchronous messaging the exception
Each microservice owns its own schema
Turn data reference sources (e.g. customer data) into data change publishers
Make event-oriented the norm, traditional CRUD the exception
Always do the - when this thing breaks - analysis to uncover weak, brittle patterns
Goals - not rules - to guide how you build your microservices
Implement loosely coupled microservices - asynchronous messaging
Make asynchronous messaging the norm, synchronous messaging the exception
Each microservice owns its own schema
Turn data reference sources (e.g. customer data) into data change publishers
Make event-oriented the norm, traditional CRUD the exception
Always do the - when this thing breaks - analysis to uncover weak, brittle patterns
“At the heart of science is an essential
balance between two seemingly
contradictory attitudes--an openness to
new ideas, no matter how bizarre or
counterintuitive they may be, and the
most ruthless skeptical scrutiny of all
ideas, old and new. This is how deep
truths are winnowed from deep
nonsense.”
Carl Sagan
computer
^
Microservice Design
Patterns
See these patterns in action
with Akka Serverless open beta