Making the Case for a Monolithic Architecture
Microservices are getting all of the attention, but the monolith architecture is still a viable option for many companies.
Join the DZone community and get the full member experience.
Join For FreeWhen microservices became popular in the past decade, everybody hailed them as the nail in the coffin of monolithic architecture. Given all of the advantages of that microservices offer, it is easy to see why this was the case. Still, there are certain situations when a monolithic architecture would serve you best. In my previous article, I explored some of the challenges that microservices offer, and today I would like to take this topic one step further. Let's take a look at some of the benefits of the monolith so you can decide if it is right for you.
Simpler Tracking and Monitoring
Microservices is all about taking independent technologies and sticking them together. However, how do you know whether any or all of the services are performing the way they should be? While there are tools available that can help you with this, you will still need to spend time integrating them. This, by itself, could get very costly. While many people would say that one of the advantages that microservices offer is the fault tolerance, it will still be difficult to find those points of failure manually. This is because microservices, by their very nature, are decoupled and you will need to integrate some monitoring tools which will increase costs.
A monolith is usually deployed as a single or binary library. It’s easier to see the boundaries of the services allowing your teams to refactor or break them down into microservices. A lot of people who are experiencing monitoring issues with their monolith architecture think that shifting to microservices will solve everything. This is simply not true. If you can't track everything when it’s all in one place, what makes you think doing so in a distributed system will be any easier?
Easier Testing and Debugging
When you have a microservices architecture, you have to take into account all of the microservices inside various machines that must be able to communicate with each other. With a monolith architecture, you do not have to deal with potential service interconnection issues. Therefore, if we take a look at something like integration testing, which checks the flow of information between two or more components, you will sometimes have to use different build systems for every microservice that needs to be deployed according to its version. While this is just one form of testing, it is an excellent example of how much more complicated testing becomes in a microservices architecture.
Security Challenges
First of all, it is worth pointing out that both monoliths and microservices have their security flaws. With a monolith, if there are issues with a single component, the entire system can be compromised and it is not possible to bring the application offline to solve the issue. Still, microservices are not foolproof and come with even more advanced threats. Since you have services, components, APIs, and many other moving parts in play, your security team has a lot more ground to cover. The only good thing is that it will be possible to isolate the affected component without derailing the entire app.
When Should You Choose Microservices?
While we made the case for sticking with a monolith architecture, there will be times when microservices just make more sense. Nowadays, companies have remote teams spread out all over the world and microservices makes it so much easier and cost-effective to scale the application since you are not bogged down by a single tech stack. Therefore, the monolithic architecture would only make sense if all your developers are located under one roof. The issues with monoliths have been well documented. There are scalability issues, it is difficult to manage the codebase making it difficult to even add a new feature.
Still, you should consider using a monolith architecture unless you are absolutely certain that it will not be possible to build, test, deploy, and scale. If you feel that all of these can be done with a monolith, then there is no reason to introduce such complexity and use microservices.
Opinions expressed by DZone contributors are their own.
Comments