How To Understand Microservices Architecture

Oleksii Dushenin
3 min readOct 29, 2021

In a previous post, How To Understand Monolithic Architecture, the advantages and disadvantages of Monolithic Architecture were reviewed. It is clear, that the problems with this kind of architecture appear with the growth of the application. To overcome these challenges, Microservices Architecture can be used. However, it is not a silver bullet. This type of architecture has its own advantages and drawbacks.

Microservices Architecture Review

An application is split into multiple small services ( User Service, Flight Service, Billing Service, etc) responsible for a specific limited scope. Each of them operates on its own database with preferred characteristics. UI typically performs requests to the Gateway. The Gateway is responsible for routing requests to a specific service. It can also contain cross-cutting concerns such as authentication. Each of the services can be supported, managed, and deployed separately. However, they should communicate with each other in some way. Different communication methods are out of the scope of this article and will be reviewed separately.

Advantages of Microservices Architecture

  • High cohesion, low coupling. Each service is independent except for communication points. As a result, each component can be developed by a different team. Bugs and features can be fixed and deployed in a single service. The deployment time is small due to the size of the service.
  • Limited service scope. These services are usually small. Therefore they are usually easier to understand. Debugging process and testing are simple in the scope of a single service.
  • Flexibility. A service can operate on its own database with the required characteristics. It can be RDBMS, NoSQL, both or none of them. Also, services can be written in different programming languages.
  • Scalability. Components can be scaled and optimized independently. Performance characteristics do not have limits. For example, an application can have two User Service instances and ten Flight Service instances. RDBMS database can be replaced for a single purpose NoSQL database for a specific service. Because of that, microservices can also be cost-effective for large applications.
  • Cutting-edge technologies. Microservices are small. Consequently, experiments can be made to verify some idea or solution. They can be quickly rewritten. Also, migration to a new platform version can be very simple. For instance, migration from Java 8 to Java 11.
  • High speed of development. A lot of frameworks are optimized to be used as microservices (e.g. Spring Boot). Another advantage relates to CI/CD pipeline. Services are small, consequently, the pipeline is fast.

Disadvantages of Microservices Architecture

  • Debugging. While working in the scope of a single component, everything is simple. However, the architecture as a whole is complex. A single request can operate on multiple services. It is hard to track it and understand the system. The data flow is usually hard to understand, especially for new team members.
  • Testing. Testing is challenging because of the distributed components.
  • Deployment. Services can be deployed separately. However, they usually communicate somehow. Interaction contracts between services have to be strictly defined. A change in one service should not break other services.
  • Communication. Each component can be developed by different teams. Consequently, changes have to be communicated. It brings communication overhead.
  • Infrastructure overhead. On the on hand, data is located in different places. On the other hand, from business perspective data from one service should be used in another service. Interaction between services should be handled somehow. It is usually either data replication or additional calls between services.
  • Cross-cutting concerns. Security, logging, monitoring, configuration, etc. should be implemented in each service.

Summary

To sum up, Microservices Architecture brings additional complexity and higher costs for small projects. However, for large applications, microservices can be cost-effective, can influence high system performance, and speed up development.

Originally published at https://datamify.com on October 29, 2021.

--

--