Microservices and distributed computing have become the new buzz word among DevOps. Everyone wants to migrate their architecture to microservices, mostly because it is the new trend. Because of that, monolithic applications seem more like a burden on cloud computing.
The strange thing here is that monolithic appalications were never claimed as the best option, they just seemed like the most common and convenient option. That is why many companies still start their operations by coding a monolithic core.
Monolithic architecture brings with it many sturdy benefits that we cannot ignore, all because it doesn’t fit well with the modern architectural practices. On the contrary, microservices add complexity to an application, which is not always necessary.
Here are some reasons why you may want to stick to a monolithic architecture:
1. Monoliths are better for complex enterprise apps
The reason why microservices have gained popularity in the last few years is that a number of leading internet companies have migrated to it, including Uber, Netflix, Apple, and even Amazon. While implementation of microservices makes more sense for these cloud-based companies since they have a large customer base and downtime in one of part of the application does not affect the whole. It is also easier for developers to continuously update the code or add bug fixes without any downtime.
But the complexity that microservices brings with it, may not be worth it if the application is not that big or it is an enterprise level application. With a monolithic core, developers do not have to deploy changes separately; they can do it all together — thus saving them a lot of time.
2. Testing and Debugging
It is much easier to debug monolithic applications, as compared to microservices. That is because, with microservices, there are hundreds of new variables introduced, and any of them could go wrong and create problems.
Not to mention, lesser dependency among variables in microservices means, it can be difficult to determine when an interface contract or compatibility is broken. To put it simply, you may not even know what has gone wrong until you are at runtime.
For an application that is accessed by millions or thousands of users every day, adding the complexity of microservices may be worth the extra effort. But, what you need to remember as a developer is that most enterprise business applications do not even come near that many number of users.
Now, if you create a new application that takes several seconds to load every new screen all because it needs to make 50 API calls to 50 microservices, then your end users are not going to care about your modern architecture. All they will see is an application which takes a lot of time to load. You could add request collapsing and clever caching, but that is just an extra set of complexity that you did not even need in the first place.
Diving an application into hundreds of microservices does not just mean that you will have to decide how these microservices interact with each other but you will also have to decide a security protocol for each one of them. For instance, some microservices might have access to sensitive company data, while some may not. To manage a coarse-grained application like that, you will have to define security borders, even before you start to segment microservices.
5. Designing the Architecture
Designing a microservices architecture can takes weeks to months of initial planning just to get your project off the ground. It also means that you would have a higher upfront design cost and may even need to hire more developers just to break down microservices. There is a continuous risk of over-architecting and you may end up creating more microservices than you need, which will, in turn, increase the complexity of the architecture.
With a monolithic architecture, the development takes much lesser time, both in planning and designing. It also saves overall costs.