The goal of microservices is to sufficiently decompose the application in order to facilitate agile application development and deployment.
The following is based on the book Microservices from Design to Deployment from NGINX. My goal is to know the difficaulties that this inevitable is bringing with in order to be prepared for.
The Drawbacks of Microservices
One drawback is the name itself. The term microservice places excessive emphasis on service size. While small services are preferable, it’s important to remember that small services are a means to an end, and not the primary goal.
Another major drawback of microservices is the complexity that arises from the fact that a microservices application is a distributed system. Developers need to choose and implement an inter-process communication mechanism based on either messaging or RPC. Moreover, they must also write code to handle partial failure, since the destination of a request might be slow or unavailable.
Another challenge with microservices is the partitioned database architecture. Using distributed transactions is usually not an option, and not only because of the CAP theorem. They simply are not supported by many of today’s highly scalable NoSQL databases and messaging brokers. You end up having to use an eventual consistency-based approach, which is more challenging for developers.
Testing a microservices application is also much more complex. A simple test class for a service would need to launch that service and any services that it depends upon, or at least configure stubs for those services.
Another major challenge with the Microservices Architecture pattern is implementing changes that span multiple services. Fortunately, most changes typically impact only one service; multi-service changes that require coordination are relatively rare.
Deploying a microservices-based application is also much more complex.
Each service will have multiple runtime instances. That’s many more moving parts that need to be configured, deployed, scaled, and monitored. In addition, you will also need to implement a service discovery mechanism that enables a service to discover the locations (hosts and ports) of any other services it needs to communicate with.