Using a microservices architecture results in building a distributed system. This can create some challenges, as follows:
- Connectivity
- Debugging
- Complexity
- Latency problems
- Security
The services need to communicate with each other. This can be done by using APIs or exchanging messages with brokers, such as Kafka[6]. With each service, the testing and debugging of the whole system increases. If each service runs in a separate runtime environment, automation testing becomes challenging.
Each service also increases the system resource and memory consumption. The costs of maintenance and monitoring of the whole system are much higher than in a monolithic system. A more complex system requires more expertise to develop and maintain. There is a high initial investment in the development, deployment, and management. Many people, not just developers, need to understand each service in order to understand the whole system.
Choosing the different technology stacks for the different services can lead to non-uniform application design and architecture. This requires a lot of documentation and the constant updating of schemata and tests.
If the application doesn't need to scale, using microservices may not provide any meaningful benefits. Even worse, when the microservices aren't implemented correctly, they can make poorly written applications even more dysfunctional.