In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "what are the advantages and disadvantages of micro-service". The content of the explanation is simple and clear, and it is easy to learn and understand. let's follow the editor's train of thought to study and learn "what are the advantages and disadvantages of micro-service"!
First of all, microservices are not a name, but an architectural concept, just as Restful describes not only the format of api, but also the architecture based on Restful API. Micro-service architecture (MSA) is for the original large-scale system, which divides a large-scale system into many micro-systems through horizontal or vertical, business or architecture segmentation. When the system is complex to a certain extent, dozens of people work together to maintain a system with low efficiency and high risk of problems.
At this time, it is necessary to split the system, and the SOA system proposed a long time ago coincides with the architectural concept of micro-services. The architecture based on the RPC framework (dubbo, thrift, etc.) that you use now can also be regarded as a micro-service. So far, there is no exact boundary and definition of micro-service, and it seems that many concepts on the computer can not define the boundary. However, I understand that the communication between microservices is http communication, and the traditional rpc invocation is not a strict microservice, because it cannot take care of itself and needs to be relied on, for example, it may be necessary for a rpc service Producer to be present before the rpc service Consumer can be started. Therefore, in the following discussion, I am based on the premise of http communication between microservices.
What are the benefits of microservices?
Decoupling: for us low-level programmers, the visible benefit is decoupling. If I want to implement a function, I may not need to know much about other people's code, because programmers may think that other people's code is scum. I can make a new micro-service, which provides services for other functions without relying on existing functions. As for business logic, I can get familiar with cohesion and deploy it independently: it means that the micro-service I maintain can be deployed independently and will not be strongly dependent on other services. There will be no problem that my own service cannot be started or unavailable because other services do not exist.
Distributed: under the micro-service architecture, there is no particularly large system that contains many central functions, which can also improve fault tolerance. The paralysis of one service will not paralyze the whole system for permission verification: micro-service is a highly cohesive service. My own service, I can customize any reasonable rule, and this rule only applies to my own service. Compared with dubbo RPC calls, permission verification for rpc micro-service calls can be more direct, more stringent and more customized. However, for permission verification when https is called, I always feel that it is very elegant to manage data separately, with its own sub-database attributes: the original large system uses a database, and when there is a lot of data flow, it will involve sub-database and sub-table.
Under the micro-service, there is great flexibility in whether each service uses the database, and whether the database is shared with other services or self-built, that is, I think the micro-service with its own sub-library and sub-table attribute system will not be limited to a certain technology stack for a long time. Under the micro-service architecture, the whole system will not be limited by java or nodejs or go, but everyone will cooperate and not conflict with all http protocols. The unit test of each module in json format is easy to automate, etc.
Challenges facing microservices
Communication, the speed of http requests is slow. Usually, an operation may involve the mutual invocation of multiple microservices. If different microservices are called from the server multiple times to complete an operation, the time consuming of http requests may become a bottleneck, as shown in figure 1.
The communication between the client and the server requires an API GateWay: usually, the client and micro-services are not together, and each micro-service is centrally deployed in a computer room, so the mutual call between micro-services is very fast, but the invocation between client and micro-services can be time-consuming. Moreover, one action of the user can not be called many times in the client, so the speed is slow, and there is a risk of leaking the system architecture. Normally, there is an API GateWay between the client and the microservice architecture.
As figure 1 becomes figure 2, the most important role of GateWay is to provide clients with aggregation of background services, provide a unified service outlet, and uncouple them. In order to solve the API Gateway single point of failure or performance bottleneck, Gateway is usually a cluster, and client access control, account management, login management and other aspects are usually dealt with here.
When there are many micro services, the whole link may be very long, the risk of call failure is high, and e2e automated testing will become a problem of service registration and service discovery. We have our own service management system. I recommend etcd. Google's open source Kubernetes (K8s) also seems to use this. Distributed transactions, which are the major difficulties of micro-service systems, may need to be customized according to their own system conditions and business requirements. I recommend compensatory distributed transactions and message-based distributed transactions.
Thank you for your reading. the above is the content of "what are the advantages and disadvantages of micro-services". After the study of this article, I believe you have a deeper understanding of what are the advantages and disadvantages of micro-services. the specific use situation still needs to be verified by practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.