What are pros and cons of using microservices in comparison with alternative architectures? Is there a rule of thumb when microservices should be used?
Advantages
1.Decentralized and Decoupled Architecture, using choreography rather than orchestration makes services publish-subscribe based and as a result fully decentralized
2.Do one thing and do it well (Unix philosophy), more focused and singular with very narrow functionality
3.Easy to have parallelism and load balancing, because of being more fine-grained from the business process point of view
4.Statelessness, however, having a stateful Microservice is valid but it is not the ideal
5.Individual data storage makes services relaxed to keep tracing the data-flow
6.Easy and automated deployment and discovery due to use of container engine-based technologies such as docker
7.More interoperability, which makes services able to have more flexibility in accepting/dropping a new/current service or protocol
8.Fully compatible with Representational state transfer (REST) which allows creating stateless services
9.Suitable for discrete systems, for example for batch automation process
Disadvantages 1.Service synchronization, keeping services synchronized in a cooperative way
2.Difficult to find systematic problems, for example, finding a problem in a chain of business activities when there is a logical error in the process is more difficult and it requires to combine several log files into one piece
3.Automated deployment and discovery is a must when the number of microservices is more than a few
4.Difficult to find the right service granularity, which can lead the entire system into instability due to overwhelmed network communication and error rations
5.Challenging when the business system is not discrete enough, like continues process control
6.Developing an automated test is significant difficult than monolithic systems
Following are a set of articles that published about microservices in code-project, you can read and comment on your questions if you like.
https://www.codeproject.com/Articles/1264113/Dive-into-Microservices-Architecture-Part-I https://www.codeproject.com/Articles/1264113/Dive-into-Microservices-Architecture-Part-II https://www.codeproject.com/Articles/1264113/Dive-into-Microservices-Architecture-Part-III