First and foremost, let’s looking into monolithic architecture first.

What is monolithic architecture?

Monolithic architecture is the traditional unified model of developing software. It’s kind of a big container where all the software components assembled tightly packaged. The Entire software is depended on a single piece of an entity which means that monolithic programs are interconnected and interdependent.

When considering a server-side enterprise application. It must support a variety of different clients including desktop browsers, mobile browsers and native mobile applications. The application might also expose an API for 3rd parties to consume. It might also integrate with other applications via either web services or a message broker. The application handles requests (HTTP requests and messages) by executing business logic; accessing a database; exchanging messages with other systems; and returning a HTML/JSON/XML response.

Benefits of Monolithic Architecture

  • Simple to develop
  • Simple to test
  • Simple to deploy
  • Simple to scale horizontally by running multiple copies behind a load balancer.

Drawbacks of Monolithic Architecture

  • Decreased performance
  • Security and access control problems
  • Loss of productivity
  • Complexity grows as you keep adding new features

Microservices as a Rescuer

It’s an approach of building large applications as a suite of loosely coupled modules or components. Each module supports a specific task or business goal and uses a simple, well-defined interface, such as an application programming interface (API), to communicate with other sets of services.

According to Martin Fowler, microservices are defined as,

“The microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery.”

https://martinfowler.com/articles/microservices.html

“Service-Oriented Architecture” vs Microservices Architecture

Both architectures have similar pros and cons but some differences. In microservices, services can operate and be deployed independently of other services, unlike SOA. So, it is easier to deploy new versions of services frequently or scale a service independently.

In SOA, ESB could become a single point of failure impacts the entire application. If one of the services slow down, could cause the ESB (Enterprise Service Bus) to be clogged up with requests for that service as every service depends on the communication through ESB. On the other hand, microservices are much better in fault tolerance.

Microservice has to be significantly smaller than what SOA tends to be and mainly is a small(er) independently deployable service.

How Microservices work

In microservice architecture, an application is divided into services. Each service runs a unique process and usually manages its own database. A service can generate alerts, log data, support user interfaces (UIs), handle user identification or authentication, and perform various other tasks.

Benefits of Microservices Architecture

  • Loose coupling: The systems are independent and individual team can develop services independently to keep the complexity down
  • Right tool for the task: Not limited into one programming language or framework
  • Easy to scale services: Easy to scale to meet particular user demand
  • Easy to scale development: As the code base is smaller, it’s easy for developers to find bugs quickly and identify the improvements needed
  • Fast to Fail / Start Over: Allows us to fail fast and easy to refractor

Drawbacks of Microservices Architecture

  • Developers must deal with the additional complexity: Contains with more moving parts
  • Testing is more difficult
  • Deployment complexity
  • Increased memory consumption

Conclusion

The software architecture depends on the usage of the application. Simple and lightweight applications can be built by monolithic architecture.

Microservices architecture is a distinctive method of developing single-function modules. Well-known tech companies such as Netflix, eBay, Amazon, Twitter evolved from monolithic to microservices for scalable and flexible development of systems.

References:

https://www.researchgate.net/figure/CAP-theorem-with-databases-that-choose-CA-CP-and-AP_fig1_282519669

https://www.bmc.com/blogs/microservices-architecture/