Service management method, device and system

By setting up a proxy module in the microservice system for information synchronization and instance state management, the problem of traffic aggregation and public node change bottlenecks in microservices is solved, and the balance of traffic and access pressure is achieved.

CN120455537APending Publication Date: 2025-08-08CHINA TELECOM CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211698884.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2022-12-28
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

There is a problem of traffic aggregation and public node bottlenecks in microservice applications, and no effective solution has been proposed in the existing technology.

Method used

By setting up a proxy module in the host, information synchronization between the proxy and the registration center is realized, allowing instances to directly access the host proxy, reducing instances frequently access the registration center, and by regularly registering instance status information, the currently idle instances respond to the service first, thus achieving a balance of traffic and access pressure.

Benefits of technology

It effectively avoids the registration center becoming a bottleneck, realizes traffic equalization and access pressure equalization, and solves the bottleneck problems of traffic aggregation and public node change in microservice applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120455537A_ABST
    Figure CN120455537A_ABST
Patent Text Reader

Abstract

The invention discloses a service governance method, device and system. The method comprises the following steps that: an agent module periodically reads first service information of each first service in a host machine and first instance information of a plurality of first service instances associated with each first service from a registration center, and the registration center maintains a plurality of pieces of service information and a plurality of pieces of instance information; the instance information comprises periodically updated instance state information; in response to a service request for accessing the target service sent by the second service instance, determining instance state information of a plurality of third service instances associated with the target service from the first instance information; and determining a target service instance from the plurality of third service instances based on the instance state information of each third service instance, and returning the target service instance to the second service instance, so that the second service instance accesses the target service through the target service instance. According to the method and the device, the technical problems of traffic convergence and common node variable bottleneck easily occurring in the micro-service application are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of microservice technology, and more specifically, to a service governance method, device, and system. Background Art

[0002] The microservice system splits the different functional modules in the system into multiple different services, among which each service is deployed independently, so it is possible to accurately monitor the resource consumption of each service and easily discover the performance bottlenecks of each service; each service is developed independently, so project development is more convenient, which can reduce code conflicts, reduce logical complexity, make maintenance and expansion easier, and also can be developed independently in different programming languages; each service runs in its own process, and its update will not affect the operation of other services.

[0003] However, in actual applications, microservices may experience traffic convergence and public nodes becoming bottlenecks. This is because the basic idea of the microservice system is to split the original system into many small services. A large number of small services need to communicate, collaborate, and exchange information, which increases traffic overhead. At the same time, because a large number of services will access public nodes, such as DNS nodes, this will result in a very large number of links to public nodes, which will cause the public nodes to be unable to respond and become a bottleneck.

[0004] To address the above-mentioned problems, no effective solutions have been proposed so far. Summary of the Invention

[0005] The embodiments of the present application provide a service governance method, device, and system to at least solve the technical problems of traffic convergence and public node bottlenecks that are prone to occur in microservice applications.

[0006] According to one aspect of an embodiment of the present application, a service governance method is provided, comprising: an agent module in a host machine periodically reading first service information of each first service in the host machine and first instance information of multiple first service instances associated with each first service from a registration center, wherein the registration center maintains multiple service information and multiple instance information, each service information includes service basic information of a service and service association information used to reflect multiple service instances associated with the service, each instance information includes instance basic information of a service instance, instance status information and instance affiliation information used to reflect the service to which the service instance belongs, and the instance status information is periodically updated to the registration center by the agent module in the host machine where the service instance is located; the agent module determines target service information of the target service from the first service information in response to a service request for accessing the target service sent by the second service instance, and determines instance status information of multiple third service instances associated with the target service from the first instance information based on the target service information; the agent module determines a target service instance from the multiple third service instances based on the instance status information of each third service instance, and returns the target service instance to the second service instance, so that the second service instance accesses the target service through the target service instance.

[0007] Optionally, before the proxy module periodically updates the instance status information of each first service instance in the host machine to the registration center, the registration center responds to the first registration request of the second service and writes the second service information of the second service into the registration center; the registration center responds to the second registration request of the fourth service instance and writes the fourth instance information of the fourth service instance into the registration center.

[0008] Optionally, the proxy module periodically obtains instance status information of each fifth service instance in the host machine; the proxy module uses the obtained instance status information of the fifth service instance to update the instance status information of the fifth service instance written in the registration center.

[0009] Optionally, the proxy module periodically sends a first read request to the registration center; the proxy module receives the first service information of each first service in the host machine and the first instance information of multiple first service instances associated with each first service, which are fed back by the registration center based on the first read request; the proxy module uses the received first service information of the first service and the first instance information of the first service instance to update the locally cached first service information of the first service and the first instance information of the first service instance.

[0010] Optionally, the instance status information is used to reflect whether the service instance is busy or idle. The proxy module determines one or more sixth service instances whose instance status information is idle from multiple third service instances; the proxy module determines the target service instance from the one or more sixth service instances.

[0011] Optionally, the instance status information is used to reflect the load status of the service instance. The proxy module sorts multiple third service instances from small to large according to the load status of each third service instance; the proxy module determines the third service instance with the highest ranking as the target service instance.

[0012] Optionally, when the proxy module fails to retrieve the target service information of the target service from the first service information, the proxy module sends a second read request to the registration center; the proxy module receives and saves the target service information of the target service and the instance status information of multiple third service instances associated with the target service fed back by the registration center based on the second read request; the proxy module determines the target service instance from multiple third service instances based on the instance status information of each third service instance, and returns the target service instance to the second service instance.

[0013] According to another aspect of an embodiment of the present application, a service governance device is also provided, including: a reading module, used to periodically read the first service information of each first service in the host machine and the first instance information of multiple first service instances associated with each first service from a registration center, wherein the registration center maintains multiple service information and multiple instance information, each service information includes service basic information of a service and service association information used to reflect multiple service instances associated with the service, each instance information includes instance basic information of a service instance, instance status information and instance affiliation information used to reflect the service to which the service instance belongs, and the instance status information is periodically updated to the registration center by the agent module in the host machine where the service instance is located; a determination module, used to determine the target service information of the target service from the first service information in response to a service request for accessing the target service sent by the second service instance, and determine the instance status information of multiple third service instances associated with the target service from the first instance information based on the target service information; a feedback module, used to determine the target service instance from multiple third service instances based on the instance status information of each third service instance, and return the target service instance to the second service instance, so that the second service instance accesses the target service through the target service instance.

[0014] According to another aspect of the embodiment of the present application, a service governance system is also provided, including: multiple services, multiple service instances, an agent module and a registration center, wherein each service is used to register the service information of the service to the registration center, and the service information includes the service basic information of the service and the service association information for reflecting the multiple service instances associated with the service; each service instance is used to register the instance information of the service instance to the registration center, and the instance information includes the instance basic information of the service instance, instance status information and instance affiliation information for reflecting the service to which the service instance belongs; the agent module is located in the host machine, and is used to periodically register the instance status information of each fifth service instance in the host machine The system updates the first service information of each first service in the host machine and the first instance information of multiple first service instances associated with each first service from the registration center periodically; in response to the service request for accessing the target service sent by the second service instance, determines the target service information of the target service from the first service information, and determines the instance status information of multiple third service instances associated with the target service from the first instance information based on the target service information; determines the target service instance from the multiple third service instances based on the instance status information of each third service instance, and returns the target service instance to the second service instance, so that the second service instance accesses the target service through the target service instance.

[0015] According to another aspect of an embodiment of the present application, an electronic device is further provided, which includes: a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to execute the above-mentioned service governance method through the computer program.

[0016] In an embodiment of the present application, the proxy module periodically reads the first service information of each first service in the host and the first instance information of multiple first service instances associated with each first service from the registration center, wherein the registration center maintains multiple service information and multiple instance information, and the instance information includes periodically updated instance status information; the proxy module responds to the service request for accessing the target service sent by the second service instance, determines the instance status information of multiple third service instances associated with the target service from the first instance information, and then determines the target service instance from the multiple third service instances based on the instance status information of each third service instance, and returns the target service instance to the second service instance, so that the second service instance accesses the target service through the target service instance. Among them, by setting up a host agent, allowing the agent and the registration center to synchronize information, and the instance directly accessing the host agent, it can reduce the instance's frequent access to the registration center and avoid the registration center becoming a bottleneck; by regularly registering the instance's status information, allowing the currently idle instance to respond to the service first, it can achieve the effect of balancing traffic and balancing access pressure, thereby solving the technical problems of traffic convergence and public node bottlenecks in microservice applications. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] 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:

[0018] Figure 1 This is a schematic diagram of the structure of an optional service governance system according to an embodiment of the present application;

[0019] Figure 2 This is a flowchart of an optional service governance method according to an embodiment of the present application;

[0020] Figure 3 is a schematic diagram of an optional service governance process according to an embodiment of the present application;

[0021] Figure 4 It is a structural diagram of an optional service management device according to an embodiment of the present application. DETAILED DESCRIPTION

[0022] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.

[0023] It should be noted that the terms "first", "second", etc. in the specification, claims, and drawings of the present application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.

[0024] Example 1

[0025] In order to solve the technical problems in related technologies that microservice systems are prone to traffic convergence and public nodes becoming bottlenecks, an embodiment of the present application provides a service governance system, wherein the system sets a host agent to synchronize information between the agent and the registration center, and the instance directly accesses the host agent, which can reduce the instance's frequent access to the registration center, thereby avoiding the registration center from becoming a bottleneck; at the same time, by regularly registering the instance's status information, the currently idle instance is allowed to respond to the service first, which can achieve the effect of balanced traffic and balanced access pressure.

[0026] Figure 1 This is a schematic diagram of the structure of an optional service governance system according to an embodiment of the present application. Figure 1 As shown, the system at least includes: multiple services 10 (1-m), multiple service instances 11 (1-n), an agent module 12 and a registration center 13, wherein:

[0027] Service 10 (1-m) is a unified entry for providing business services. It maintains service information. Each service information includes basic service information of a service and service association information used to reflect multiple service instances associated with the service. Each service will register its own service information to the registration center 13.

[0028] Service instances 11 (1-n) are nodes within services 10 (1-m) that provide capabilities and are used to provide business responses. Typically, a service can include one or more service instances, and a service instance belongs to only one service. Each service instance maintains instance information, which includes basic instance information, instance status information, and instance affiliation information reflecting the service to which the service instance belongs. Each service instance also registers its instance information with a registration center.

[0029] The proxy module 12 is located in the host machine and is used to periodically update the instance status information of each fifth service instance in the host machine to the registration center 13; periodically read the first service information of each first service in the host machine and the first instance information of multiple first service instances associated with each first service from the registration center 13; in response to the service request for accessing the target service sent by the second service instance, determine the target service information of the target service from the first service information, and determine the instance status information of multiple third service instances associated with the target service from the first instance information based on the target service information; determine the target service instance from the multiple third service instances based on the instance status information of each third service instance, and return the target service instance to the second service instance, so that the second service instance can access the target service through the target service instance.

[0030] Among them, the fifth service instance is a service instance running in the host machine, the first service is a service running in the host machine, and the first service instance is a service instance associated with the first service. It should be noted that there is no necessary ownership relationship between services and service instances in the same host machine, that is, the service instance associated with a service in a host machine may run on other host machines, and the service instance in a host machine may belong to services in other host machines. Therefore, there may be an intersection between the above-mentioned fifth service instance and the first service instance, but there is no necessary connection. The second service instance can be any service instance, which is usually called a service consumer (Consumer), and the third service instance associated with the target service it accesses is usually called a service provider (Provider).

[0031] The registration center 13 maintains a registration table, which includes service information of all service registrations and instance information of all service instance registrations. It can respond to the information query request of the proxy module and feedback the service information and instance information corresponding to the information query request to the proxy module.

[0032] Based on the above-mentioned service governance system, the embodiment of the present application also provides a service governance method. The functions performed by each module in the service governance system are described in detail below in conjunction with the specific process of the service governance method. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0033] Figure 2 This is a flow chart of an optional service governance method according to an embodiment of the present application, such as Figure 2 As shown, the method includes at least steps S202-S206, wherein:

[0034] In step S202, the proxy module in the host machine periodically reads the first service information of each first service in the host machine and the first instance information of multiple first service instances associated with each first service from the registration center, wherein the registration center maintains multiple service information and multiple instance information, each service information includes service basic information of a service and service association information for reflecting multiple service instances associated with the service, each instance information includes instance basic information of a service instance, instance status information and instance affiliation information for reflecting the service to which the service instance belongs, and the instance status information is periodically updated to the registration center by the proxy module in the host machine where the service instance is located.

[0035] It is understandable that before the proxy module reads the first service information and the first instance information, the registration center already stores the service information of multiple service registrations and the instance information of multiple service instance registrations. Specifically, the registration center will respond to the first registration request of the second service by writing the second service information of the second service into the registration center; the registration center will also respond to the second registration request of the fourth service instance by writing the fourth instance information of the fourth service instance into the registration center. The second service can be any service in any host machine, and the fourth service instance can be any service instance in any host machine. The registration center will write the corresponding second service information and fourth instance information into the maintained registration table.

[0036] As an optional implementation, the proxy module may periodically obtain instance status information of each fifth service instance in the host machine; and then use the obtained instance status information of the fifth service instance to update the instance status information of the fifth service instance written in the registration center.

[0037] Afterwards, when reading the first service information and the first instance information, the proxy module can periodically send a first read request to the registration center; receive the first service information of each first service in the host machine and the first instance information of multiple first service instances associated with each first service fed back by the registration center based on the first read request; and then use the received first service information of the first service and the first instance information of the first service instance to update the locally cached first service information of the first service and the first instance information of the first service instance.

[0038] Among them, since the proxy module periodically updates the instance status information of the service instance, the first instance information obtained here can relatively accurately reflect the current status of the first service instance, such as whether it is in an idle state or a busy state. The proxy module updates the latest first service information and first instance information locally to facilitate subsequent responses to service requests from service consumers.

[0039] In step S204, the proxy module determines the target service information of the target service from the first service information in response to the service request for accessing the target service sent by the second service instance, and determines the instance status information of multiple third service instances associated with the target service from the first instance information based on the target service information.

[0040] The second service instance may be any service instance, which is also called a service consumer, and the third service instance associated with the target service accessed by the second service instance is called a service provider.

[0041] Step S206: The proxy module determines a target service instance from the plurality of third service instances based on the instance state information of each third service instance, and returns the target service instance to the second service instance, so that the second service instance accesses the target service through the target service instance.

[0042] When determining the target service instance from multiple third service instances, the idea of the embodiment of the present application is to continuously refresh the management list of the proxy module based on the instance status information of the service instance, so that the proxy module can first find the most idle target service instance, thereby realizing the diversion management of the service instance affecting the proxy module, that is, control inversion; the proxy module allocates the traffic to the most appropriate service instance to respond to the access.

[0043] Specifically, instance status information exists in various forms, such as directly reflecting the busy or idle status of the service instance, or reflecting the current load status of the service instance. Corresponding to the instance status information, the embodiments of the present application provide the following optional implementation methods for determining the target service instance.

[0044] In the first embodiment, the instance status information is used to reflect whether the service instance is in a busy state or an idle state. In this case, the proxy module may first determine one or more sixth service instances whose instance status information indicates an idle state from the plurality of third service instances; and then randomly determine a service instance from the one or more sixth service instances as the target service instance.

[0045] In a second embodiment, the instance status information reflects the load status of the service instance, such as how many other service instances have accessed the service instance. The proxy module can sort the multiple third service instances based on their load status from smallest to largest, and then determine the highest-ranked third service instance as the target service instance.

[0046] In actual application, there may be a situation where the proxy module fails to query the target service information of the target service from the first service information. At this time, the proxy module can send a second read request to the registration center; then receive and save the target service information of the target service and the instance status information of multiple third service instances associated with the target service fed back by the registration center based on the second read request; then determine the target service instance from multiple third service instances based on the instance status information of each third service instance, and return the target service instance to the second service instance.

[0047] Figure 3 A diagram of an optional service governance process is shown in Figure 3 As shown, the process includes at least the following steps:

[0048] S1, each service registers the maintained service information to the registration center;

[0049] S2, each service instance registers the maintained instance information to the registration center;

[0050] S3, the proxy module periodically updates the instance status information of each fifth service instance in the host machine to the registration center;

[0051] S4, the proxy module periodically reads and saves the first service information of the first service and the first instance information of the associated first service instance in the host machine from the registration center;

[0052] S5, the second service instance sends a service request to the proxy module to access the target service;

[0053] S6, the proxy module queries the target service information from the first service information, and directly determines the instance status information of the third service instance associated with the target service if the target service information exists; if the target service information does not exist, the proxy module reads and saves the target service information and the instance status information of the third service instance associated with the target service from the registration center;

[0054] S7, the proxy module determines a target service instance from the plurality of third service instances based on the instance state information of each third service instance;

[0055] S8, the proxy module returns the target service instance to the second service instance;

[0056] S9: The second service instance accesses the target service through the target service instance.

[0057] In an embodiment of the present application, the proxy module periodically reads the first service information of each first service in the host and the first instance information of multiple first service instances associated with each first service from the registration center, wherein the registration center maintains multiple service information and multiple instance information, and the instance information includes periodically updated instance status information; the proxy module responds to the service request for accessing the target service sent by the second service instance, determines the instance status information of multiple third service instances associated with the target service from the first instance information, and then determines the target service instance from the multiple third service instances based on the instance status information of each third service instance, and returns the target service instance to the second service instance, so that the second service instance accesses the target service through the target service instance. Among them, by setting up a host agent, allowing the agent and the registration center to synchronize information, and the instance directly accessing the host agent, it can reduce the instance's frequent access to the registration center and avoid the registration center becoming a bottleneck; by regularly registering the instance's status information, allowing the currently most idle instance to respond to the service first, it can achieve the effect of balancing traffic and balancing access pressure, thereby solving the technical problems of traffic convergence and public node bottlenecks in microservice applications.

[0058] Example 2

[0059] According to an embodiment of the present application, a service management device for implementing the service management method in embodiment 1 is also provided. Figure 4 As shown, the service management device includes at least a reading module 41, a determination module 42 and a feedback module 43, wherein:

[0060] The reading module 41 is used to periodically read the first service information of each first service in the host machine and the first instance information of multiple first service instances associated with each first service from the registration center, wherein the registration center maintains multiple service information and multiple instance information, each service information includes service basic information of a service and service association information for reflecting multiple service instances associated with the service, each instance information includes instance basic information of a service instance, instance status information and instance affiliation information for reflecting the service to which the service instance belongs, and the instance status information is periodically updated to the registration center by the agent module in the host machine where the service instance is located.

[0061] It is understandable that before the proxy module reads the first service information and the first instance information, the registration center already stores the service information of multiple service registrations and the instance information of multiple service instance registrations. Specifically, the registration center will respond to the first registration request of the second service by writing the second service information of the second service into the registration center; similarly, the registration center will respond to the second registration request of the fourth service instance by writing the fourth instance information of the fourth service instance into the registration center. The second service can be any service in any host machine, and the fourth service instance can be any service instance in any host machine. The registration center will write the corresponding second service information and fourth instance information into the maintained registration table.

[0062] Optionally, the service governance device in the embodiment of the present application also includes an update module for periodically obtaining the instance status information of each fifth service instance in the host machine; and then using the obtained instance status information of the fifth service instance to update the instance status information of the fifth service instance written in the registration center.

[0063] Afterwards, when reading the first service information and the first instance information, the reading module can periodically send a first read request to the registration center; receive the first service information of each first service in the host machine and the first instance information of multiple first service instances associated with each first service fed back by the registration center based on the first read request; and then use the received first service information of the first service and the first instance information of the first service instance to update the locally cached first service information of the first service and the first instance information of the first service instance.

[0064] Among them, since the proxy module periodically updates the instance status information of the service instance, the first instance information obtained here can relatively accurately reflect the current status of the first service instance, such as whether it is in an idle state or a busy state. The proxy module updates the latest first service information and first instance information locally to facilitate subsequent responses to service requests from service consumers.

[0065] The determination module 42 is used to determine the target service information of the target service from the first service information in response to the service request for accessing the target service sent by the second service instance, and determine the instance status information of multiple third service instances associated with the target service from the first instance information based on the target service information.

[0066] The second service instance may be any service instance, which is also called a service consumer, and the third service instance associated with the target service accessed by the second service instance is called a service provider.

[0067] The feedback module 43 is configured to determine a target service instance from multiple third service instances based on the instance state information of each third service instance, and return the target service instance to the second service instance so that the second service instance accesses the target service through the target service instance.

[0068] When determining the target service instance from multiple third service instances, the idea of the embodiment of the present application is to continuously refresh the management list of the proxy module based on the instance status information of the service instance, so that the proxy module can first find the most idle target service instance, thereby realizing the diversion management of the service instance affecting the proxy module, that is, control inversion, and allocating traffic to the most appropriate service instance to respond to access.

[0069] Specifically, instance status information exists in various forms, such as directly reflecting the busy or idle status of the service instance, or reflecting the current load status of the service instance. Corresponding to the instance status information, the embodiments of the present application provide the following optional implementation methods for determining the target service instance.

[0070] In the first embodiment, the instance status information is used to reflect whether the service instance is busy or idle. In this case, the feedback module 43 may first determine one or more sixth service instances whose instance status information indicates an idle state from the plurality of third service instances; and then randomly determine a service instance from the one or more sixth service instances as the target service instance.

[0071] In a second embodiment, instance status information is used to reflect the load status of a service instance, such as how many other service instances have accessed the service instance. Feedback module 43 can sort the multiple third service instances from smallest to largest based on their load status, and then determine the highest-ranked third service instance as the target service instance.

[0072] In actual application, there may be a situation where the determination module 42 fails to query the target service information of the target service from the first service information. At this time, the determination module 42 can send a second read request to the registration center, and then receive and save the target service information of the target service and the instance status information of multiple third service instances associated with the target service fed back by the registration center based on the second read request; then the feedback module 43 determines the target service instance from multiple third service instances based on the instance status information of each third service instance, and returns the target service instance to the second service instance.

[0073] It should be noted that each module in the service governance device in the embodiment of the present application corresponds one-to-one to each implementation step of the service governance method in Example 1. Since a detailed description has been given in Example 1, some details not reflected in this embodiment can be referred to Example 1 and will not be elaborated here.

[0074] Example 3

[0075] According to an embodiment of the present application, a non-volatile storage medium is also provided, which includes a stored program, wherein the device where the non-volatile storage medium is located executes the service governance method in Example 1 by running the program.

[0076] Specifically, the device where the non-volatile storage medium is located implements the following steps by running the program: periodically reading the first service information of each first service in the host machine and the first instance information of multiple first service instances associated with each first service from the registration center, wherein the registration center maintains multiple service information and multiple instance information, each service information includes service basic information of a service and service association information used to reflect multiple service instances associated with the service, each instance information includes instance basic information of a service instance, instance status information and instance affiliation information used to reflect the service to which the service instance belongs, and the instance status information is periodically updated to the registration center by the agent module in the host machine where the service instance is located; in response to the service request for accessing the target service sent by the second service instance, determining the target service information of the target service from the first service information, and determining the instance status information of multiple third service instances associated with the target service from the first instance information based on the target service information; determining the target service instance from the multiple third service instances based on the instance status information of each third service instance, and returning the target service instance to the second service instance, so that the second service instance accesses the target service through the target service instance.

[0077] According to an embodiment of the present application, a processor is also provided, which is used to run a program, wherein the service governance method in Example 1 is executed when the program is running.

[0078] Specifically, when the program is running, the following steps are executed: periodically reading the first service information of each first service in the host machine and the first instance information of multiple first service instances associated with each first service from the registration center, wherein the registration center maintains multiple service information and multiple instance information, each service information includes service basic information of a service and service association information used to reflect multiple service instances associated with the service, each instance information includes instance basic information of a service instance, instance status information and instance affiliation information used to reflect the service to which the service instance belongs, and the instance status information is periodically updated to the registration center by the agent module in the host machine where the service instance is located; in response to the service request for accessing the target service sent by the second service instance, determining the target service information of the target service from the first service information, and determining the instance status information of multiple third service instances associated with the target service from the first instance information based on the target service information; determining the target service instance from the multiple third service instances based on the instance status information of each third service instance, and returning the target service instance to the second service instance, so that the second service instance accesses the target service through the target service instance.

[0079] According to an embodiment of the present application, an electronic device is also provided, which includes: a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to execute the service governance method in Example 1 through the computer program.

[0080] Specifically, the processor is configured to execute the following steps through a computer program: periodically reading the first service information of each first service in the host machine and the first instance information of multiple first service instances associated with each first service from a registration center, wherein the registration center maintains multiple service information and multiple instance information, each service information includes service basic information of a service and service association information for reflecting multiple service instances associated with the service, each instance information includes instance basic information of a service instance, instance status information and instance affiliation information for reflecting the service to which the service instance belongs, and the instance status information is periodically updated to the registration center by the agent module in the host machine where the service instance is located; in response to a service request for accessing the target service sent by the second service instance, determining the target service information of the target service from the first service information, and determining the instance status information of multiple third service instances associated with the target service from the first instance information based on the target service information; determining the target service instance from the multiple third service instances based on the instance status information of each third service instance, and returning the target service instance to the second service instance, so that the second service instance accesses the target service through the target service instance.

[0081] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0082] In the above embodiments of the present application, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0083] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only exemplary. For example, the division of units can be a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0084] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple units. Some or all of the units may be selected to achieve the purpose of the present embodiment according to actual needs.

[0085] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0086] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program code.

[0087] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A service governance method, characterized in that: include: The agent module in the host machine periodically reads the first service information of each first service in the host machine and the first instance information of multiple first service instances associated with each first service from the registration center, wherein the registration center maintains multiple service information and multiple instance information, each of the service information includes service basic information of a service and service association information for reflecting multiple service instances associated with the service, each of the instance information includes instance basic information of a service instance, instance status information and instance affiliation information for reflecting the service to which the service instance belongs, and the instance status information is periodically updated to the registration center by the agent module in the host machine where the service instance is located; The proxy module determines target service information of the target service from the first service information in response to a service request for accessing a target service sent by the second service instance, and determines instance state information of a plurality of third service instances associated with the target service from the first instance information based on the target service information; The proxy module determines a target service instance from the plurality of third service instances based on instance status information of each third service instance, and returns the target service instance to the second service instance, so that the second service instance accesses the target service through the target service instance.

2. The method according to claim 1, characterized in that Before the proxy module periodically updates the instance status information of each first service instance in the host machine to the registration center, the method further includes: The registration center writes the second service information of the second service into the registration center in response to the first registration request of the second service; The registration center writes fourth instance information of the fourth service instance into the registration center in response to the second registration request of the fourth service instance.

3. The method according to claim 2, characterized in that The method further comprises: The proxy module periodically obtains instance status information of each fifth service instance in the host machine; The proxy module uses the acquired instance status information of the fifth service instance to update the instance status information of the fifth service instance written in the registration center.

4. The method according to claim 1, wherein The proxy module in the host machine periodically reads first service information of each first service in the host machine and first instance information of multiple first service instances associated with each first service from the registration center, including: The proxy module periodically sends a first read request to the registration center; The proxy module receives the first service information of each first service in the host machine and the first instance information of multiple first service instances associated with each first service, which are fed back by the registration center according to the first read request; The proxy module updates the locally cached first service information of the first service and the first instance information of the first service instance by using the received first service information of the first service and the first instance information of the first service instance.

5. The method according to claim 1, wherein The instance status information is used to reflect whether the service instance is in a busy state or an idle state, and the proxy module determines a target service instance from the plurality of third service instances based on the instance status information of each third service instance, including: The proxy module determines, from the plurality of third service instances, one or more sixth service instances whose instance status information is in an idle state; The proxy module determines the target service instance from the one or more sixth service instances.

6. The method according to claim 1, characterized in that The instance status information is used to reflect the load status of the service instance, and the proxy module determines a target service instance from the plurality of third service instances based on the instance status information of each third service instance, including: The proxy module sorts the plurality of third service instances in ascending order according to the load status of each third service instance; The proxy module determines the third service instance ranked first as the target service instance.

7. The method according to claim 1, characterized in that The method further comprises: When the proxy module fails to find the target service information of the target service from the first service information, the proxy module sends a second read request to the registration center; The proxy module receives and stores the target service information of the target service and instance status information of multiple third service instances associated with the target service fed back by the registration center according to the second read request; The proxy module determines a target service instance from the plurality of third service instances based on instance state information of each of the third service instances, and returns the target service instance to the second service instance.

8. A service management device, characterized in that: include: A reading module, configured to periodically read first service information of each first service in a host machine and first instance information of multiple first service instances associated with each first service from a registration center, wherein the registration center maintains multiple service information and multiple instance information, each of the service information includes service basic information of a service and service association information reflecting multiple service instances associated with the service, each of the instance information includes instance basic information of a service instance, instance status information, and instance affiliation information reflecting the service to which the service instance belongs, and the instance status information is periodically updated to the registration center by an agent module in the host machine where the service instance is located; a determining module, configured to, in response to a service request for accessing a target service sent by a second service instance, determine target service information of the target service from the first service information, and determine instance state information of a plurality of third service instances associated with the target service from the first instance information based on the target service information; A feedback module is used to determine a target service instance from multiple third service instances based on the instance status information of each third service instance, and return the target service instance to the second service instance so that the second service instance accesses the target service through the target service instance.

9. A service governance system, characterized in that: include: Multiple services, multiple service instances, proxy modules, and registration centers, among which, Each service is used to register service information of the service to the registration center, where the service information includes basic service information of the service and service association information reflecting multiple service instances associated with the service; Each service instance is used to register instance information of the service instance with the registration center, wherein the instance information includes instance basic information of the service instance, instance status information, and instance affiliation information reflecting the service to which the service instance belongs; The proxy module is located in the host machine and is used to periodically update the instance status information of each fifth service instance in the host machine to the registration center; periodically read the first service information of each first service in the host machine and the first instance information of multiple first service instances associated with each first service from the registration center; in response to a service request for accessing a target service sent by a second service instance, determine the target service information of the target service from the first service information, and determine the instance status information of multiple third service instances associated with the target service from the first instance information based on the target service information; determine the target service instance from the multiple third service instances based on the instance status information of each third service instance, and return the target service instance to the second service instance so that the second service instance can access the target service through the target service instance.

10. An electronic device, characterized in that: include: A memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the service governance method according to any one of claims 1 to 7 through the computer program.