Micro-service management system, method, device, storage medium and program product

By configuring the proxy component to gradually increase the routing weight when the microservice instance goes online and adopting a delayed offline mechanism when it goes offline, the problem of traffic loss in microservice life cycle management is solved and the availability and reliability of the system are improved.

CN118694819AInactive Publication Date: 2024-09-24ALIBABA CLOUD COMPUTING CO LTD

Patent Information

Application Number
CN202411171504.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-23
Publication Date
2024-09-24
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing microservice life cycle management method may cause a large amount of traffic loss, especially in the early stages of microservice launch. Unprepared microservices may cause processing failures when faced with a large number of requests, resulting in a decrease in the overall system availability.

Method used

By configuring the proxy component at the initial stage of microservice instance startup, the routing weight of the microservice instance is gradually increased until the target routing weight is reached, allowing it to smoothly survive the startup period, and a delayed offline mechanism is adopted when the microservice goes offline to ensure that the microservice Allow enough time to process remaining requests and reduce traffic loss.

Benefits of technology

It effectively reduces the traffic loss in the early stages of microservices going online and offline, ensures that microservices can handle requests during startup and shutdown, and improves system availability and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118694819A
    Figure CN118694819A
Patent Text Reader

Abstract

The embodiment of the invention provides a micro-service management system, method and device, a storage medium and a program product. In the embodiment of the invention, for a micro-service architecture adopted by an enterprise flying operating system, particularly a flying enterprise cloud native middleware and the like, the agent component can be configured for the micro-service instance in the micro-service architecture, and the agent component can be configured for the micro-service instance in the micro-service architecture at the initial starting stage of the target micro-service instance. The routing weight of the target micro-service instance is gradually increased to the target routing weight, so that the stability of the target micro-service instance exceeds the starting period. When the target micro-service instance is just started, a service consumer of the target service has a large number of concurrent access requests to the target service, and the service consumer can also not send excessive access requests to the target micro-service instance due to the fact that the routing weight of the target micro-service instance is small. The processing pressure at the initial starting stage of the target micro-service instance can be reduced, so that the flow loss at the initial online stage of the target micro-service instance can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a microservice management system, method, device, storage medium and program product. Background Art

[0002] Microservice architecture is a technique for designing complex application systems. It develops a single application into a set of small, independent services, each of which runs in its own process and communicates with each other through lightweight mechanisms. Each microservice is deployed independently and is responsible for performing a single function, which reduces the coupling between the parts of the application system. Microservice architecture brings high flexibility, scalability, and maintainability, but also increases management complexity. Therefore, it becomes extremely critical to effectively manage the life cycle of microservices. However, existing microservice lifecycle management methods may cause a large amount of traffic loss. Summary of the invention

[0003] Multiple aspects of the present application provide a microservice management system, method, device, storage medium and program product to reduce traffic loss during the lifecycle management of microservices.

[0004] The embodiment of the present application provides a microservice management system, including: a control node, a service cluster, and a registration center node corresponding to the microservice; The control node is used to respond to a service launch request for a target service, create a target microservice instance that provides the target service in the service cluster, and configure a proxy component for the target microservice instance; The proxy component is used to adjust the routing weight of the target microservice instance stored in the registration center node multiple times in a trend of gradual increase when the information of the target microservice instance is registered with the registration center node, until the routing weight of the target microservice instance is the target routing weight, so that the service consumer of the target microservice instance can initiate access requests of a corresponding request amount to the target microservice instance based on the current routing weight of the target microservice instance.

[0005] The present application also provides a microservice management method, including: For a newly created target microservice instance providing a target service in the service cluster, when the target microservice instance is started, register the information of the target microservice instance in the registration center node; According to the trend of gradual increase, the routing weight of the target microservice instance stored in the registration center node is adjusted multiple times until the routing weight of the target microservice instance is the target routing weight, so that the service consumer of the target microservice instance can initiate access requests of the corresponding request amount to the target microservice instance based on the current routing weight of the target microservice instance.

[0006] The present application also provides a microservice management method, including: In response to a service launch request for a target service, creating a target microservice instance providing the target service in the service cluster; A proxy component is configured for the target microservice instance so that when the information of the target microservice instance is registered with the registration center node, the proxy component adjusts the routing weight of the target microservice instance stored in the registration center node multiple times according to a trend of gradual increase until the routing weight of the target microservice instance is the target routing weight.

[0007] The embodiment of the present application further provides an electronic device, comprising: a memory and a processor; wherein the memory is used to store a computer program; The processor is coupled to the memory and is used to execute the computer program to perform the steps in the above-mentioned microservice management methods.

[0008] An embodiment of the present application also provides a computer-readable storage medium storing computer instructions. When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the steps in the above-mentioned microservice management methods.

[0009] An embodiment of the present application also provides a computer program product, including a computer program. When the computer program is executed by one or more processors, the one or more processors are caused to execute the steps in the above-mentioned microservice management methods.

[0010] In an embodiment of the present application, the microservice instance is configured with a proxy component, which can gradually increase the routing weight of the target microservice instance to the target routing weight at the initial startup of the target microservice instance, so that the target microservice instance can smoothly pass the startup period. If the service consumer of the target service has a large number of concurrent access requests to the target service when the target microservice instance is just started, the service consumer may not send too many access requests to the target microservice instance due to the small routing weight of the target microservice instance, which can reduce the processing pressure of the target microservice instance at the initial startup, thereby helping to reduce the traffic loss of the target microservice instance at the initial launch. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings: Figure 1 and Figure 2 A schematic diagram of the structure of the microservice management system and a schematic diagram of the microservice online process provided in the embodiment of the present application; Figure 3 A schematic diagram of the structure of the deployment form of the proxy component provided in the embodiment of the present application; Figure 4 and Figure 5 A schematic diagram of a function curve of the routing weight changing over time provided in an embodiment of the present application; Figure 6 A schematic diagram of the microservice offline process provided in an embodiment of the present application; Figure 7 and Figure 8 A flowchart of a microservice management method provided in an embodiment of the present application; Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0012] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.

[0013] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0014] During the launch of a microservice, if a large number of requests come in before the microservice is ready, some of the requests may fail to be processed, causing traffic loss and reducing the overall availability of the microservice system.

[0015] In some embodiments of the present application, in order to reduce the traffic loss during the launch of a microservice, a proxy component is configured for the microservice instance. The proxy component can gradually increase the routing weight of the target microservice instance to the target routing weight at the initial startup of the target microservice instance, so that the target microservice instance can smoothly pass through the startup period. If the service consumer of the target service has a large number of concurrent access requests to the target service when the target microservice instance is just started, the service consumer may not send too many access requests to the target microservice instance because the routing weight of the target microservice instance is small, which can reduce the processing pressure of the target microservice instance at the initial startup, thereby helping to reduce the traffic loss of the target microservice instance at the initial launch.

[0016] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.

[0017] It should be noted that the same reference numerals denote the same objects in the following drawings and embodiments, and therefore, once an object is defined in one drawing or embodiment, it does not need to be further discussed in the subsequent drawings and embodiments.

[0018] Figure 1 and Figure 2 This is a schematic diagram of the structure of the microservice management system provided in the embodiment of the present application. Figure 1 and Figure 2 As shown, the microservice management system mainly includes: a control node 10, a service cluster 20 and a registration center node 30 corresponding to the microservice.

[0019] In this embodiment, the service cluster 20 is used to deploy microservice instances of the application. The microservice architecture splits a large application into a series of small, independent services, which are microservices. Each microservice is responsible for a specific service function and can be independently deployed, expanded and maintained. For example, the microservice instances of an e-commerce platform may include: (1) user services, which are responsible for user account management, such as user account creation, login, password reset, etc., and can provide an application programming interface (API) to manage user information, etc.; (2) product services, which manage product catalogs, including the addition, deletion and modification of products, etc. (3) Shopping cart service, which manages the user's shopping cart and handles the addition, deletion and quantity update of items; (4) Order service, which is responsible for processing operations such as order creation, payment, cancellation and refund, and can also track order status and communicate with logistics service to update delivery information; (5) Payment service, which is responsible for processing payment transactions, including authorization, settlement, refund, etc.; 6. Comment service, which is responsible for managing product reviews and ratings; (7) Search service, which provides full-text search function, supports filtering conditions such as keywords, price ranges, brands, and optimizes search result sorting, and provides personalized search suggestions; (8) Recommendation service, which is responsible for user portraits and provides personalized product recommendations; (9) Inventory service, which is responsible for managing inventory information, working closely with product service and order service to update inventory in real time; (10) Logistics service, which is responsible for tracking the delivery status of orders; (11) Customer service, Duzi provides customer service functions and is also responsible for managing customer complaints, inquiries and feedback.

[0020] The control node 10 refers to a service node that manages the microservice instances in the service cluster 20, and can be a single server device, a cloud server array, or a virtual machine (VM) running in a cloud server array. In addition, the control node 10 can also refer to other computing devices with corresponding service capabilities, such as computers and other terminal devices (running service programs), etc.

[0021] In the embodiment of the present application, the microservice launch may include any form of publishing a microservice instance, including but not limited to: initial creation of a microservice instance, update of a microservice instance, and expansion of a microservice instance. When a microservice is launched, the control node 10 may respond to a service launch request for a target service and create a microservice instance providing the target service in the service cluster 20, which is defined as a target microservice instance. In the embodiment of the present application, the specific content of the target service is not limited, and it may be any service split out of an application, such as a commodity service, user service, payment service, or shopping cart service in the aforementioned e-commerce platform.

[0022] In the embodiment of the present application, the control node 10 may obtain a service launch request for a target service (corresponding to Figure 1 and Figure 2 Step 1). In the embodiment of the present application, the specific source of the service launch request obtained by the control node 10 is not limited. The service launch request can be triggered by the operation and maintenance personnel (ie, the user) of the microservice, or it can be automatically triggered by the service cluster 20. Figure 2 As shown, for an embodiment triggered by an operation and maintenance personnel of a microservice, the operation and maintenance personnel may send a service launch request to the control node 10 through a terminal device 40. The service launch request may include an identifier of the target service, and the like.

[0023] In some embodiments, Figure 2 As shown, the management and control node 10 may provide a user interface (User Interface), which (eg Figure 2 The "Service Online Operation Interface" may include: target service editing controls (such as Figure 2 The operator can determine the target service based on the target service edit control. The target service edit control can be a click control or a text input box. When the operator determines the target service, he can create a control (such as Figure 2 The service creation process is triggered by clicking a “Create Service” button. Accordingly, the terminal device 40 may send a service online request to the management and control node 10 in response to the service creation operation.

[0024] In other embodiments, the service launch request may be automatically triggered by the service cluster 20. The management node (not shown in the accompanying drawings) in the service cluster 20 may monitor the microservice creation event for the target service. In the embodiment of the present application, the specific implementation method of the service cluster 20 monitoring the microservice creation event is not limited. In some embodiments, the management node in the service cluster 20 may monitor the traffic load of the microservice instance corresponding to the deployed target service in the service cluster; if the traffic load of the microservice instance corresponding to the deployed target service in the service cluster is greater than or equal to the set traffic threshold, it means that the target service needs to be expanded, that is, it is determined that the microservice creation event for the target service occurs. Alternatively, the management node in the service cluster 20 may monitor the health status of the microservice instance corresponding to the deployed target service in the service cluster; if the management node in the service cluster 20 detects that the microservice instance corresponding to the deployed target service in the service cluster has an abnormal microservice instance, it is determined that the microservice creation event for the target service occurs. Further, the management node in the service cluster 20 responds to the microservice creation event for the target service and sends a service launch request to the control node 10.

[0025] Accordingly, the control node 10 may receive a service launch request for a target service, and in response to the service launch request, create a target microservice instance (corresponding to Figure 1 and Figure 2 Step 2 in the above example).

[0026] Specifically, the control node 10 can respond to the service launch request for the target service and determine the target resources required for the target service from the service cluster 20, including but not limited to: computing resources, storage resources, and input / output (IO) resources. The control node 10 can also obtain the image file of the target service and use the target resources to run the image file of the target service to create a target microservice instance.

[0027] For a newly created target microservice instance, if it wants to receive traffic, it needs to register its information in advance to the registration center node 30. Among them, the registration center node 30 is used to manage the information of the microservice instance. In the microservice architecture, service registration is a crucial link. Its role is to manage the communication between microservices and ensure that the service consumer can find and call the service provider. Among them, the service consumer and the service provider describe the calling relationship between microservices. A service provider refers to a service that provides specific functions or service logic, and can expose interfaces (such as APIs, etc.) for other services or clients to call. Service providers usually have data and service logic, and are responsible for processing requests, executing service operations, and returning responses. Service consumers refer to services that need to call functions or data provided by service providers. In the microservice architecture, service consumers can be other microservice instances that call functions or data provided by service providers. They initiate call requests through the interfaces exposed by service providers, receive responses from service providers, and may further process data. For example, for an e-commerce platform, the commodity service is a service provider responsible for managing commodity information, inventory, and prices. The shopper service is a service consumer of the product service, and it needs to call the product service to obtain product details and update the user's shopping cart, etc. In the embodiment of the present application, the access request received by the microservice instance mainly refers to the access request or call request sent by the service consumer of the microservice instance.

[0028] In an embodiment of the present application, a microservice instance registers its information to a registration center node 30. The registration center node 30 maintains a real-time list of microservice instances, which is used to maintain the information of the microservice instances, allowing service consumers to find and connect to the microservice instances corresponding to the correct service provider. Service consumers can obtain the information of service providers from the registration center node 30 through a service discovery mechanism, and call the service provider based on the information of the service provider. Among them, the information of the microservice instance is used to describe the attribute information of the microservice instance, including but not limited to: the identifier of the service provided by the microservice instance, the instance identifier, the address information of the microservice instance, and the metadata of the microservice instance.

[0029] Among them, the identifier of the service provided by the microservice instance can uniquely identify a service, such as the service identity (ID) or service name, etc.; the instance identifier can uniquely identify a microservice instance, which can be an instance ID, etc. The address information of the microservice instance may include: the host name or Internet Protocol (IP) address and port number of the microservice instance. Of course, the address information of the microservice instance may also include: the network address of the microservice instance, such as the Uniform Resource Locator (URL), which may include: the network protocol, host name and port number followed by the microservice instance call, etc. The metadata of the microservice instance may include: the version number, operating environment and custom tags of the microservice instance, etc.

[0030] In an embodiment of the present application, a service consumer of a microservice instance may obtain address information of the microservice instance from the registration center node 30 and call the microservice instance according to the address information of the microservice instance.

[0031] In order to reduce the traffic loss when the microservice is online, the target microservice instance can be started when the target microservice instance receives the traffic. Therefore, for the currently online target microservice instance, the information of the target microservice instance can be registered to the registration center node 30 (corresponding to Figure 1 Step 3).

[0032] In some embodiments of the present application, the target microservice instance may register the information of the target microservice instance in the registration center node 30 after the startup is completed. Figure 1 and Figure 2 As shown, an agent component 201 may also be configured for the target microservice instance. The agent component 201 is mainly responsible for realizing the state monitoring of the target microservice instance itself and the interaction with the control node 10.

[0033] Among them, Figure 1 and Figure 2As shown, the proxy component 201 can correspond to the microservice instance one by one, that is, one proxy component 201 is configured in each microservice instance. Figure 3 As shown, multiple microservice instances providing the same service share a proxy component 201. For an embodiment in which a proxy component 201 is configured for each microservice instance, the management and control node 10 may configure the proxy component 201 for the target microservice instance after creating the target microservice instance in the service cluster 20.

[0034] Specifically, the management and control node 10 may obtain a proxy configuration form supported by a programming language type of the target microservice instance; and configure a proxy component 201 for the target microservice instance according to the proxy configuration form.

[0035] Specifically, if the programming language type of the target microservice instance is the target programming language, the proxy configuration form supported by the target programming language is to configure the proxy component by changing the proxy of the target microservice instance. Accordingly, the control node 10 can modify the code of the target microservice instance using the code of the proxy component written in the target programming language, thereby adding the proxy component to the target microservice instance. For example, if the target programming language is Java, the proxy configuration form supported by the Java language is the Java Agent (JavaAgent) form. Among them, Java Agent allows the bytecode of a class to be dynamically modified or runtime information to be collected when the Java application is running, and the class bytecode can be modified before the class is loaded. Accordingly, the control node 10 can use JavaAgent to use the code of the proxy component written in Java to modify the code of the target microservice instance, thereby adding the proxy component to the target microservice instance.

[0036] If the programming language type of the target microservice instance is not the target programming language, that is, this type of programming language does not support configuring the proxy component by changing the code of the target microservice instance, then the proxy configuration form supported by the programming language type of the target microservice instance is the sidecar form. Accordingly, the control node 10 can use the code of the proxy component written in the programming language type of the target microservice instance to configure the proxy component 201 for the target microservice instance in the sidecar form.

[0037] Specifically, the control node 10 installs the code of the proxy component written in the programming language type of the target microservice instance on the target microservice instance in the form of Sidecar, thereby configuring the proxy component 201 for the target microservice instance. The Sidecar form can realize the proxy of multi-language microservice heterogeneous environment and realize zero-intrusive microservice communication and management.

[0038] In some embodiments, the service cluster 20 is a container orchestration cluster, such as a Kubernetes (K8s) system, and the target microservice instance can be deployed in a container group (such as a Pod). Accordingly, the control node 10 adds a container that executes the code of the proxy component written in the programming language type of the target microservice instance in the container group where the target microservice instance is located in the form of a Sidecar, thereby configuring the proxy component 201 for the target microservice instance.

[0039] In other embodiments, Figure 3 As shown, microservice instances providing the same service share a proxy component 201. In this embodiment, the management and control node 10 may associate the target microservice instance with the proxy component corresponding to the target service after creating the target microservice instance in the service cluster, thereby configuring the proxy component for the target microservice instance. For example, for a container orchestration system, the proxy component corresponding to the target service may be implemented as a container group (such as a Pod) of the proxy component code written in the programming language type that runs the target microservice instance. Accordingly, associating the target microservice instance with the proxy component corresponding to the target service may be implemented by providing the address information of the target microservice instance to the container group corresponding to the proxy component corresponding to the target service.

[0040] Based on the proxy component 201 configured by the target microservice instance, the proxy component 201 can register the information of the target microservice instance (corresponding to Figure 1 Step 3).

[0041] The service consumer of the target microservice instance can obtain the address information of the target microservice instance from the registration center node 30, and access the target microservice instance according to the address information of the target microservice instance.

[0042] In some embodiments, when the information of the target microservice instance is registered to the registration center node 30, the performance of the target microservice instance may not be fully started, such as some plug-ins need to be loaded. If a service consumer accesses the target microservice instance at this time, the target microservice instance may fail to process the access request because the target microservice instance is not fully started, resulting in traffic loss. In order to reduce the traffic loss caused by this situation, in some embodiments of the present application, the information of the target microservice instance can be registered to the registration center node 30 (corresponding to the registration center node 30) after a certain period of time after the target microservice instance is started. Figure 2 Step 3) allows the target microservice instance to have enough time to start fully during the delay time.

[0043] The delay registration duration of the target microservice instance information is the set duration, which can be pre-configured in the target microservice instance or provided by the operation and maintenance personnel based on operation and maintenance experience. Figure 2 As shown, the user interface is provided with a delay time configuration control for information registration (such as Figure 2 "Delayed registration time configuration"), the operation and maintenance personnel can set the delayed registration time through the information registration delay time configuration control. The operation and maintenance personnel can send a service launch request to the control node 10 through the terminal device 40. The service launch request may include the identifier of the target service and the delayed registration time. Among them, the delayed registration time. Accordingly, the target microservice instance or proxy component 201 can obtain the delayed registration time from the service launch request as the set time.

[0044] If the programming language type of the aforementioned target microservice instance is the target programming language (such as Java), the proxy component 201 modifies the information registration logic of the target microservice instance into the target registration logic in the form of an aspect. The target registration logic includes: when the target microservice is started, after a set delay, the operation of registering the information of the target microservice instance to the registration center node 30 is performed.

[0045] Among them, the aspect encapsulates behaviors or functions that are scattered in multiple modules but need to be processed uniformly. The aspect includes: (1) Join Point: a specific point in the program execution process. The aspect will insert specific behaviors at these join points; (2) Advice: a code snippet executed at the join point, which can be before the method call, after the call, after the exception is thrown, the final call (whether normal exit or abnormal exit) or around the advice; (3) Pointcut: an expression that defines which join points will execute the advice. It is a filtering mechanism used to specify which method calls should trigger the execution of the advice; (4) Introduction: allows new interfaces or methods to be added to existing classes, so that new behaviors can be added without modifying the original code; (5) Weaving: the process of connecting the aspect code to the ordinary object code. Weaving can be completed at compile time, class loading time or runtime. Based on the composition form of the aspect, the proxy component 201 can insert a delayed registration mechanism before the target microservice instance executes the information registration logic. The target microservice instance can register information according to the modified registration logic.

[0046] Specifically, when the target microservice instance is started, the target microservice instance can perform an operation of registering the information of the target microservice instance to the registration center node 30 after a set delay. Specifically, when the target microservice instance is started, the target microservice instance can count the delayed registration time, and when the delayed registration time reaches the set time, send a registration request to the registration center node 30. The registration center node 30 can register the information of the target microservice instance to the registration center node 30 in response to the registration request.

[0047] In the embodiment where the programming language type of the aforementioned target microservice instance is a programming language other than the target programming language (such as Java language), the proxy component 201 is a proxy component configured in the form of Sidecar. In this embodiment, the target microservice instance sends a registration request to the registration center node 30 when the target microservice instance is started. Since the proxy component 201 is configured in the form of Sidecar, the proxy component 201 can perform the target operation. The target operation includes: intercepting the registration request, timing the delay time, and sending a registration request to the registration center node 30 when the delay registration time reaches the set time. The registration center node 30 can register the information of the target microservice instance to the registration center node 30 in response to the registration request.

[0048] This information registration method of delaying the registration of the target microservice instance information to the registration center node after the target microservice instance is started can allow the target microservice instance to have enough time to start fully before receiving the access request, that is, the target microservice instance has enough time to improve its performance. In this way, when an access request arrives, the target microservice instance can have better processing performance to process the access request, thereby reducing the traffic loss of the access request.

[0049] After registering the information of the target microservice instance to the registration center node 30, the service consumer of the target microservice instance can obtain the information of the target microservice instance from the registration center node 30, and access the target microservice instance based on the information of the target microservice instance. Specifically, the service consumer of the target microservice instance can obtain the address information of the target microservice instance from the registration center node 30, and send an access request to the target microservice instance based on the address information of the target microservice instance.

[0050] After the information of the target microservice instance has just been started, if a large number of concurrent access requests flow into the target microservice instance, it may cause a large processing pressure on the target microservice instance, causing some access request processing to fail, resulting in a certain amount of traffic loss. In order to reduce the traffic loss caused by this situation, the embodiment of the present application proposes the concept of microservice preheating call. Specifically, the routing weight of the microservice instance can be adjusted to limit the inflow traffic at the initial startup of the target microservice instance, and gradually increase the traffic until the target microservice instance is fully preheated.

[0051] Among them, the routing weight of the microservice instance is used to determine the probability of the microservice instance being assigned to an access request, and then determines the amount of access requests assigned to the microservice instance. The smaller the routing weight of the microservice instance, the smaller the probability of being accessed, and the smaller the amount of access requests received. In an embodiment of the present application, the routing weight of the target microservice instance can be gradually increased over time, that is, the target microservice instance is assigned a lower routing weight when it is just started, and its routing weight is gradually increased as the performance of the target microservice instance improves.

[0052] Specifically, when the information of the target microservice instance is registered to the registration center node 30, the proxy component 201 may adjust the routing weight of the target microservice instance stored in the registration center node 30 one by one according to the trend of increasing one by one, until the routing weight of the target microservice instance is adjusted to the target routing weight (corresponding to Figure 1 and Figure 2 Step 4). The target routing weight may be determined by the total number N of microservice instances providing the target service in the service cluster 20. N ≥ 2 and is an integer. The microservice instances providing the target service include the target microservice instances. For example, the target routing weight is equal to the reciprocal of the total number N of microservice instances providing the target service, that is, 1 / N. For example, if the total number of microservice instances providing the target service is 5, the target routing weight may be 0.2.

[0053] Based on the routing weights of the multiple microservice instances providing the target service stored in the registration center node 30, when accessing the target service, the service consumer of the target service can obtain the routing weights of the multiple microservice instances providing the target service from the registration center node 30, and initiate access to the corresponding request volume (corresponding to Figure 1 and Figure 2 Step 5 “Preheat call”). In each embodiment of the present application, a plurality refers to more than 2.

[0054] Specifically, when accessing the target service, the service consumer of the target microservice instance can obtain the routing weights of multiple microservice instances providing the target service from the registration center node 30, and normalize the routing weights of the multiple microservice instances, thereby converting the routing weights of the multiple microservice instances into values ​​between 0 and 1, and obtaining the routing probabilities of the multiple microservice instances. The sum of the routing probabilities of the multiple microservice instances is equal to 1.

[0055] Specifically, for any microservice instance 1, the routing weight 1 of the microservice instance can be divided by the sum of the routing weights of multiple microservice instances to obtain the routing probabilities of the multiple microservice instances, thereby normalizing the routing weights of the multiple microservice instances. In this way, the routing probabilities of the multiple microservice instances are distributed between 0 and 1, and the routing probabilities of the multiple microservice instances are then equal to 1. For example, assuming that the target service corresponds to 5 microservice instances, and at a certain moment, the routing weights of the 5 microservice instances are (0.05, 0.05, 0.1, 0.2, 0.2), respectively, then the routing probabilities of the multiple microservice instances are (1 / 12, 1 / 12, 1 / 6, 1 / 3, 1 / 3), respectively.

[0056] Furthermore, the routing probabilities of multiple microservice instances can be divided into multiple probability ranges. Among them, the lower limit value of the probability range corresponding to the microservice instance with the smallest routing probability is 0, and the upper limit value is the routing probability of the microservice instance; the lower limit value of the probability range corresponding to other microservice instances is: the largest routing probability among the first routing probabilities, and the first routing probability is the routing probability among the routing probabilities of multiple microservice instances that is smaller than the routing probability of the current microservice instance. The upper limit value of the probability range corresponding to other microservice instances is the routing probability of the microservice instance. Each probability range may include an upper limit value but not a lower limit value. For example, for an example in which the routing probabilities of multiple microservice instances are (1 / 12, 1 / 12, 1 / 6, 1 / 3, 1 / 3), the probability ranges corresponding to the multiple microservice instances are (0, 1 / 12], (0, 1 / 12], (1 / 12, 1 / 6], (1 / 6, 1 / 3], and (1 / 6, 1 / 3], respectively.

[0057] Furthermore, the service consumer of the target service can generate a random number distributed between 0 and 1, and determine the target probability range to which the random number belongs from the probability ranges corresponding to multiple microservice instances; then, the address information of the microservice instance to which the target probability range belongs is obtained from the registration center node 30, and based on the address information of the microservice instance to which the target probability range belongs, the access request to the target service is sent to the microservice instance to which the target probability range belongs. In this way, each microservice instance can obtain the access request corresponding to the request amount of its routing weight. Among them, the smaller the routing weight of the microservice instance, the smaller the probability of receiving the microservice instance, and the smaller the traffic of the received access request.

[0058] In this embodiment, the microservice instance is configured with a proxy component, which can gradually increase the routing weight of the target microservice instance to the target routing weight at the initial startup of the target microservice instance, so that the target microservice instance can smoothly pass the startup period. If the service consumer of the target service has a large number of concurrent access requests to the target service when the target microservice instance is just started, the service consumer may not send too many access requests to the target microservice instance because the routing weight of the target microservice instance is small, which can reduce the processing pressure of the target microservice instance at the initial startup, thereby helping to reduce the traffic loss of the target microservice instance at the initial launch.

[0059] In the embodiment of the present application, the specific implementation method of the proxy component 201 gradually increasing the routing weight of the target microservice instance to the target routing weight is not limited. In some embodiments, the proxy component 201 may determine the target routing weight according to the total number N of microservice instances providing the target service. For example, the proxy component 201 may determine the target routing weight according to the reciprocal of the total number N of microservice instances providing the target service, that is, 1 / N.

[0060] The proxy component 201 is pre-configured with an initial function of the routing weight changing over time. Among them, the initial function of the routing weight y changing over time t can be: a function with time t as the independent variable and routing weight y as the dependent variable. In this embodiment, the initial function is a monotonically increasing convex function, so that the routing weight gradually increases over time, and the rate of change of the routing weight over time gradually increases. Among them, the rate of change of the routing weight over time is relatively small in the early stage of the microservice instance going online, and the increase of the access traffic received by the microservice instance is also relatively slow, which can reduce the processing pressure of the target microservice instance in the early stage of startup, and thus help reduce the traffic loss of the target microservice instance in the early stage of going online.

[0061] After the target microservice instance is started, its performance gradually improves over time, and the rate of change of the routing weight gradually increases over time. The access traffic that matches the current performance of the target microservice instance can be received faster, which can reduce the resource waste of the target microservice instance.

[0062] It is worth noting that the convex function in the embodiment of the present application refers to a concave downward function, and the derivative of the convex function is monotonically increasing.

[0063] In some embodiments, the initial function includes a target parameter. The target parameter is a parameter that affects the rate of change of the routing weight over time. For example, the initial function is a power function, in which time t is located on the base of the power function; the target parameter may be the power of time. Among them, in the early stage of the microservice instance startup, the larger the power x, the smaller the rate of change of the routing weight over time, that is, the slower the routing weight rises. For another example, the initial function is a univariate polynomial function, in which time t is the independent variable, and the target parameter may be the degree of the polynomial and / or the coefficient of the polynomial, that is, the degree of the highest order term in the univariate polynomial function. Among them, in the early stage of the microservice instance startup, the larger the degree of the polynomial, the smaller the rate of change of the routing weight over time. The larger the coefficient of the polynomial, the greater the rate of change of the routing weight over time. Optionally, the univariate polynomial function may have only the highest order term, and the target parameter may be the degree of the polynomial and / or the coefficient of the highest order term accordingly.

[0064] Based on the initial function, the proxy component 201 can obtain the parameter value of the target parameter. In the embodiment of the present application, the specific implementation method of obtaining the parameter value of the target parameter is not limited. In some embodiments, Figure 2 As shown, the parameter value of the target parameter can be set by the operation and maintenance personnel according to the experience value. Accordingly, the user interface may include a target parameter setting control, and the operation and maintenance personnel may set the parameter value of the target parameter based on the target parameter setting control when initiating a service launch request. In this way, the terminal device 40 of the operation and maintenance personnel can obtain the parameter value of the target parameter set based on the target parameter setting control, and carry the parameter value of the target parameter in the service launch request; then, the service launch request is sent to the management and control node 10. The management and control node 10 can obtain the parameter value of the target parameter from the service launch request, and provide the parameter value of the target parameter to the proxy component. Accordingly, the proxy component 201 can receive the parameter value of the target parameter.

[0065] Furthermore, the proxy component 201 may modify the pre-configured initial function according to the parameter value of the target parameter to obtain the target function. Specifically, the parameter value of the target parameter may be brought into the initial function to obtain the target function.

[0066] In some embodiments, the parameters that can be set by the operation and maintenance personnel in the initial function may only be the target parameters. For example, the initial function may be the highest order term of a univariate polynomial function, which can be expressed as the following formula (1): (1).

[0067] In formula (1), y represents the routing weight of the target microservice instance, t represents time, and k represents the target parameter. In this embodiment, k is greater than 0 and less than the target routing weight a, that is, 0<k<a. n≥2. The relationship between the routing weight represented by the initial function shown in formula (1) and the time is as follows: Figure 4 As shown. Figure 4 In the above example, the target parameters k of different curves are different. k1>k2>k3. Figure 4 As shown in the figure, at the initial startup of the target microservice instance, the larger the k, the faster the routing weight changes over time.

[0068] Here, n can be a fixed value or a target parameter. Figure 4 In the figure, n is taken as a fixed value for illustration only, but it does not constitute a limitation. The larger k is, the faster the rate at which the routing weight changes over time. Figure 4 The routing weights of the three curves shown are increased to the target routing weight a at time t1, t2 and t3, respectively.

[0069] In other embodiments, the initial function includes a target parameter, a parameter representing a target routing weight, and a parameter representing a set duration. The target parameter refers to a parameter that affects the rate of change of the routing weight over time. Among them, the set duration refers to the length of time required to increase the routing weight of the target microservice instance to the target routing weight. For ease of description and distinction, in the embodiments of the present application, the length of time required to increase the routing weight of the target microservice instance to the target routing weight is defined as the set first duration; the set duration used for the delayed registration of the target microservice instance in the aforementioned embodiment is defined as the set second duration. Among them, the first duration can be determined by the warm-up time required for the microservice instance at the initial startup. Generally, the longer the microservice instance needs to be warmed up, the greater the first duration.

[0070] In this embodiment, no matter how the target parameters change, the routing weight of the target microservice instance can be increased to the target routing weight in the first duration. For example, in some embodiments, the initial function can be a power function, which can be expressed as the following formula (1): (2).

[0071] In formula (2), y represents the routing weight of the target microservice instance, t represents time, t0 represents the first duration, a represents the target routing weight, and x represents the target parameter. For the initial function shown in formula (2), no matter what the value of the target parameter x is, the routing weight y of the target microservice instance can be increased to the target routing weight a in the first duration t0.

[0072] Among them, the relationship between the routing weight and time represented by the initial function shown in formula (2) is as follows: Figure 5 As shown. Figure 5 In the example, the target parameters x of different curves are different, x1<x2<x3. Figure 5 As shown in the figure, in the early stage of starting the target microservice instance, the larger the x is, the slower the rate at which the routing weight changes over time.

[0073] Based on the parameters included in the initial function, the proxy component 201 can obtain the pre-configured first duration. In the embodiment of the present application, the specific implementation method of the proxy component 201 obtaining the first duration is not limited. In some embodiments, Figure 2 As shown, the operation and maintenance personnel can set the preheating duration according to the experience value, that is, set the first duration. Accordingly, the user interface may include a preheating duration setting control, and the operation and maintenance personnel can set the parameter value of the target parameter based on the preheating duration setting control when initiating a service launch request. In this way, the terminal device 40 of the operation and maintenance personnel can obtain the first duration set based on the preheating duration setting control, and carry the first duration in the service launch request; then, send the service launch request to the management and control node 10. The management and control node 10 can obtain the first duration from the service launch request and provide the first duration to the agent component. Accordingly, the agent component 201 can receive the first duration.

[0074] Further, the proxy component 201 can modify the initial function of the pre-configured routing weight changing over time according to the target routing weight, the parameter value of the target parameter and the pre-configured first duration to obtain the target function. Specifically, the target routing weight, the parameter value of the target parameter and the pre-configured first duration can be brought into the initial function to obtain the target function.

[0075] For the initial function shown in equation (3), assuming that the target routing weight is 0.2, t0=10s, x=3, the objective function can be expressed as: (3).

[0076] After obtaining the objective function, the proxy component 201 can adjust the routing weight of the target microservice instance multiple times according to the objective function until the routing weight of the target microservice instance is adjusted to the target routing weight. Since the objective function is a convex function, the rate of change of the routing weight over time gradually increases. In this way, the microservice instance is small in the early stage of going online, and the increase of the access traffic received by the microservice instance is relatively slow, which can reduce the processing pressure of the target microservice instance in the early stage of startup, thereby helping to reduce the traffic loss of the target microservice instance in the early stage of going online.

[0077] The microservice launch method provided in the embodiment of the present application can be applied to any scenario that requires launching a microservice instance, including but not limited to: initial creation of a microservice instance, update of a microservice instance, expansion of a microservice instance, and rolling release of a microservice instance. Among them, the rolling release of a microservice instance is used in the microservice architecture to update the application without interrupting the service. The rolling release strategy gradually replaces the microservice instances in the service cluster, updating only a small part at a time, so that when a problem occurs in the new version, it can quickly roll back to the original version, while ensuring that the entire microservice system is still available.

[0078] The rolling release generally includes the following steps: (1) Create a new microservice version that contains the latest features or fixes; (2) Deploy new instances: Deploy a small number of new microservice instances in the production environment, usually a portion of the servers in the service cluster; (3) Traffic switching: Routing a small portion of user traffic to the new microservice instance, which can be achieved through a load balancer or service mesh; (4) Health check: Monitor the operation of the new microservice instance to ensure that it is stable and does not introduce new errors or performance issues. (5) Gradual promotion: After confirming that the new microservice instance is running stably, gradually increase the number of new microservice instances and reduce the number of old microservice instances until all instances are replaced by the new version; (6) Complete switch: When all old microservice instances are replaced, the new microservice instance becomes the only running version.

[0079] In container orchestration systems, such as K8s systems, rolling release is often used to ensure the availability of the service system. For container orchestration systems, a service cluster can be a container orchestration cluster, including one or more container groups (such as Pods). Multiple means more than 2. The container orchestration cluster includes: a target container group with a target microservice instance deployed. A proxy component 201 is added to the target container group. The proxy component 201 can be implemented as a container in the target container group. Since the target microservice instance is deployed in a container group (Pod), the target microservice instance needs to have a ready container group (Ready) to provide services stably. Based on this, in this embodiment, the life cycle of the microservice can be associated with the readiness check function of the container group.

[0080] Among them, readiness probes in container orchestration systems (such as K8s systems) are an important health monitoring and lifecycle management function used to determine whether a container group is ready to accept traffic. Readiness checks determine whether to route network traffic for a service to a specific container group. The container orchestration cluster will only route network traffic to the container group when all containers in the container group are in a ready state. For applications that take a long time to initialize resources at startup, readiness checks ensure that the container group does not receive any traffic until these initialization processes are completed, thereby preventing the client from receiving an error response.

[0081] For the container orchestration system, the container orchestration cluster also includes: a container proxy component (not shown in the figure). Among them, the container proxy component is a proxy service running on each service node. A service node may include multiple container groups. The container proxy component is responsible for ensuring that the containerized application runs as expected. In the K8s system, the container proxy component can be a Kubelet component. In this embodiment, the readiness check function of the container proxy component is mainly used.

[0082] The proxy component 201 of the target microservice instance can associate the proxy component 201 with the readiness check process of the container proxy component on the target container group during the creation process of the target container group, so that the container proxy component can call the proxy component 201 when performing the readiness check on the target container group. Specifically, the proxy component 201 can specify the interface of the container proxy component for the readiness check as the interface of the proxy component 201 during the creation process of the target container group, thereby associating the proxy component 201 with the readiness check process of the container proxy component on the target container group. In this way, when the container proxy component performs the readiness check on the target container group, it can call the interface of the proxy component 201, thereby realizing the call to the proxy component 201.

[0083] For the proxy component 201, in response to the call of the container proxy component, it can detect whether the routing weight of the target microservice instance is the target routing weight to obtain a detection result. The detection result is that the routing weight of the target microservice instance is the target routing weight; or, the routing weight of the target microservice instance is less than the target routing weight.

[0084] Further, the proxy component 201 may return specified information reflecting the ready state of the target container to the container proxy component based on the detection result. Specifically, if the detection result is that the routing weight of the target microservice instance is less than the target routing weight, then the specified information reflecting that the target container group is not ready is returned to the container proxy component, such as returning the status code "500" to the container proxy component. Among them, the status code "500" indicates that the target container group is not ready in the readiness check function of the container orchestration system. If the detection result is that the routing weight of the target microservice instance is the target routing weight, then the specified information reflecting that the target container group is ready is returned to the container proxy component, such as returning the status code "200" to the container proxy component. Among them, the status code "200" indicates that the target container group is ready in the readiness check function of the container orchestration system.

[0085] In this embodiment, the service preheating process of the microservice instance is associated with the readiness check process of the container group. When the routing weight of the target microservice instance is less than the target routing weight (that is, the target microservice instance has not been preheated), the readiness check result of the target container group where the target microservice instance is located is not ready. In this case, the original microservice instance corresponding to the target microservice instance continues to be retained in the container orchestration cluster, and the original microservice instance shares the call or access of the service consumer. Afterwards, when the target container group where the target microservice instance is located is ready, all access requests of the service consumer are routed to the target microservice instance, and the container group where the original microservice instance is located is deleted to realize the rolling release of the microservice. In the rolling release process, when the preheating of the target microservice instance is not completed, the original microservice instance corresponding to the target microservice instance shares the access traffic of the service consumer, which can reduce the traffic loss in the rolling release process of the microservice, and even realize the lossless rolling release of the microservice.

[0086] Since services in the container orchestration system are released in a rolling manner, the online method of the microservice instance provided in the embodiment of the present application can also be implemented as a rolling microservice release process, thereby reducing the traffic loss of the rolling release of microservices.

[0087] In addition to associating the warm-up process of the microservice instance with the readiness check process of the container group, in some embodiments of the present application, the delayed registration process of the microservice instance can also be associated with the readiness check process of the container group. Specifically, the proxy component 201 can associate the proxy component 201 with the readiness check process of the target container group by the container proxy component during the creation process of the target container group, so that the container proxy component can call the proxy component 201 when performing a readiness check on the target container group. Specifically, the proxy component 201 can specify the interface of the container proxy component for readiness check as the interface of the proxy component 201 during the creation process of the target container group, so that the container proxy component can call the interface of the proxy component 201 when performing a readiness check on the target container group, thereby implementing the call to the proxy component 201.

[0088] For the proxy component 201, in response to the call of the container proxy component, it can detect whether the information of the target microservice instance has been registered in the registration center node 30 to obtain a detection result. For the convenience of description and distinction, the detection result of detecting whether the routing weight of the microservice instance is the target routing weight is defined as the first detection result; the detection result of detecting whether the information of the target microservice instance has been registered in the registration center node is defined as the second detection result. Among them, the second detection result is that the information of the target microservice instance has been registered in the registration center node; or, the information of the target microservice instance has not been registered in the registration center node.

[0089] Further, the proxy component 201 may return specified information reflecting the ready state of the target container to the container proxy component based on the second detection result. Specifically, if the second detection result is that the information of the target microservice instance has not been registered with the registration center node, then the specified information reflecting that the target container group is not ready is returned to the container proxy component, such as returning a status code "500" to the container proxy component. If the detection result is that the routing weight of the target microservice instance has been registered with the registration center node, then the specified information reflecting that the target container group is ready is returned to the container proxy component, such as returning a status code "200" to the container proxy component.

[0090] In this embodiment, the delayed registration process of the microservice instance is associated with the readiness check process of the container group. When the information of the target microservice instance is not registered with the registration center node (that is, the delayed registration of the information of the target microservice instance is not completed), the readiness check result of the target container group where the target microservice instance is located is not ready, then the original microservice instance corresponding to the target microservice instance is retained in the container orchestration cluster, and the original microservice instance provides the target service for the service consumer to call or access. Afterwards, when the target container group where the target microservice instance is located is ready, the access request of the service consumer is routed to the target microservice instance, and the container group where the original microservice instance is located is deleted to realize the rolling release of the microservice. In the rolling release process, when the delayed registration of the target microservice instance is not completed, the original microservice instance corresponding to the target microservice instance bears the access traffic of the service consumer, which can reduce the traffic loss in the rolling release process of the microservice, and even realize the lossless rolling release of the microservice.

[0091] Of course, in some embodiments, the delayed registration process of the microservice instance and the service preheating process of the microservice instance can also be associated with the readiness check process of the container group. Based on this, when the container proxy component performs a readiness check on the target container group, it can call the interface of the proxy component 201 to implement the call to the proxy component 201. For the proxy component 201, in response to the call of the container proxy component, it can detect whether the routing weight of the target microservice instance is the target routing weight to obtain a first detection result; and detect whether the information of the target microservice instance has been registered in the registration center node to obtain a second detection result.

[0092] Further, the proxy component 201 may return specified information reflecting the ready state of the target container to the container proxy component based on the first detection result and the second detection result. Specifically, if the first detection result and the second detection result include: the information of the target microservice instance is not registered with the registration center node and / or the routing weight of the target microservice instance is less than the target routing weight, then the specified information reflecting that the target container group is not ready is returned to the container proxy component, such as returning a status code "500" to the container proxy component. If the first detection result and the second detection result include: the information of the target microservice instance has been registered with the registration center node, and the routing weight of the target microservice instance is the target routing weight, then the specified information reflecting that the target container is ready is returned to the container proxy component, such as returning a status code "200" to the container proxy component.

[0093] In this embodiment, the delayed registration process of the microservice instance and the preheating process of the microservice instance are associated with the readiness check process of the container group. When the information of the target microservice instance is not registered with the registration center node (i.e., the delayed registration of the information of the target microservice instance is not completed) and / or the routing weight of the target microservice instance is less than the target routing weight (i.e., the preheating of the target microservice instance is not completed), the readiness check result of the target container group where the target microservice instance is located is not ready, then the original microservice instance corresponding to the target microservice instance is retained in the container orchestration cluster, and the original microservice instance provides the target service to bear or share the call of the service consumer. Afterwards, when the target container group where the target microservice instance is located is ready, the access request of the service consumer is routed to the target microservice instance, and the container group where the original microservice instance is located is deleted to realize the rolling release of the microservice. During the rolling release process, while the delayed registration and / or service preheating of the target microservice instance is incomplete, the original microservice instance corresponding to the target microservice instance bears or shares the access traffic of the service consumer, which can reduce the traffic loss during the rolling release of the microservice and even achieve lossless rolling release of the microservice.

[0094] The inventors of the present application have found that during the service offline process, if there are still unprocessed requests in the service and the microservice has been stopped, then these unprocessed requests will also fail to be processed, causing traffic loss, thereby causing the overall availability of the microservice system to decrease.

[0095] In order to reduce the traffic loss during the offline process of microservices, the microservice management system provided in the embodiment of the present application can not only manage the online microservices, but also manage the offline microservices to reduce the traffic loss during the offline process of the microservice instance.

[0096] Specifically, Figure 6As shown in step 1, the control node 10 can obtain a service offline request for the target microservice instance. In the embodiment of the present application, the specific source from which the control node 10 obtains the service offline request is not limited. The service offline request can be triggered by the operation and maintenance personnel (ie, the user) of the microservice, or it can be automatically triggered by the service cluster 20. Figure 6 As shown, for an embodiment triggered by an operation and maintenance personnel of a microservice, the operation and maintenance personnel may send a service launch request to the control node 10 through a terminal device 40. The service launch request may include an identifier of the target service, and the like.

[0097] In some embodiments, Figure 6 As shown, the management and control node 10 may provide a user interface (such as Figure 6 The user interface may include: offline service editing controls. The operation and maintenance personnel may determine the target microservice instance that needs to be offline based on the offline service editing controls. Accordingly, the terminal device 40 may send a service offline service to the control node 10 in response to the service offline operation.

[0098] In other embodiments, the service offline request may be automatically triggered by the service cluster 20. The service cluster 20 may monitor the offline event of the microservice for the target service. In the embodiment of the present application, the specific implementation method of the service cluster 20 monitoring the offline event of the microservice is not limited. In some embodiments, the service cluster 20 may monitor the traffic load of the microservice instance corresponding to the deployed target service in the service cluster; if there are idle microservice instances in the microservice instance corresponding to the deployed target service in the service cluster, it means that the target service needs to be scaled down, that is, it is determined that the offline event of the microservice for the target service has occurred. Among them, the idle microservice instance is the target microservice instance. Alternatively, the service cluster 20 may monitor the health status of the microservice instance corresponding to the deployed target service in the service cluster; if the service cluster 20 detects that there are abnormal microservice instances in the microservice instance corresponding to the deployed target service in the service cluster, it is determined that the abnormal microservice instance needs to be offline, that is, it is determined that the offline event of the microservice for the target service has occurred. Among them, the abnormal microservice instance is the target microservice instance. Further, the service cluster 20 sends a service offline request to the control node 10 in response to the microservice offline event for the target service.

[0099] Accordingly, the control node 10 may receive a service offline request for the target microservice instance. In order to reduce the traffic loss caused by the failure of processing unprocessed requests in the microservice instance due to the microservice offline, a delayed offline mechanism is also proposed in some embodiments of the present application. Specifically, the control node 10 may respond to the service offline request for the target microservice instance and count the delayed offline time. When the delayed offline time reaches the set third time, the target microservice instance (corresponding to the third time) is deleted from the service cluster. Figure 6 Step 2 "Delayed offline").

[0100] The third duration can be set by the operation and maintenance personnel. In some embodiments, the operation and maintenance personnel can specify the delay offline duration of the microservice instance when the microservice instance goes offline, that is, the third duration. Figure 2 As shown, when the target microservice instance goes online, the operation and maintenance personnel can specify or set the delayed offline time when the target microservice instance goes offline, that is, the third time, through the delayed offline time setting control on the user interface. Alternatively, the operation and maintenance personnel can also specify the delayed offline time when the microservice instance goes offline, that is, the third time, when the microservice instance goes offline. Specifically, Figure 6 As shown, when the target microservice instance goes offline, the operation and maintenance personnel can specify or set the delayed offline duration when the target microservice instance goes offline, that is, the third duration, through the delayed offline duration setting control on the user interface. For the embodiment in which the operation and maintenance personnel trigger the offline of the microservice instance, the above two implementation methods of setting the third duration are applicable. For the embodiment in which the offline of the microservice instance is triggered by the service cluster, the operation and maintenance personnel can specify the delayed offline duration when the microservice instance goes offline, that is, the third duration, when the microservice instance goes online.

[0101] In other embodiments, the control node 10 may also monitor the load request volume of the target microservice instance, that is, the number of unprocessed requests; and determine the time required for the target microservice instance to process the currently unprocessed requests based on the load request volume of the target microservice instance when the service offline request is received. Optionally, the control node 10 may pre-store the time required for the target microservice instance to process a single request, and then determine the time required for the target microservice instance to process the currently unprocessed requests based on the load request volume of the target microservice instance when the service offline request is received and the time required for the target microservice instance to process a single request.

[0102] Afterwards, the control node 10 may determine a third duration according to the duration required for the target microservice instance to process the currently unprocessed request, wherein the third duration is greater than or equal to the duration required for the target microservice instance to process the currently unprocessed request.

[0103] The proxy component 201 can respond to the offline preparation instruction and delete the information of the target microservice instance registered in the registration center node 30 (corresponding to Figure 6 Step 3.1 "Delete the information of the target microservice instance"). Figure 6 As shown in step 2, the offline preparation instruction may be sent to the proxy component 201 by the control node 10 after responding to the service offline request. Alternatively, the offline preparation instruction may be sent to the proxy component 201 by the management node (not shown in the figure) in the service cluster in response to the offline event of the target microservice instance.

[0104] The management node can use the preStop hook to send offline preparation instructions to the proxy component 201. Among them, preStop is a type of container lifecycle hook, which allows some custom operations to be performed before the container is terminated. When the service cluster decides to stop a container in a container group, it will trigger the preStop hook, and then wait for the PreStop hook to be executed before continuing the container stop process. Specifically, when the management node detects the offline event of the container corresponding to the target microservice instance, it can trigger the preStop hook to send an offline preparation instruction to the proxy component 201 and send a service offline request to the control node 10.

[0105] Accordingly, the proxy component 201 can respond to the offline preparation instruction and delete the information of the target microservice instance registered in the registration center node 30. The control node 10 can respond to the service offline request for the target microservice instance and count the delayed offline time. When the delayed offline time reaches the set third time, the target microservice instance is deleted from the service cluster, that is, the target microservice instance is offline (corresponding to Figure 6 Step 4 "Take the target microservice instance offline").

[0106] In this embodiment, on the one hand, when the target microservice instance goes offline, the management and control node 10 delays for a certain period of time before taking the target microservice instance offline, so that the target microservice instance has a certain amount of time to process the remaining requests, thereby reducing the traffic loss when the target microservice instance goes offline; on the other hand, when the target microservice instance goes offline, the proxy component directly deletes the information of the target microservice instance registered in the registration center node, so that the target microservice instance no longer receives new requests during the offline process, and can also reduce the traffic loss during the offline process of the target microservice instance.

[0107] In some embodiments, the target microservice instance may have its address information cached in the memory of the service consumer of the target microservice instance. In order to prevent the service consumer from directly accessing the target microservice instance based on the cached address information of the target microservice instance during the offline process of the target microservice instance, the proxy component 201 may also request the service consumer instance of the target microservice instance to delete the cached information of the target microservice instance (corresponding to the address information of the target microservice instance) in response to the offline preparation instruction. Figure 6 Step 3.2 "Request to delete cache"). The service consumer of the target microservice instance can delete the cached address information of the target microservice instance in response to the request of the proxy component 201. In this way, during the offline process of the target microservice instance, the service consumer of the target microservice instance cannot access the target microservice instance based on the address information of the target microservice instance cached by itself, which can further reduce the traffic loss during the offline process of the target microservice instance.

[0108] In addition to the microservice management system provided in the aforementioned embodiment, the embodiment of the present application also provides a microservice management method. The microservice management method provided in the embodiment of the present application is exemplarily described below.

[0109] Figure 7 The following is a flow chart of the microservice management method provided in the embodiment of the present application. Figure 7 As shown, the method mainly includes: 701. In response to a service launch request for a target service, create a target microservice instance that provides the target service in a service cluster.

[0110] 702. Configure a proxy component for the target microservice instance, so that when the information of the target microservice instance is registered with the registration center node, the proxy component adjusts the routing weight of the target microservice instance stored in the registration center node multiple times according to a trend of gradual increase until the routing weight of the target microservice instance is adjusted to the target routing weight.

[0111] Figure 8 This is a flow chart of another microservice management method provided in an embodiment of the present application. Figure 8 As shown, the method mainly includes: 801. For a target microservice instance newly created in a service cluster and providing a target service, when the target microservice instance is started, register information of the target microservice instance in a registration center node.

[0112] 802. According to the trend of gradual increase, the routing weight of the target microservice instance stored in the registration center node is adjusted multiple times until the routing weight of the target microservice instance is adjusted to the target routing weight, so that the service consumer of the target microservice instance can initiate access requests of the corresponding request volume to the target microservice instance based on the current routing weight of the target microservice instance.

[0113] In the embodiment of the present application, execution Figure 7 The device or apparatus of the microservice management method shown may be a control node; Figure 8 The apparatus or device of the illustrated microservice management method may be an electronic device for deploying a target microservice instance and a proxy component, etc.

[0114] In the embodiment of the present application, the microservice launch may include any form of publishing a microservice instance, including but not limited to: initial creation of a microservice instance, update of a microservice instance, and expansion of a microservice instance. Figure 7As shown in step 701, in response to a service launch request for a target service, a microservice instance providing the target service can be created in the service cluster, which is defined as a target microservice instance. Regarding the implementation method of the control node obtaining the service launch request for the target service, please refer to the relevant content of the aforementioned system embodiment, which will not be repeated here.

[0115] For a newly created target microservice instance, if it wants to receive traffic, it needs to register its information with the registration center node in advance. The registration center node is used to manage the information of the microservice instance.

[0116] In order to reduce the traffic loss when the microservice is online, the target microservice instance can be started when it receives the traffic. Therefore, for the target microservice instance currently online, the target microservice instance can be started, and when the target microservice instance is started, in step 801, the information of the target microservice instance is registered to the registration center node.

[0117] In the embodiment of the present application, a proxy component may be configured for the target microservice instance in step 702. The proxy component is mainly responsible for realizing status monitoring of the target microservice instance itself and interaction with the control node.

[0118] Among them, the proxy component can correspond to the microservice instance one by one, that is, a proxy component is configured in each microservice instance. Of course, multiple microservice instances that provide the same service share a proxy component. For an embodiment in which a proxy component is configured for each microservice instance, the control node can configure the proxy component for the target microservice instance after creating the target microservice instance in the service cluster.

[0119] Specifically, the proxy configuration form supported by the programming language type of the target microservice instance may be obtained; and the proxy component may be configured for the target microservice instance according to the proxy configuration form.

[0120] Specifically, if the programming language type of the target microservice instance is the target programming language, the proxy configuration form supported by the target programming language is to configure the proxy component by changing the proxy of the target microservice instance. Accordingly, the code of the proxy component written in the target programming language can be used to modify the code of the target microservice instance, thereby adding the proxy component to the target microservice instance.

[0121] If the programming language type of the target microservice instance is not the target programming language, that is, this type of programming language does not support configuring the proxy component by changing the code of the target microservice instance, then the proxy configuration form supported by the programming language type of the target microservice instance is the sidecar form. Accordingly, the code of the proxy component written in the programming language type of the target microservice instance can be used to configure the proxy component for the target microservice instance in the sidecar form. The sidecar form can implement the proxy of multi-language microservice heterogeneous environments and realize zero-intrusive microservice communication and management.

[0122] In other embodiments, microservice instances providing the same service share a proxy component. In this embodiment, the management and control node may associate the target microservice instance with the proxy component corresponding to the target service after creating the target microservice instance in the service cluster, thereby configuring the proxy component for the target microservice instance.

[0123] Based on the proxy component configured by the target microservice instance, when the target microservice instance is started, the proxy component can be used to register the information of the target microservice instance in the registration center node.

[0124] The service consumer of the target microservice instance can obtain the address information of the target microservice instance from the registration center node, and access the target microservice instance according to the address information of the target microservice instance.

[0125] In some embodiments, when the information of the target microservice instance is registered to the registration center node, the performance of the target microservice instance may not be fully started, such as some plug-ins need to be loaded. If a service consumer accesses the target microservice instance at this time, the target microservice instance may fail to process the access request because the target microservice instance is not fully started, resulting in traffic loss. In order to reduce the traffic loss caused by this situation, in some embodiments of the present application, when the target microservice instance is started, the information of the target microservice instance can be registered to the registration center node after a certain delay, so that the target microservice instance has enough time to start fully during the delay time.

[0126] If the programming language type of the aforementioned target microservice instance is the target programming language (such as Java), the proxy component can be used to modify the information registration logic of the target microservice instance in the form of an aspect to the target registration logic. The target registration logic includes: when the target microservice is started, after the second delay period, the information of the target microservice instance is registered to the registration center node.

[0127] Specifically, the target microservice instance can be used to register the information of the target microservice instance to the registration center node after the target microservice instance is started and delayed for a set period of time. Specifically, the target microservice instance can be used to time the delayed registration period when the target microservice instance is started and send a registration request to the registration center node when the delayed registration period reaches the set period of time. Accordingly, the registration center node can register the information of the target microservice instance to the registration center node in response to the registration request.

[0128] In the embodiment where the programming language type of the aforementioned target microservice instance is a programming language other than the target programming language (such as Java language), the proxy component is a proxy component configured in the form of Sidecar. In this embodiment, the target microservice instance sends a registration request to the registration center node when the target microservice instance is started. Since the proxy component is configured in the form of Sidecar, the proxy component can be used to intercept the registration request, count the delay time, and send a registration request to the registration center node when the delayed registration time reaches the set time. Accordingly, the registration center node can register the information of the target microservice instance to the registration center node in response to the registration request.

[0129] This information registration method of delaying the registration of the target microservice instance information to the registration center node after the target microservice instance is started can allow the target microservice instance to have enough time to start fully before receiving the access request, that is, the target microservice instance has enough time to improve its performance. In this way, when an access request arrives, the target microservice instance can have better processing performance to process the access request, thereby reducing the traffic loss of the access request.

[0130] After registering the information of the target microservice instance to the registration center node, the service consumer of the target microservice instance can obtain the information of the target microservice instance from the registration center node, and access the target microservice instance based on the information of the target microservice instance. Specifically, the service consumer of the target microservice instance can obtain the address information of the target microservice instance from the registration center node, and send an access request to the target microservice instance based on the address information of the target microservice instance.

[0131] After the information of the target microservice instance has just been started, if a large number of concurrent access requests flow into the target microservice instance, it may cause a large processing pressure on the target microservice instance, causing some access request processing to fail, resulting in a certain amount of traffic loss. In order to reduce the traffic loss caused by this situation, the embodiment of the present application proposes the concept of microservice preheating call. Specifically, the routing weight of the microservice instance can be adjusted to limit the inflow traffic at the initial startup of the target microservice instance, and gradually increase the traffic until the target microservice instance is fully preheated.

[0132] Among them, the routing weight of the microservice instance is used to determine the probability of the microservice instance being assigned to an access request, and then determines the amount of access requests assigned to the microservice instance. The smaller the routing weight of the microservice instance, the smaller the probability of being accessed, and the smaller the amount of access requests received. In an embodiment of the present application, the routing weight of the target microservice instance can be gradually increased over time, that is, the target microservice instance is assigned a lower routing weight when it is just started, and its routing weight is gradually increased as the performance of the target microservice instance improves.

[0133] Specifically, in step 802, when the information of the target microservice instance is registered to the registration center node, the routing weight of the target microservice instance stored in the registration center node may be adjusted multiple times according to a trend of increasing successively until the routing weight of the target microservice instance is adjusted to the target routing weight. The target routing weight may be determined by the total number N of microservice instances providing the target service in the service cluster. N ≥ 2 and is an integer. The microservice instance providing the target service includes the target microservice instance.

[0134] Based on the routing weights of multiple microservice instances providing the target service stored in the registration center node, when the service consumer of the target service accesses the target service, the service consumer of the target service can obtain the routing weights of multiple microservice instances providing the target service from the registration center node, and initiate access to the corresponding request amount to each microservice instance according to the routing weights of the multiple microservice instances. In each embodiment of the present application, multiple refers to more than 2.

[0135] In this embodiment, the microservice instance is configured with a proxy component, which can gradually increase the routing weight of the target microservice instance to the target routing weight at the initial startup of the target microservice instance, so that the target microservice instance can smoothly pass the startup period. If the service consumer of the target service has a large number of concurrent access requests to the target service when the target microservice instance is just started, the service consumer may not send too many access requests to the target microservice instance because the routing weight of the target microservice instance is small, which can reduce the processing pressure of the target microservice instance at the initial startup, thereby helping to reduce the traffic loss of the target microservice instance at the initial launch.

[0136] In the embodiments of the present application, the specific implementation method of gradually increasing the routing weight of the target microservice instance to the target routing weight is not limited. In some embodiments, the target routing weight can be determined by using a proxy component based on the total number N of microservice instances providing the target service.

[0137] The proxy component is pre-configured with an initial function. The initial function can reflect the relationship between the change of routing weight and time. Among them, the initial function of the change of routing weight y with time t can be: a function with time t as the independent variable and routing weight y as the dependent variable. In this embodiment, the initial function is a monotonically increasing convex function, so that the routing weight gradually increases over time, and the rate of change of the routing weight over time gradually increases. Among them, the rate of change of routing weight over time is small in the early stage of the launch of the microservice instance, and the increase of the access traffic received by the microservice instance is also relatively slow, which can reduce the processing pressure of the target microservice instance in the initial startup, thereby helping to reduce the traffic loss of the target microservice instance in the early stage of the launch. It is worth noting that the convex function in the embodiment of the present application refers to a convex function, and the derivative of the convex function is monotonically increasing.

[0138] In some embodiments, the initial function includes a target parameter. The target parameter refers to a parameter that affects the rate of change of the routing weight over time. Based on the initial function, the proxy component can be used to obtain the parameter value of the target parameter. Further, the proxy component can be used to modify the pre-configured initial function according to the parameter value of the target parameter to obtain the target function. Specifically, the parameter value of the target parameter can be brought into the initial function to obtain the target function.

[0139] In other embodiments, the initial function includes a target parameter that affects the rate of change of the routing weight over time, a parameter representing the target routing weight, and a parameter representing a set duration. Among them, the set duration refers to the length of time required to increase the routing weight of the target microservice instance to the target routing weight. For ease of description and distinction, in an embodiment of the present application, the length of time required to increase the routing weight of the target microservice instance to the target routing weight is defined as the set first duration. Among them, the first duration can be determined by the warm-up time required for the microservice instance at the initial startup. Generally, the longer the microservice instance needs to warm up, the greater the first duration. In this embodiment, regardless of how the target parameters change, the routing weight of the target microservice instance can be increased to the target routing weight in the first duration.

[0140] Based on the parameters included in the initial function, the pre-configured first duration can be obtained by using the proxy component. Further, the proxy component can be used to modify the initial function of the pre-configured routing weight changing over time according to the target routing weight, the parameter value of the target parameter and the pre-configured first duration to obtain the target function. Specifically, the target routing weight, the parameter value of the target parameter and the pre-configured first duration can be brought into the initial function to obtain the target function.

[0141] After obtaining the objective function, the proxy component can be used to adjust the routing weight of the target microservice instance multiple times according to the objective function until the routing weight of the target microservice instance increases to the target routing weight. Since the objective function is a convex function, the rate of change of the routing weight over time gradually increases. In this way, the access traffic received by the microservice instance increases slowly when the microservice instance is small at the beginning of its launch, which can reduce the processing pressure of the target microservice instance at the beginning of its startup, thereby helping to reduce the traffic loss of the target microservice instance at the beginning of its launch.

[0142] After the target microservice instance is started, its performance gradually improves over time, and the rate of change of the routing weight gradually increases over time. The access traffic that matches the current performance of the target microservice instance can be received faster, which can reduce the resource waste of the target microservice instance.

[0143] The microservice launch method provided in the embodiment of the present application can be applied to any scenario where a microservice instance needs to be launched, including but not limited to: initial creation of a microservice instance, update of a microservice instance, expansion of a microservice instance, and rolling release of a microservice instance, etc. Among them, the rolling release of a microservice instance is used in the microservice architecture to update the application without interrupting the service.

[0144] In container orchestration systems, such as K8s systems, rolling release is often used to ensure the availability of the service system. For container orchestration systems, a service cluster can be a container orchestration cluster, including one or more container groups (such as Pods). Multiple means more than 2. The container orchestration cluster includes: a target container group with a target microservice instance deployed. A proxy component is added to the target container group. The proxy component can be implemented as a container in the target container group. Since the target microservice instance is deployed in a container group (Pod), the target microservice instance needs to have a ready container group (Ready) to provide stable services. Based on this, in this embodiment, the life cycle of the microservice can be associated with the readiness check function of the container group.

[0145] For the container orchestration system, the container orchestration cluster also includes: a container proxy component. The container proxy component is a proxy service running on each service node. A service node can include multiple container groups. The container proxy component is responsible for ensuring that the containerized application runs as expected.

[0146] The proxy component can be used to associate the proxy component with the readiness check process of the target container group by the container proxy component during the creation process of the target container group, so that the container proxy component can call the proxy component when performing the readiness check on the target container group. Specifically, the proxy component can be used to specify the interface of the container proxy component for the readiness check as the interface of the proxy component during the creation process of the target container group, so that the container proxy component can call the interface of the proxy component when performing the readiness check on the target container group, thereby implementing the call to the proxy component.

[0147] For the proxy component, in response to the call of the container proxy component, the routing weight of the target microservice instance can be detected to obtain a first detection result. The detection result is that the routing weight of the target microservice instance is the target routing weight; or the routing weight of the target microservice instance is less than the target routing weight, that is, the routing weight of the target microservice instance has not yet increased to the target routing weight.

[0148] Further, the proxy component can be used to return specified information reflecting the ready state of the target container to the container proxy component according to the first detection result. Specifically, if the first detection result is that the routing weight of the target microservice instance is less than the target routing weight, then the specified information reflecting that the target container group is not ready is returned to the container proxy component. If the first detection result is that the routing weight of the target microservice instance is the target routing weight, then the specified information reflecting that the target container group is ready is returned to the container proxy component.

[0149] In this embodiment, the service preheating process of the microservice instance is associated with the readiness check process of the container group. When the routing weight of the target microservice instance has not increased to the target routing weight (that is, the target microservice instance has not been preheated), the readiness check result of the target container group where the target microservice instance is located is not ready. In this case, the original microservice instance corresponding to the target microservice instance continues to be retained in the container orchestration cluster, and the original microservice instance shares the call or access of the service consumer. Afterwards, when the target container group where the target microservice instance is located is ready, all access requests of the service consumer are routed to the target microservice instance, and the container group where the original microservice instance is located is deleted to realize the rolling release of the microservice. In the rolling release process, when the preheating of the target microservice instance is not completed, the original microservice instance corresponding to the target microservice instance shares the access traffic of the service consumer, which can reduce the traffic loss in the rolling release process of the microservice, and even realize the lossless rolling release of the microservice.

[0150] Since services in the container orchestration system are released in a rolling manner, the online method of the microservice instance provided in the embodiment of the present application can also be implemented as a rolling microservice release process, thereby reducing the traffic loss of the rolling release of microservices.

[0151] In addition to associating the warm-up process of the microservice instance with the readiness check process of the container group, in some embodiments of the present application, the delayed registration process of the microservice instance can also be associated with the readiness check process of the container group. For the proxy component, in response to the call of the container proxy component, it can detect whether the information of the target microservice instance has been registered in the registration center node to obtain a second detection result. Among them, the second detection result is that the information of the target microservice instance has been registered with the registration center node; or, the information of the target microservice instance has not yet been registered with the registration center node.

[0152] Further, the proxy component can be used to return specified information reflecting the ready state of the target container to the container proxy component according to the second detection result. Specifically, if the second detection result is that the information of the target microservice instance has not been registered with the registration center node, the specified information reflecting that the target container group is not ready is returned to the container proxy component. If the detection result is that the routing weight of the target microservice instance has been registered with the registration center node, the specified information reflecting that the target container group is ready is returned to the container proxy component.

[0153] In this embodiment, the delayed registration process of the microservice instance is associated with the readiness check process of the container group. When the information of the target microservice instance is not registered with the registration center node (that is, the delayed registration of the information of the target microservice instance is not completed), the readiness check result of the target container group where the target microservice instance is located is not ready, then the original microservice instance corresponding to the target microservice instance is retained in the container orchestration cluster, and the original microservice instance provides the target service for the service consumer to call or access. Afterwards, when the target container group where the target microservice instance is located is ready, the access request of the service consumer is routed to the target microservice instance, and the container group where the original microservice instance is located is deleted to realize the rolling release of the microservice. In the rolling release process, when the delayed registration of the target microservice instance is not completed, the original microservice instance corresponding to the target microservice instance bears the access traffic of the service consumer, which can reduce the traffic loss in the rolling release process of the microservice, and even realize the lossless rolling release of the microservice.

[0154] Of course, in some embodiments, the delayed registration process of the microservice instance and the service preheating process of the microservice instance can also be associated with the readiness check process of the container group. Based on this, when the container proxy component performs a readiness check on the target container group, it can call the interface of the proxy component to implement the call to the proxy component. For the proxy component, in response to the call of the container proxy component, it can detect whether the information of the target microservice instance has been registered in the registration center node to obtain the second detection result, and detect whether the routing weight of the target microservice instance is increased to the target routing weight to obtain the first detection result.

[0155] Further, the proxy component can be used to return specified information reflecting the ready state of the target container to the container proxy component based on the first detection result and the second detection result. Specifically, if the first detection result and the second detection result include: the information of the target microservice instance is not registered to the registration center node and / or the routing weight of the target microservice instance is less than the target routing weight, then the specified information reflecting that the target container group is not ready is returned to the container proxy component. If the first detection result and the second detection result include: the information of the target microservice instance has been registered to the registration center node, and the routing weight of the target microservice instance has been increased to the target routing weight, then the specified information reflecting that the target container is ready is returned to the container proxy component.

[0156] In this embodiment, the delayed registration process of the microservice instance and the preheating process of the microservice instance are associated with the readiness check process of the container group. When the information of the target microservice instance is not registered with the registration center node (i.e., the delayed registration of the information of the target microservice instance is not completed) and / or the routing weight of the target microservice instance is less than the target routing weight (i.e., the preheating of the target microservice instance is not completed), the readiness check result of the target container group where the target microservice instance is located is not ready, then the original microservice instance corresponding to the target microservice instance is retained in the container orchestration cluster, and the original microservice instance provides the target service to bear or share the call of the service consumer. Afterwards, when the target container group where the target microservice instance is located is ready, the access request of the service consumer is routed to the target microservice instance, and the container group where the original microservice instance is located is deleted to realize the rolling release of the microservice. During the rolling release process, while the delayed registration and / or service preheating of the target microservice instance is incomplete, the original microservice instance corresponding to the target microservice instance bears or shares the access traffic of the service consumer, which can reduce the traffic loss during the rolling release of the microservice and even achieve lossless rolling release of the microservice.

[0157] The inventors of the present application have found that during the service offline process, if there are still unprocessed requests in the service and the microservice has been stopped, then these unprocessed requests will also fail to be processed, causing traffic loss, thereby causing the overall availability of the microservice system to decrease.

[0158] In order to reduce the traffic loss during the offline process of microservices, the microservice management system provided in the embodiment of the present application can not only manage the online microservices, but also manage the offline microservices to reduce the traffic loss during the offline process of the microservice instance.

[0159] Specifically, for the control node, a service offline request for the target microservice instance can be obtained. In order to reduce the traffic loss caused by the failure of processing unprocessed requests in the microservice instance due to the microservice offline, a delayed offline mechanism is also proposed in some embodiments of the present application. Specifically, for the control node, in response to the service offline request for the target microservice instance, the delayed offline time can be timed, and when the delayed offline time reaches the set third time, the target microservice instance is deleted from the service cluster.

[0160] For the proxy component, in response to the offline preparation instruction, the information of the target microservice instance registered in the registration center node can be deleted. The offline preparation instruction can be sent to the proxy component by the control node after responding to the service offline request. Alternatively, the offline preparation instruction can be sent to the proxy component by the management node in the service cluster in response to the offline event of the target microservice instance.

[0161] Accordingly, for the device where the target microservice instance is deployed, the proxy component can be used to respond to the offline preparation instruction and delete the information of the target microservice instance registered in the registration center node. The control node can respond to the service offline request for the target microservice instance and count the delayed offline time. When the delayed offline time reaches the set third time, the target microservice instance is deleted from the service cluster, that is, the target microservice instance is offline.

[0162] In this embodiment, on the one hand, when the target microservice instance goes offline, the target microservice instance is delayed for a certain period of time before being offline, so that the target microservice instance has a certain amount of time to process the remaining requests, thereby reducing the traffic loss when the target microservice instance goes offline; on the other hand, when the target microservice instance goes offline, the proxy component directly deletes the information of the target microservice instance registered in the registration center node, so that the target microservice instance no longer receives new requests during the offline process, and can also reduce the traffic loss during the offline process of the target microservice instance.

[0163] In some embodiments, the address information of the target microservice instance may be cached in the memory of the service consumer of the target microservice instance. In order to prevent the service consumer from directly accessing the target microservice instance based on the cached address information of the target microservice instance during the offline process of the target microservice instance, the proxy component can also be used to respond to the offline preparation instruction and request the service consumer instance of the target microservice instance to delete the cached information of the target microservice instance. The service consumer of the target microservice instance can delete the cached address information of the target microservice instance in response to the request of the proxy component. In this way, during the offline process of the target microservice instance, the service consumer of the target microservice instance cannot access the target microservice instance based on the address information of the target microservice instance cached by itself, which can further reduce the traffic loss during the offline process of the target microservice instance.

[0164] It should be noted that the execution subject of each step of the method provided in the above embodiment can be the same device, or the method can be executed by different devices. For example, the execution subject of steps 701 and 702 can be device A; for another example, the execution subject of step 701 can be device A, and the execution subject of step 702 can be device B; and so on.

[0165] In addition, in some of the processes described in the above embodiments and the accompanying drawings, multiple operations appearing in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this document or may be executed in parallel, and the sequence numbers of the operations, such as 701, 702, etc., are only used to distinguish between different operations, and the sequence numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel.

[0166] Accordingly, an embodiment of the present application also provides a computer-readable storage medium storing computer instructions. When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the steps in the above-mentioned microservice management method.

[0167] The embodiment of the present application also provides a computer program product, including a computer program, which, when executed by one or more processors, causes the one or more processors to execute the steps in the above-mentioned microservice management method. In the embodiment of the present application, the specific implementation form of the computer program product is not limited. In some embodiments, the computer program product can be implemented as an application (Application, APP), a mini-program, a computer-side client, a program module, a plug-in, an installation package, a software development kit (Software Development Kit, SDK), an image file of a CD (such as an ISO file), a plug-in or software in the form of software as a service (Software as a Service, SaaS), etc., but is not limited to this.

[0168] Fig. 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Fig. 9 As shown, the electronic device includes: a memory 90a and a processor 90b. The memory 90a is used to store computer programs.

[0169] The processor 90b is coupled to the memory 90a, and is used to execute the computer program to execute the steps in the microservice management method provided in the above embodiments. The specific implementation of each step can be found in the relevant description of the above embodiments, which will not be repeated here.

[0170] In some optional embodiments, such as Fig. 9 As shown, the computing device may also include optional components such as a communication component 90c, a power component 90d, a display component 90e, and an audio component 90f. Fig. 9 Some components are shown schematically, and it does not mean that electronic devices must include Fig. 9 The components shown do not necessarily mean that the electronic device can only include Fig. 9 Components shown.

[0171] in addition, Fig. 9 The components in the dashed box are optional components, not mandatory components, and may depend on the product form of the electronic device. The electronic device of this embodiment may be implemented as a terminal device such as a desktop computer, a laptop computer, a mobile phone, or an IoT device; or it may be various server devices such as a traditional server, a cloud server, or a server cluster.

[0172] In an embodiment of the present application, the memory is used to store a computer program and can be configured to store various other data to support operations on the device where it is located. Among them, the processor can execute the computer program stored in the memory to implement the corresponding control logic. The memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random-Access Memory, SRAM), electrically erasable programmable read only memory (Electrically Erasable Programmable Read Only Memory, EEPROM), erasable programmable read only memory (Electrical Programmable Read Only Memory, EPROM), programmable read only memory (Programmable Read Only Memory, PROM), read only memory (Read Only Memory, ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0173] In the embodiment of the present application, the processor may be any hardware processing device that can execute the logic of the above method. Optionally, the processor may be a central processing unit (CPU), a graphics processing unit (GPU) or a microcontroller unit (MCU); it may also be a field programmable gate array (FPGA), a programmable array logic device (PAL), a general array logic device (GAL), a complex programmable logic device (CPLD) or other programmable devices; or it may be an advanced reduced instruction set (RISC) processor (Advanced RISC Machines, ARM) or a system on chip (System on Chip, SoC), etc., but not limited thereto.

[0174] In an embodiment of the present application, the communication component is configured to facilitate wired or wireless communication between the device in which it is located and other devices. The device in which the communication component is located can access a wireless network based on a communication standard, such as Wireless Fidelity (WiFi), 2G or 3G, 4G, 5G or a combination thereof. In an exemplary embodiment, the communication component receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component can also be implemented based on Near Field Communication (NFC) technology, Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wide Band (UWB) technology, Bluetooth (BT) technology or other technologies.

[0175] In an embodiment of the present application, the display component may include a liquid crystal display (LCD) and a touch panel (TP). If the display component includes a touch panel, the display component may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation.

[0176] In an embodiment of the present application, a power supply component is configured to provide power to various components of the device in which it is located. The power supply component may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device in which the power supply component is located.

[0177] In an embodiment of the present application, the audio component may be configured to output and / or input audio signals. For example, the audio component includes a microphone (Microphone, MIC), and when the device where the audio component is located is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal may be further stored in a memory or sent via a communication component. In some embodiments, the audio component also includes a speaker for outputting an audio signal. For example, for a device with a language interaction function, voice interaction with a user may be achieved through an audio component.

[0178] It should be noted that the descriptions such as “first” and “second” in this article are used to distinguish different messages, devices, modules, etc., and do not represent the order of precedence, nor do they limit “first” and “second” to different types.

[0179] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, compact disc read-only memory (CD-ROM), optical storage, etc.) containing computer-usable program codes.

[0180] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0181] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0182] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0183] In a typical configuration, a computing device includes one or more processors (CPU, etc.), input / output interfaces, network interfaces, and memory.

[0184] Memory may include non-permanent storage in a computer-readable medium, in the form of random-access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.

[0185] Computer storage media is readable storage media, also known as readable media. Readable storage media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, CD-ROM, digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.

[0186] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of further restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the above elements.

[0187] The above contents are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.

Claims

1. A microservice management system, characterized in that: include: Registration center nodes corresponding to control nodes, service clusters, and microservices; The control node is used to respond to a service launch request for a target service, create a target microservice instance that provides the target service in the service cluster, and configure a proxy component for the target microservice instance; The proxy component is used to adjust the routing weight of the target microservice instance stored in the registration center node multiple times according to a trend of gradual increase when the information of the target microservice instance is registered with the registration center node, until the routing weight of the target microservice instance is adjusted to the target routing weight, so that the service consumer of the target microservice instance can initiate access requests of a corresponding request amount to the target microservice instance based on the current routing weight of the target microservice instance.

2. The system according to claim 1, characterized in that When the target microservice instance is started, after a delay of a set second time period, the information of the target microservice instance is registered to the registration center node.

3. The system according to claim 1 or 2, characterized in that: The control node is further configured to respond to a service offline request of the target microservice instance, time the delayed offline time, and delete the target microservice instance from the service cluster when the delayed offline time reaches a set third time; The proxy component deletes the information of the target microservice instance registered in the registration center node in response to the received offline preparation instruction; The offline preparation instruction is sent by the control node in response to the service offline request; or, the management node in the service cluster is sent in response to the offline event of the target microservice instance.

4. The system according to claim 1 or 2, characterized in that: When the proxy component is added to the target microservice instance, the service cluster is a container orchestration cluster; The container orchestration cluster includes: a container proxy component and a target container group where the target microservice instance is deployed; the container proxy component is used to perform a readiness check on the target container group; The proxy component is used to associate the proxy component with the readiness check process of the target container group by the container proxy component during the creation process of the target container group, so that the container proxy component calls the proxy component when performing the readiness check on the target container group; and, in response to the call of the container proxy component, detect whether the routing weight of the target microservice instance is the target routing weight to obtain a first detection result; and return specified information reflecting the readiness state of the target container to the container proxy component according to the first detection result.

5. The system according to claim 2, characterized in that When the proxy component is added to the target microservice instance, the service cluster is a container orchestration cluster; The container orchestration cluster includes: a container proxy component and a target container group where the target microservice instance is deployed; the container proxy component is used to perform a readiness check on the target container group; The proxy component is used to associate the proxy component with the readiness check process of the target container group by the container proxy component during the creation process of the target container group, so that the container proxy component calls the proxy component when performing the readiness check on the target container group; and the proxy component is also used to: in response to the call of the container proxy component, detect whether the information of the target microservice instance is registered to the registration center node to obtain a second detection result; and detect whether the routing weight of the target microservice instance is the target routing weight to obtain a first detection result; and return specified information reflecting the readiness state of the target container to the container proxy component according to the first detection result and the second detection result.

6. A microservice management method, characterized in that: include: For a newly created target microservice instance providing a target service in the service cluster, when the target microservice instance is started, register the information of the target microservice instance in the registration center node; According to the trend of gradual increase, the routing weight of the target microservice instance stored in the registration center node is adjusted multiple times until the routing weight of the target microservice instance is adjusted to the target routing weight, so that the service consumer of the target microservice instance can initiate access requests of the corresponding request amount to the target microservice instance based on the current routing weight of the target microservice instance.

7. The method according to claim 6, characterized in that The step of adjusting the routing weight of the target microservice instance stored in the registration center node multiple times according to a trend of gradual increase until the routing weight of the target microservice instance reaches the target routing weight includes: Determine the target routing weight according to the total number of microservice instances that provide the target service; Obtaining a parameter value of a target parameter; the target parameter is a parameter that affects the rate of change of the routing weight over time; According to the parameter value of the target parameter, modify the pre-configured initial function to obtain the target function; the initial function reflects the relationship between the routing weight and the time, the initial function includes the target parameter, and the target function is a monotonically increasing convex function; According to the objective function, the routing weight of the target microservice instance is adjusted multiple times until the routing weight of the target microservice instance is adjusted to the target routing weight.

8. The method according to claim 7, characterized in that The step of modifying the pre-configured initial function according to the parameter value of the target parameter to obtain the target function includes: Obtain a preconfigured first duration; the first duration is the length of time required to increase the routing weight of the target microservice instance to the target routing weight; The initial function is modified according to the target routing weight, the parameter value of the target parameter and the first duration to obtain the target function; wherein the initial function includes the target parameter, the parameter representing the target routing weight and the parameter representing the first duration.

9. The method according to claim 6, characterized in that Also includes: When the target microservice instance is started, after a delay of a set second time period, a registration request is sent to the registration center node, so that the registration center node registers the information of the target microservice instance to the registration center node in response to the registration request; or, When the target microservice instance is started, a registration request is sent to the registration center node; The registration request is intercepted by the proxy component configured by the target microservice instance, and after a delay of a set second time period, the registration request is sent to the registration center node, so that the registration center node registers the information of the target microservice instance to the registration center node in response to the registration request.

10. The method according to claim 9, characterized in that Also includes: If the programming language type of the target microservice instance is the target programming language, the proxy component is used to modify the information registration logic of the target microservice instance into the target registration logic in the form of a section, so that the target microservice instance performs information registration according to the target registration logic; The target registration logic includes: when the target microservice instance is started, after delaying the second time period, executing the operation of sending a registration request to the registration center node; or, If the programming language type of the target microservice instance is a programming language other than the target programming language, the proxy component is used to perform a target operation; the target operation includes: intercepting the registration request, and sending the registration request to the registration center node after delaying the second time period.

11. The method according to any one of claims 6 to 10, characterized in that: The target microservice instance is configured with a proxy component, and the service cluster is a container orchestration cluster; The container orchestration cluster includes: a target container group in which the target microservice instance is deployed; the method further includes: In the process of creating the target container group, associating the proxy component with a readiness check process of the target container group by the container proxy component, so that the container proxy component calls the proxy component when performing the readiness check on the target container group; In response to the container proxy component calling the proxy component, using the proxy component to detect whether the routing weight of the target microservice instance is increased to the target routing weight, so as to obtain a first detection result; According to the first detection result, specified information reflecting the readiness state of the target container is returned to the container proxy component.

12. The method according to claim 10, characterized in that The service cluster is a container orchestration cluster; The container orchestration cluster includes: a target container group in which the target microservice instance is deployed; the method further includes: In the process of creating the target container group, using the proxy component, associating the proxy component with a readiness check process of the target container group by the container proxy component, so that the container proxy component calls the proxy component when performing the readiness check on the target container group; In response to the container proxy component calling the proxy component, using the proxy component to detect whether the information of the target microservice instance is registered to the registration center node, so as to obtain a second detection result; And, using the proxy component to detect whether the routing weight of the target microservice instance is the target routing weight, so as to obtain a first detection result; Returning specified information reflecting the readiness state of the target container to the container proxy component according to the first detection result and the second detection result.

13. The method according to any one of claims 6 to 10, characterized in that: Also includes: In response to a service offline request of the target microservice instance, timing a delayed offline time, and when the delayed offline time reaches a set third time, deleting the target microservice instance from the service cluster; Deleting the information of the target microservice instance registered in the registration center node by using the proxy component configured by the target microservice instance in response to the offline preparation instruction; Among them, the offline preparation instruction is issued by the control node of the service cluster in response to the service offline request for the target microservice instance; the control node responds to the service offline request and deletes the target microservice instance from the service cluster after a delay of a set third time period; or, the offline preparation instruction is sent when the management node in the service cluster monitors an offline event for the target microservice instance.

14. The method according to claim 13, characterized in that Also includes: In response to the offline preparation instruction, the proxy component is used to request the service consumer to delete the cached address information of the target microservice instance.

15. A microservice management method, characterized in that: include: In response to a service launch request for a target service, create a target microservice instance providing the target service in a service cluster; A proxy component is configured for the target microservice instance so that when the information of the target microservice instance is registered with the registration center node, the proxy component adjusts the routing weight of the target microservice instance stored in the registration center node multiple times according to a trend of gradual increase until the routing weight of the target microservice instance is the target routing weight.

16. The method according to claim 15, characterized in that The configuring a proxy component for the target microservice instance includes: Obtaining a proxy configuration form supported by the programming language type of the target microservice instance; The proxy component is configured for the target microservice instance according to the proxy configuration form.

17. The method according to claim 15 or 16, characterized in that Also includes: In response to a service offline request of the target microservice instance, timing a delayed offline time and sending an offline preparation instruction to the proxy component, so that the proxy component deletes the information of the target microservice instance registered in the registration center node in response to the offline preparation instruction; When the delayed offline time reaches a set third time, the target microservice instance is deleted from the service cluster.

18. An electronic device, characterized in that: include: A memory and a processor; wherein the memory is used to store a computer program; The processor is coupled to the memory and configured to execute the computer program to perform the steps of the method according to any one of claims 6 to 17.

19. A computer-readable storage medium storing computer instructions, characterized in that: When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the steps in the method according to any one of claims 6 to 17.

20. A computer program product, characterized in that The method comprises a computer program which, when executed by one or more processors, causes the one or more processors to execute the steps of the method according to any one of claims 6 to 17.

Citation Information

Patent Citations

  • Resource management method and system, proxy server and storage medium

    CN113810443A

  • Workload preheating method and device based on service grid

    CN114244898A

  • Service calling method based on micro-service system and server

    CN115567604A

  • Routing method, micro-service system, device and storage medium

    CN117255136A

  • Micro-service offline method and device

    CN117290130A

Cited By

  • Service preheating method and device, computer equipment and readable storage medium

    CN119363551A