Microservice Architecture

What is Microservice Architecture

        Simply put, microservices are a design style in system architecture. Its main purpose is to split an originally independent system into multiple small services. These small services all run in their own independent processes. HTTP-based RESTful API for communication and collaboration. Each small service that is split is built around a certain item in the system or some highly coupled business functions, and each service maintains its own data storage, business development, automated test cases, and independent deployment mechanism. These microservices can be written in different languages ​​thanks to a lightweight communication protocol as a foundation.

Difference from Monolith

Monolithic features:

  1. Business requirements typically build a monolithic project using objects or business classes.
  2. The requirements are usually divided into three main parts: database, server-side processing, and front-end display.
  3. In the early stage, since all business logic is in one application, development, testing, and deployment are relatively easy.
  4. Due to broader business requirements, we often modify a small function, which will affect the operation of other functions in order to deploy and go online.
  5. It is difficult to give a more prepared assessment of the system capacity of each module.
  6. With the development of the system, the maintenance cost in the later period will become larger and larger, and it is difficult to control.

Microservice Architecture Features:

  1. Different modules in the system are split into different services that can be deployed and scaled independently.
  2. Since each service is in its own process, there are firm boundaries on deployment, so updates to each service will not affect the operation of other services.
  3. Due to the independent deployment, the performance capacity can be more accurately evaluated for each service, the bottleneck position of the system can be found more easily, and a more accurate system-level performance capacity evaluation can be given.

How to Implement Microservices

    Before implementing microservices, we must know that although microservices have many attractive advantages, they also cause many problems that were not originally present in monolithic applications because of the splitting of services.

  • New challenges for operation and maintenance : In the microservice architecture, the number of processes that operation and maintenance personnel need to maintain will greatly increase, and operation and maintenance personnel need to arrange and organize these processes in an orderly manner. It is difficult for traditional operation and maintenance personnel to adapt to such changes. We need operation and maintenance personnel to have more skills to deal with such challenges, and the operation and maintenance process needs to be more automated, which requires operation and maintenance personnel to have certain development capabilities to orchestrate the operation and maintenance process and make them run automatically.
  • Consistency of the interface : Although the services are split, the dependencies between business logic will not be eliminated, but the code dependencies in the monolithic application will become the communication dependencies between services. When we make some modifications to the original interface, the interacting parties also need to coordinate such changes to publish to ensure the correct invocation of the interface. We need better interface and version management, or strictly follow the open-closed principle.
  • Distributed complexity : Since each microservice is independently deployed and runs in its own process after splitting, they can only cooperate through communication, so the problem of distributed environment will be the need for microservice architecture system design Important factors to consider, such as forgetting about latency, distributed things, asynchronous messages, etc.

    Although the microservice architecture has many shortcomings and problems, its advantages such as agile development and automated deployment are still favored by the majority of excellent architects and developers.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324437346&siteId=291194637