Though there ain’t any clear definition of Microsevices, common belief is that Microservices are designed around specific business-boundaries with well-defined interfaces. This gives us below pros of Microservices based architecture.
Pros of Microservices
- Scaling individual component is easy
- Indepedent deployment
- Isolated product-teams with freedom of stack focused on shipping features fast
- Fault tolerance (theoritically if one service goes down, it shouldn’t affect other services)
Cons of Microservices
- Complexity is one of the MOST UNDERRATED cons of Microservices architecture. Organisation needs mature team to manage and maintain multiple services.
- Transactions spread across services can make it very hard to debug deadlocks.
- Inter-communication between many services can lead to eventual-consistency.
- Not clearly defining business boundaries, can turn many pros of Microservices into cons. Many times in initial stages business boundaries are not clear.
Questions to ask before adopting microservices
- What business problem are you trying to solve by adopting microservice architecture ?
- Is your application big enough to break in to microservices ?
- How frequently are you expecting shipping?
- How much workload are you expecting ?
- Do you have a team mature enough to handle Operational complexity of microservicess ?
- Do you REALLY need to worry about scaling ? What bottleneck are you trying to fix ?
Having Incremental approach
It is important that both pros and cons of Microservice design pattern must be considered in context of ‘It depends’. If team is not able to build good monolith, there are good chances that it will fail in building microservices also. Having incremental approach can serve better in long run.
- Start with monolith (Keep It Simple). It will help to understand complexity of system and component dependencies.
- Add few more services to your monolith if complexity rises.
- If complexity rises further, you can start exploring Microservice architecture.
- Understand Microservice Architecture is not Silver Bullet but a good design pattern which solve some specific problems
- Avoid starting with Microservices from scratch unless use cases and business boundaries are crystal clear.
- Prefer incremental architecture design.
- Make sure to have good mature team before adopting Microservice Architecture.