Microservices

Monolithic vs Microservices Architecture

This is the 1st post in a series on microservices architecture.

It’s important to understand the pros and cons of both architectures. Let’s discuss them in detail.

Monolithic Architecture

We consider a monolithic system one in which all functionality is deployed in one go. There are two types of monolithic systems.

  1. Single process monolith — All code is packaged into a single process.
Single Process Monolith Architecture

2. Distributed monolithic— The system consists of multiple services, but for whatever reason, it must be deployed as a whole.

Distributed Monolithic Architecture

Pros of Monolithic Architecture

  1. Easy to develop and test.
  2. Deploys as a single deployment unit.
  3. Easily scale horizontally with the same deployment unit.
  4. Requires less technical expertise and sharing the same underlying code.
  5. Allows high performance by centralizing code and memory.
  6. Suitable for small applications.

Cons of Monolithic Architecture

  1. The complexity of a system increases with time.
  2. New features take a long time to be released.
  3. Production hotfixes take longer.
  4. When a small change occurs in a module, the entire application has to be updated.
  5. Unable to adopt newer technologies for better performance due to their close relationship with one technology.
  6. Single point of failure.
  7. Code becomes complex and doing KT becomes increasingly challenging due to high coupling.
  8. High dependency on key developers who understand the entire code base
  9. Continuous deployment is challenging.
  10. Individual modules are difficult to scale.
  11. The high coupling between modules causes reliability and availability issues.
  12. Security concerns as all deployment are at one place.

Microservices Architecture

The concept of microservices refers to independent, deployable services attached to a particular business domain. Microservices communicate through networks. The microservice architecture consists of multiple collaborating microservices and is a form of service-oriented architecture (SOA).

Microservices are small Autonomous services that work well together, modeled around a business domain.

— Sam Newman

Microservices Architecture

The fundamental characteristic of microservices is their agnosticism toward technology. Using one or more network endpoints, microservices expose the business capabilities that they encapsulate. They also encapsulate data storage and retrieval, exposing data via well-defined interfaces, making them a form of a distributed system. Databases are therefore hidden inside the service boundary. Let’s examine these concepts in more detail.

Independent Deployability — The idea is that we can make a change to a microservice and deploy it into production without having to use any other services. Our services need to be loosely coupled to ensure independent deployment.

Modeled Around a business domain — Each service caters to only one subdomain of business needs and is responsible for that subdomain. Microservices should adhere to the Single Responsibility Principle (SRP).

Own their own data — When a microservice needs access to data held by another service, it should ask that service for the data. Microservices should not share databases.

Pros of Microservices

  1. Domain knowledge and business expertise.
  2. Independent scalable.
  3. Accelerates the velocity of software development by enabling small, autonomous teams to work in parallel.
  4. The ability to respond quickly to change.
  5. Improves uptime.
  6. Adapt newer technology more easily.
  7. Loose coupling.
  8. Ideal for large-scale applications.
  9. Clearly defined team ownership of microservices.
  10. Customizable security for different services.

Cons of Microservices

  1. Distributed systems introduce additional complexity.
  2. Deployment complexity.
  3. Monitoring is more complex.
  4. Increasing resource consumption and lots more servers to manage.
  5. Network communication between distributed services is not instantaneous and may result in latencies.
  6. Testing services can be challenging.
  7. Data consistency between services is challenging and complex.

Leave a Reply

Your email address will not be published.