Why Choose Microservices Over Monoliths?

Posted by ShaleshRana on April 26th, 2019

Microservices, aka Microservice Architecture, is an architectural style that structures an application as a collection of small autonomous services, modelled around a business domain.

The idea of microservices architecture is to split your application into a set of smaller, interconnected services instead of building a single monolithic application. Each microservice is a small application that has its own hexagonal architecture consisting of business logic along with various adapters. Some microservices would expose a REST, RPC or message-based Application program interface and most services consume APIs provided by other services. Other microservices might implement a web user interface.

To explain in layman terms, one must have seen how bees build their honeycomb by aligning hexagonal wax cells. They initially start with a small section using various materials and continue to build a large beehive out of it. These cells form a pattern resulting in a strong structure which holds together a particular section of the beehive. Here, each cell is independent of the other but it is also correlated with the other cells. This means that damage to one cell does not damage the other cells, so, bees can reconstruct these cells without impacting the complete beehive.

One can enumerate multiple reasons as to why choose Microservices over Monoliths. The microservices architecture tackles the problem of complexity by decomposing application into a set of manageable services which are much faster to develop, and much easier to understand and maintain. It enables each service to be developed independently by a team that is focused on that service. It also reduces barrier of adopting new technologies since the developers are free to choose whatever technologies make sense for their service and not bounded to the choices made at the start of the project. Microservice architecture enables each microservice to be deployed independently. As a result, it makes continuous deployment possible for complex applications. It also enables each service to be scaled independently.

In contrast, monolithic architecture has a limitation in size and complexity. Application is too large and complex to fully understand and make changes fast and accurately. The size of the application can slow down the start-up time. You must redeploy the entire application on each update. Impact of a change is usually not very well understood which leads to do extensive manual testing. Continuous deployment is difficult. Monolithic applications can also be difficult to scale when different modules have conflicting resource requirements. Another problem with monolithic applications is reliability. Bug in any module (e.g. memory leak) can potentially bring down the entire process. Moreover, since all instances of the application are identical, that bug will impact the availability of the entire application. Monolithic applications face a barrier when it comes to adopting new technologies. Since changes in frameworks or languages will affect an entire application it is extremely expensive in both time and cost. One need to keep in mind all important aspects while preparing for Microservices interview questions.

In microservices architecture, each service component forms a strong structure to provide better scalability. Also, issues with each service component can be handled individually by the agile team with no or minimal impact on the entire application.

Like it? Share it!


ShaleshRana

About the Author

ShaleshRana
Joined: October 5th, 2018
Articles Posted: 9

More by this author