Why Microservices are better than Monoliths

Upasana | May 27, 2019 | 2 min read | 50 views


Why Microservices are better than Monoliths?

Microservices architecture is meant for developing large distributed systems that scale with safely. Monolith approach has inherent problems which drags the overall software development process, for example:

  1. The development effort required to build a monolith could be much more because its not easy to divide and scale the development effort. The different components are tightly coupled and parallel development is a tricky job.

  2. A single wrong commit by a developer can break the build, blocking the entire team, because everyone is dependent on single codebase. Potential & scope for such mistakes is reduced in microservices.

  3. Whenever we want to add/update functionality, developers need to change at-least one of these three components and deploy the new version to production. Any single change to production requires a full redeployment of the entire codebase, which brings risk of production downtime.

  4. There are limitations in choosing technology stack. We can not build one components in Go (performance reasons), another in Node.js (high network handling) and few others in Java (simplicity in design).

  5. When we need to scale a monolith, we deploy the same version of monolith on multiple machines, by copying the big war/ear file again and again. Everything is contained into single executable file.

  6. The complexity of a monolith grows rapidly over the time, because its not easy to create bounded context in monoliths. Shared modals becomes too large and complex over time, which no one easily understand.

monolithic
Typical monolithic e-shop

As illustrated in above example, a typical monolith eShop application is usually a big war file deployed in a single JVM process (tomcat/jboss/websphere, etc). Different components of a monolith communicate with each other using inprocess communication like direct method invocation. One or more databases are shared among different components of a monolith application.


Top articles in this category:
  1. Cracking Spring Microservices Interviews - question bank
  2. 50 microservices interview questions for Java developers
  3. How will you Partition a typical e-shop into Microservices Architecture
  4. Is it a good practice to deploy multiple microservices in a single tomcat container
  5. What is Spring Boot and what are its advantages
  6. Spring Cloud and its advantages

Recommended books for interview preparation:

Find more on this topic: