Why we shouldn’t forget about monolith?
Recently, there has been a growing trend where young teams working on start-up projects often opt to develop everything using microservice architecture right from the beginning. Microservice architecture’s modern, lays well on cloud architecture and is understandable. However, such projects often face several problems that are important to keep in mind.
- The first problem is incorrectly defining data domain boundaries for microservices. This can lead to duplicate data, difficulties in data reconciliation and data integrity issues.
- The second problem is the unnecessary complexity of deploying the project during the start-up phase. Microservice architecture requires customized CI/CD, containerization and orchestration, which can be unnecessarily complex for a small project.
- The third problem is the complex organization of data distribution and retrieval via REST APIs. This leads to unnecessary delays, the need to implement caching to speed up data processing, which can be unnecessarily complicated at the initial stage of project development.
It's also important to highlight instances of incorrect understanding of architectural principles. Often it leads to the implementation of cargo-cult, when microservices exist formally, but actually use one database, synchronizing their state among themselves. Or an antipattern of nanoservices emerges, where each microservice does not provide meaningful functionality on its own. As a result, we end up with a distributed monolith whose elements cannot be poured separately.
What's most paradoxical is that while monolithic architectures have long been deemed outdated by many engineers, they can still prove invaluable at the outset of startup and small project development. Monolithic architecture enables quick initiation, rapid development, and ensures respectable response times, load tolerance, and operational speed.
A monolithic architecture simplifies the management of dependencies and interactions between components. This is especially important in the early stages of a project when flexibility and speed are more important than scalability.
In a monolithic system, it is easier to ensure data integrity because all components use the same database, eliminating synchronization issues. Developing and maintaining a monolithic application requires less infrastructure and administration costs compared to microservice architecture.
Monolithic applications can also provide better performance in the initial stages because there is no overhead associated with inter-service communication and network latency.
For all of these reasons, monolithic should not be overlooked, especially in the initial stages of project development. Choosing the right architecture can greatly simplify development, speed up startup, and reduce costs. Microservices are a powerful tool, but not always justified at the start. Monolith allows you to focus on the functionality and quality of the product, postponing complications until they are really needed.