Are microservices really right for you?

1. What are microservices?

Microservices is an architectural style in which a large, complex software application consists of one or more microservices. Each microservice in the system can be deployed independently, and each microservice is loosely coupled. Each microservice only focuses on doing one task and doing it well. The purpose of the Microservices Architecture Pattern is to build large, complex, long-running applications as a set of cooperating services, each of which can be easily modified locally. The microservice architecture brings the advantages of independent deployment, high expansion and scalability, free choice of development language, efficient use of resources, fault isolation, etc. At the same time, it also brings new advantages such as distributed transactions, communication between services, monitoring, and deployment because of services. question.

2. Why use microservices?

Application diagram of the overall architecture ( assuming Huawei software development cloud - in fact, it should belong to the micro-service architecture):

Weaknesses of Monolithic Architecture

Using the traditional Monolithic Architecture application development system is easy to develop, easy to debug, and easy to deploy. In the early days such applications worked well, unfortunately, this simple approach has significant limitations.

1) A simple app grows larger over time. In each sprint, the development team faces a new story, a new task, and then develops a lot of new code. After a few years, this small and simple application will gradually become larger.

2) Once your app turns into a big and complex monster, it must be painful for the development team. The application is so large and complex that it is impossible for any single developer to understand it. Therefore, fixing bugs and properly adding new features becomes very difficult and time-consuming.

3) The monolithic architecture application will also reduce the development speed. The larger the app, the longer the startup time. If the developer needs to restart the application frequently, most of the time will be spent waiting, and the production efficiency will be greatly affected.

4) Complex and huge monolithic architecture applications are not conducive to continuous development. Today, the norm for SaaS applications is to change many times a day, which is very difficult for a monolithic architecture model.

5) Another problem with monolithic architecture application is reliability. Because all modules run in one process, a bug in any one module, such as a memory leak, will likely bring down the entire process.

6) Monolithic architecture applications make it very difficult to adopt new architectures and languages. For example, if your code is written in framework A, if you want to change it to framework B, it will be very expensive in terms of time and cost. Therefore, it is an insurmountable chasm.

Microservice architecture diagram (taking Huawei Software Development Cloud as an example):

Benefits of Microservice Architecture

First, the complexity problem is solved by breaking up the huge monolithic application into multiple services. The application is decomposed into multiple manageable branches or services with the same functionality. Each service has a well-defined boundary with an RPC- or message-driven API. The microservices architecture pattern provides a modular solution to functionality that is difficult to implement with monolithic coding, whereby individual services are easy to develop, understand, and maintain.

Second, this architecture allows each service to be developed by a dedicated development team. Developers can freely choose development technologies and provide API services. This freedom means that developers are not forced to use outdated technology that a project started with, they can choose the technology of today. Even, because the services are relatively simple, it is not very difficult to rewrite the previous code with current technology.

Third, the microservice architecture pattern is that each microservice is deployed independently. Developers no longer need to coordinate the impact of other service deployments on this service. This change can speed up deployment. Teams can use AB testing to quickly deploy changes. The microservice architecture pattern makes continuous deployment possible.

Finally, the microservices architectural pattern enables each service to scale independently. You can deploy the scale that meets your needs based on the scale of each service. Even, you can use cloud services that are more suitable for serving resource needs. For example, you can choose a cloud host with high configuration for computing-intensive services, and choose a cloud host with high bandwidth and high storage for storage-intensive services.

3. Are microservices really right for you?

When referring to the microservice architecture, we often compare it with the monolithic architecture. The monolithic architecture has the following disadvantages: difficult code maintenance, bloated deployment, limited flexibility and scalability, hindering team and technological innovation, etc.; microservices The architecture has the following advantages: simplified code maintenance, independent deployment, high expansion and scalability, and free choice of development languages. So is the monolithic architecture really that bad? Obviously not.

When the complexity is small, the productivity of the monolithic architecture is higher. When the complexity reaches a certain scale, the productivity of the monolithic application begins to drop sharply. At this time, it is reasonable to split it into microservices. Therefore , it is absolutely hooligan to talk about architecture without business scenarios.

No matter how awesome the architecture design is, if it cannot be implemented in business scenarios, it is just empty talk. Therefore, the architecture needs to serve the business, and the architecture design will be different for different business scenarios. The architecture design does not need to be high-level, as long as it can meet the needs of business development, it is a good architecture.

In addition, a good architecture is not completely designed. With the growth of business volume and request volume, a good architecture evolves. The reason why the microservice architecture is widely recognized is that it is unpredictable for business variability, and the microservice architecture can continuously evolve itself, and then quickly adapt to business changes. In addition, microservices also have their shortcomings:

First, microservice applications are distributed systems, which introduce inherent complexity.

Second, the partitioned database architecture needs to update different databases used by different services in the application of the microservice architecture, which puts forward higher requirements and challenges for developers.

Third, testing an application based on a microservice architecture is also a complex task.

Fourth, changes in the application of the microservice architecture pattern will affect multiple services.

Fifth, deploying a microservice application is also complicated. A microservice application generally consists of a large number of services. Successfully deploying a microservice application requires developers to have sufficient control over the deployment method and a high degree of automation.

In view of the above reasons, if the company's long-term business plan does not require a microservice architecture or the company's actual situation does not have some basic conditions for implementing microservices, it is not recommended that you blindly move towards the emerging architecture field of microservices. If you are ready to accumulate technology early, you can also start from the pilot and gradually implement the microservice architecture in the team.

4. If microservices are really suitable for you, what should you do?

1) Buy books to study.

2) Check the information on the Internet to learn.

3) Use Huawei software to develop cloud and let Huawei experts guide you.

Guess you like

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