Top 6 Microservices Patterns
- Database Per Service Pattern – as its name implies, each microservice has its own dedicated database. Not an easy pattern to implement as there’s lots of potential drawbacks and overhead in architecture development. Loose coupling and scaling are pluses.
- Single Database Pattern – microservices share one DB – a bit more forgiving approach than 1. The downside is coordination of efforts and cross-dependencies, which goes against the very philosophy of microservices.
- Saga Pipeline Pattern – a sequential pipeline of transactions that takes place with microservice “commit” events.
- API Composition Pattern – used for implementing complex queries in a microservices architecture.
- Command Query Responsibility Segregation Pattern – addresses the challenge of querying multiple microservices by defining a special database view designed to support such query.
- Event sourcing Pattern addresses the problem of maintaining data consistency across microservices (an alternative to this would be another pattern called “Transaction Log Trail”)