Advantages of microservices
- develop different microservices with different technologies/languages
- testing and deploying is much faster, for small changes it is easy to test and deploy the individual microservices as opposed to monolith.
Disadvantages of microservices
- developing features require coordination between teams, if feature A needs to be completed by both team1 and team2 then they need to coordinate. teams might need to use feature flags which basically says that the feature will be activated when the other team also completes it. they need to deploy together in order to make feature A work
- deployment is more complex
- monitoring is more complex
- managing product release is more complex
When suited best
- you have large application with multiple themes working on it
- you need scaling of applications, especially the portions of application to scale up and down quickly
Common types of tests
- unit testing
- integration testing
- acceptance testing
- contract testing
- end to end microservice testing: validates every process in the workflow is functioning correctly. it also ensures that the system works together as a whole
What is CDC?
- Consumer Driven Contract
Service Architecture
- https://www.designgurus.io/blog/monolithic-service-oriented-microservice-architecture
- N-Tier
- Monolith
- SOA
- Microservices
- Event Driven
- Data Driven
| Feature | Monolithic | SOA (Service-Oriented Architecture) | Microservices |
|---|---|---|---|
| Structure | Single unified codebase | Multiple services communicating over ESB or HTTP | Independently deployable small services |
| Deployment | Deployed as a single unit Deployment takes time | Deployed as semi-independent services | Each service deployed independently |
| Communication | In-process calls | Often via ESB (Enterprise Service Bus) | Lightweight protocols (HTTP/REST, gRPC, etc.) |
| Scalability | Scales as a whole | Services can scale individually to some extent | Fine-grained, independent scalability |
| Tech Stack Flexibility | Limited to one tech stack | Moderate flexibility | High flexibility per service |
| Fault Isolation | Low—failure can impact entire system | Better than monolith but still has shared dependencies | High—failures contained to individual services |
| Speed of Development | Fast initially, slows over time | Slower than monolith, faster than microservices | Fast for small teams, complex coordination needed |
| Complexity | Simple at first, becomes harder to manage | Requires governance and central coordination | Complex, requires DevOps and monitoring |
| Best For | Small teams, MVPs, early-stage products | Medium-large enterprises with reusable service layers | Large-scale systems with independent modules |
Cloud Native Architecture
- 12 factor
- 15 factor
Domain based microservices
- based on Domain Driven Design (DDD)
- Analyze Domain
- Define Bounded Contexts
- Define Entities, Aggregates and Services
- Identify Microservices
- https://learn.microsoft.com/en-us/azure/architecture/microservices/model/domain-analysis