Microservices Architecture and Design Best Practices
Abhijeet K
Program Management | Engagement Manager | AWS AI and Cloud Certified | SAFe 5.0 | PGDBA | Certified Scrum Master | Project Management | Product management | Automation | Performance | CI CD | Agile | DevOps
Consider separating data storage:
Data should be made private to each of the microservices. Microservice becomes the owner of its data. Any access to data owned by a specific service should only happen through APIs. Failing to do so would allow multiple services to access the database owned by a specific service leading to coupling between services. The architecture pattern such as CQRS (Command and Query Responsibility Segregation) comes handy in taking care of data which required to be read by different kinds of users.
Build separate teams for different microservices:
Teams should be divided based on microservices with one team working on one microservice. This consists of product manager, and DevOps staff (development, QA, and Ops staff). Recall that microservices shine when they could help organizations in building cloud-native applications which could be released to cloud frequently with very less lead time.
Design domain-driven APIs:
APIs should be designed keeping the business domain in mind. Also, implementation details should not be made part of API design.
Design cohesive services:
Consider grouping the functions requiring to change together as a single unit rather than separate services. Not doing so would lead to a lot of inter-service communications representing the hard-coupling.
Consider separating services for cross-cutting concerns:
One should consider designing separate services for cross-cutting concerns such as authentication and authorization.
Automate enough for independent deployment:
Nicely designed micro-services should be able to be deployed independently. And, build and release automation would enhance the deployment process thereby leading to quicker releases and shorter overall lead time. This would help build microservices truly cloud-native in nature with microservices wrapped in containers and deployed to any environment including cloud in an easy manner. Good DevOps practice followed organization-wide would help achieve this objective.
Failure isolation:
Microservices-based architecture should consider adopting isolation of failure with independent microservices. Architecture principles and design patterns such as some of the following would help achieve the same:
- Circuit-breaker design pattern
- Asynchronous communication
- Loose coupling
- Event-driven architecture
- Stateless design
- Self-contained services
- Timeouts
Keep Designing :)
Regards, Abhijeet K. 9011888917