Service governance method and apparatus

By combining supervisors and event listeners, service status information is dynamically managed and the registry is updated, solving the problem of large-scale service governance for virtual machine servers and reducing deployment and maintenance workload.

CN122220175APending Publication Date: 2026-06-16NETSUNION CLEARING CORP

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NETSUNION CLEARING CORP
Filing Date
2024-12-06
Publication Date
2026-06-16

Smart Images

  • Figure CN122220175A_ABST
    Figure CN122220175A_ABST
Patent Text Reader

Abstract

A service management method and device, comprising: managing services provided by a target system by using a process management tool supervisor; when the state of at least one service in the services managed by the supervisor is adjusted, sending current state information of the target service whose state is adjusted to a pre-set event listener; and performing an operation in a registration center that is adapted to the current state information of the target service by using the event listener. The embodiment of the application can achieve the purpose of dynamically performing a corresponding operation in the registration center through an event mechanism of the supervisor, and service management is achieved without introducing a sidecar component, thereby saving the workload of deployment and operation and maintenance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This article relates to service governance technologies, and more particularly to a service governance method and apparatus. Background Technology

[0002] In some scenarios, a large number of application services are deployed on thousands of servers. To achieve service governance, Java applications can generally use Dubbo or Spring Cloud to easily implement service governance functions. However, it is often more difficult for non-Java programs or some introduced services that do not support secondary development to achieve service governance.

[0003] In related technologies, when using Docker containers on a large scale, the sidecar pattern can be used to solve service governance problems by implementing a pattern similar to service mesh.

[0004] However, when using virtual machines as servers, this approach requires a sidecar component for each virtual machine to address service governance issues. Therefore, when using virtual machines as servers on a large scale, a large number of sidecar components need to be introduced, which greatly increases the workload of deployment and maintenance. Summary of the Invention

[0005] This application provides a service governance method and apparatus that can achieve service governance without introducing sidecar components, thereby saving deployment and maintenance workload.

[0006] On the one hand, this application provides a service governance method, including: Use the process management tool Supervisor to manage the services provided by the target system; When the state of at least one of the services managed by the supervisor is adjusted, the current state information of the target service whose state has been adjusted is sent to the pre-set event listener. The event listener is used to perform operations in the registry center that are adapted to the current state information of the target service.

[0007] On the other hand, this application provides a service governance apparatus, including: a memory and a processor, wherein the memory is used to store an executable program; The processor is used to read and execute the executable program to implement the service governance method described above.

[0008] Compared with related technologies, this application includes using a supervisor to manage the services provided by the target system; when the state of at least one target service among the services managed by the supervisor is adjusted, the current state information of the target service is sent to a pre-set event listener; the event listener is used to process the current state information of the target service in the registry center. Therefore, through the event mechanism of the supervisor, the purpose of dynamically performing corresponding operations to the registry center is achieved, and service governance is realized without introducing sidecar components, thereby saving the workload of deployment and operation and maintenance.

[0009] Other features and advantages of this application will be set forth in the following description, and will be apparent in part from the description, or may be learned by practicing the application. Other advantages of this application can be realized and obtained by means of the solutions described in the description and the accompanying drawings. Attached Figure Description

[0010] The accompanying drawings are used to provide an understanding of the technical solutions of this application and constitute a part of the specification. They are used together with the embodiments of this application to explain the technical solutions of this application and do not constitute a limitation on the technical solutions of this application.

[0011] Figure 1 A flowchart illustrating a service governance method provided in an embodiment of this application; Figure 2 A flowchart illustrating another service governance method provided in this application embodiment; Figure 3 This is a schematic diagram of a service governance device provided in an embodiment of this application. Detailed Implementation

[0012] This application describes several embodiments, but these descriptions are exemplary and not restrictive, and it will be apparent to those skilled in the art that many more embodiments and implementations are possible within the scope of the embodiments described herein. Although many possible combinations of features are shown in the drawings and discussed in the detailed description, many other combinations of the disclosed features are also possible. Unless specifically limited, any feature or element of any embodiment may be used in combination with, or may replace, any feature or element of any other embodiment.

[0013] This application includes and contemplates combinations of features and elements known to those skilled in the art. The embodiments, features, and elements disclosed in this application may also be combined with any conventional features or elements to form a unique inventive scheme as defined by the claims. Any feature or element of any embodiment may also be combined with features or elements from other inventive schemes to form another unique inventive scheme as defined by the claims. Therefore, it should be understood that any feature shown and / or discussed in this application may be implemented individually or in any suitable combination. Therefore, the embodiments are not limited except by the limitations imposed by the appended claims and their equivalents. Furthermore, various modifications and changes may be made within the scope of the appended claims.

[0014] Furthermore, in describing representative embodiments, the specification may have presented methods and / or processes as a specific sequence of steps. However, the method or process should not be limited to the specific order of steps described herein, to the extent that it does not depend on such a specific order. As will be understood by those skilled in the art, other sequences of steps are also possible. Therefore, the specific order of steps set forth in the specification should not be construed as a limitation of the claims. Moreover, the claims concerning the method and / or process should not be limited to the steps performed in the written order, and those skilled in the art will readily understand that these orders can be varied and still remain within the spirit and scope of the embodiments of this application.

[0015] This application provides a service governance method, such as... Figure 1 As shown, it includes: Step 101: Use the process management tool Supervisor to manage the services provided by the target system; Step 102: When the state of at least one of the services managed by the supervisor is adjusted, the current state information of the target service whose state has been adjusted is sent to the pre-set event listener. Step 103: Use the event listener to perform operations in the registry center that are appropriate for the current state information of the target service.

[0016] Supervisor is a process management tool written in Python that can easily implement process startup, restart, and shutdown functions on Unix-like systems. However, the native Supervisor can only perform simple management of service processes and cannot directly provide the more information needed for service governance. Therefore, this embodiment of the application utilizes the event mechanism of the Supervisor process management program to set up a custom event listener, EventListener, and works in conjunction with the registry center generally used for service governance to achieve service governance through interaction.

[0017] For example, a flowchart illustrating the specific implementation of a service governance method can be shown as follows: Figure 2 As shown, assuming the supervisor manages services A, B, C, and D, when the state of service A, B, C, or D is adjusted, the supervisor sends the current state information of the target service whose state has been adjusted to a pre-set event listener, so that the event listener can perform an operation in the registry center that is adapted to the current state information of the target service.

[0018] The service governance method provided in this application uses a supervisor to manage the services provided by the target system. When the state of at least one target service managed by the supervisor is adjusted, the current state information of the target service is sent to a pre-set event listener. The event listener is used to process the service in the registry center in accordance with the current state information of the target service. Therefore, through the event mechanism of the supervisor, the purpose of dynamically performing corresponding operations to the registry center is achieved. Service governance is achieved without introducing a sidecar component, thereby saving the workload of deployment and maintenance.

[0019] In one exemplary instance, the adjustment of the state of the target service includes one of the following: the target service is adjusted from an unstarted state to a started state, the target service is adjusted from a running state to a stopped state, and the target service is adjusted from a running state to an error-reporting state.

[0020] For example, the supervisor manages the services provided by the target system. When the supervisor uses a subroutine to start a service that was not originally started, the service's state is changed from not started to started. When the supervisor uses a subroutine to stop a service that was originally running, the service's state is changed from running to stopped. When the supervisor receives a subroutine exit or uses a subroutine to detect error events such as a port being unavailable, the service's state is changed from running to error state.

[0021] In one exemplary instance, when sending the current state information of the target service whose state has been adjusted to a pre-set event listener, the method further includes: The identification information of the target service is sent to the event listener.

[0022] In one exemplary instance, the operation of utilizing the event listener in the registry center, adapted to the current state information of the target service, includes: The event listener is used to obtain the configuration information of the target service from the supervisor's configuration file based on the identification information of the target service, and the event listener is used to perform operations in the registry center that are appropriate for the current state information of the target service based on the obtained configuration information.

[0023] In one exemplary instance, the configuration information of the target service includes: the name information of the target service and the service provision information of the target service.

[0024] In one exemplary instance, the service provision information of the target service includes: the IP address of the node server on which the target service is deployed, and the port number on the node server on which the target service is deployed for providing the target service.

[0025] In one exemplary instance, when the current state of the target service is the "started" state, the step of using the event listener to perform operations in the registry center adapted to the current state information of the target service based on the obtained configuration information includes: First, the event listener is used to search for the registration information of the target service in the registry center based on the name information of the target service; When the registration information of the target service is found, the registration information of the target service is updated according to the service provision information of the target service. If no registration information for the target service is found, the registration information for the target service is created based on the name information and service provision information of the target service.

[0026] For example, if the registration information of the target service is found in the registry, it means that the target service has already been registered in the registry and a node server is already providing the target service. Therefore, the service provision information of the target service is the IP address and port number information of the other node servers providing the target service. It is only necessary to add the IP address and port number information of the new node server providing the target service to the registration information field of the target service in the registry. Conversely, if the registration information of the target service is not found in the registry, it means that the target service has not been registered in the registry and no node server has previously provided the target service. Therefore, it is necessary to register the name information of the target service along with the IP address and port number information of the node server providing the target service in the registry.

[0027] In one exemplary instance, when the current state of the target service is the stopped state or the error state, the step of using the event listener to perform an operation in the registry center adapted to the current state information of the target service based on the obtained configuration information includes: First, the event listener is used to search for the registration information of the target service in the registry center based on the name information of the target service; Secondly, the parts of the registration information of the target service that are identical to the service provision information of the target service are removed.

[0028] In one exemplary instance, prior to managing the services provided by the target system using a supervisor, the process further includes: For each service provided by the target system, the startup command and parameters for that service are configured in the supervisor's configuration file.

[0029] In one exemplary instance, the method further includes: First, obtain the registration information query request from the service requester; Secondly, the registration information corresponding to the registration information query request is obtained from the registration center, and the obtained registration information is returned to the service requester.

[0030] For example, the service requester (i.e. the service user) can implement the corresponding client according to actual needs, which can achieve both high availability and decoupling from the server.

[0031] This application also provides a service governance device, such as... Figure 3 As shown, it includes: a memory 31 and a processor 32, wherein the memory 31 is used to store executable programs; The processor 32 is used to read and execute the executable program to perform the following steps: Use the process management tool Supervisor to manage the services provided by the target system; When the state of at least one of the services managed by the supervisor is adjusted, the current state information of the target service whose state has been adjusted is sent to the pre-set event listener. The event listener is used to perform operations in the registry center that are adapted to the current state information of the target service.

[0032] In one exemplary instance, the adjustment of the state of the target service includes one of the following: the target service is adjusted from an unstarted state to a started state, the target service is adjusted from a running state to a stopped state, and the target service is adjusted from a running state to an error-reporting state.

[0033] In one exemplary instance, when the current state information of the target service whose state has been adjusted is sent to a pre-set event listener, the processor 32 is used to read and execute the executable program to achieve the following steps: The identification information of the target service is sent to the event listener.

[0034] In one exemplary instance, the processor 32 is configured to read and execute the executable program to perform the following steps: The event listener is used to obtain the configuration information of the target service from the supervisor's configuration file based on the identification information of the target service, and the event listener is used to perform operations in the registry center that are appropriate for the current state information of the target service based on the obtained configuration information.

[0035] In one exemplary instance, the configuration information of the target service includes: the name information of the target service and the service provision information of the target service.

[0036] In one exemplary instance, when the current state of the target service is the startup state, the processor 32 is configured to read and execute the executable program to perform the following steps: The event listener is used to search for the registration information of the target service in the registry center based on the name information of the target service. When the registration information of the target service is found, the registration information of the target service is updated according to the service provision information of the target service. If no registration information for the target service is found, the registration information for the target service is created based on the name information and service provision information of the target service.

[0037] In one exemplary instance, when the current state of the target service is the stopped state or the error state, the processor 32 is used to read and execute the executable program to achieve the following steps: The event listener is used to search for the registration information of the target service in the registry center based on the name information of the target service. Remove the portion of the registration information of the target service that is identical to the service provision information of the target service.

[0038] In one exemplary instance, the processor 32 is configured to read and execute the executable program to perform the following steps: For each service provided by the target system, the startup command and parameters for that service are configured in the supervisor's configuration file.

[0039] In one exemplary instance, the processor 32 is configured to read and execute the executable program to perform the following steps: Obtain the registration information query request from the service requester; The system retrieves the registration information corresponding to the registration information query request from the registration center and returns the obtained registration information to the service requester.

[0040] In one exemplary instance, the service provision information of the target service includes: the IP address of the node server on which the target service is deployed, and the port number on the node server on which the target service is deployed for providing the target service.

[0041] The service governance device provided in this application embodiment utilizes a supervisor to manage services provided by a target system. When the state of at least one target service managed by the supervisor is adjusted, the current state information of the target service is sent to a pre-set event listener. The event listener is used to process the current state information of the target service in the registry center. Therefore, through the event mechanism of the supervisor, the purpose of dynamically performing corresponding operations to the registry center is achieved. Service governance is realized without introducing a sidecar component, thereby saving the workload of deployment and maintenance.

[0042] This application also provides a storage medium storing a computer program, which, when executed by a processor, can implement the service governance method as described in any of the above embodiments.

[0043] It will be understood by those skilled in the art that all or some of the steps, systems, or apparatuses disclosed above, and their functional modules / units, can be implemented as software, firmware, hardware, or suitable combinations thereof. In hardware implementations, the division between functional modules / units mentioned above does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all components may be implemented as software executed by a processor, such as a digital signal processor or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit (ASIC). Such software may be distributed on a computer-readable medium, which may include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.

Claims

1. A service governance method, characterized in that, include: Use the process management tool Supervisor to manage the services provided by the target system; When the state of at least one of the services managed by the supervisor is adjusted, the current state information of the target service whose state has been adjusted is sent to the pre-set event listener. The event listener is used to perform operations in the registry center that are adapted to the current state information of the target service.

2. The method according to claim 1, characterized in that, The adjustment of the target service's status includes one of the following: the target service is changed from an unstarted state to a started state, the target service is changed from a running state to a stopped state, or the target service is changed from a running state to an error-reporting state.

3. The method according to claim 2, characterized in that, When sending the current state information of the target service whose state has been adjusted to a pre-set event listener, the method further includes: Send the identification information of the target service to the event listener; The operation performed in the registry center using the event listener, adapted to the current state information of the target service, includes: The event listener is used to obtain the configuration information of the target service from the supervisor's configuration file based on the identification information of the target service, and the event listener is used to perform operations in the registry center that are appropriate for the current state information of the target service based on the obtained configuration information.

4. The method according to claim 3, characterized in that, The configuration information of the target service includes: the name information of the target service and the service provision information of the target service.

5. The method according to claim 4, characterized in that, When the current state of the target service is the "started" state, the step of using the event listener to perform operations in the registry center according to the obtained configuration information, adapted to the current state information of the target service, includes: The event listener is used to search for the registration information of the target service in the registry center based on the name information of the target service. When the registration information of the target service is found, the registration information of the target service is updated according to the service provision information of the target service. If no registration information for the target service is found, the registration information for the target service is created based on the name information and service provision information of the target service.

6. The method according to claim 4, characterized in that, When the current state of the target service is the stopped state or the error state, the operation performed by the event listener in the registry center according to the obtained configuration information is adapted to the current state information of the target service, including: The event listener is used to search for the registration information of the target service in the registry center based on the name information of the target service. Remove the portion of the registration information of the target service that is identical to the service provision information of the target service.

7. The method according to claim 1, characterized in that, Before using supervisor to manage the services provided by the target system, the following steps are also included: For each service provided by the target system, the startup command and parameters for that service are configured in the supervisor's configuration file.

8. The method according to claim 1, characterized in that, The method further includes: Obtain the registration information query request from the service requester; The system retrieves the registration information corresponding to the registration information query request from the registration center and returns the obtained registration information to the service requester.

9. The method according to any one of claims 4-6, characterized in that, The service provision information of the target service includes: the IP address of the node server on which the target service is deployed, and the port number on the node server on which the target service is deployed to provide the target service.

10. A service management device, characterized in that, A memory and a processor, wherein the memory is used to store an executable program; The processor is used to read and execute the executable program to implement the service governance method as described in any one of claims 1-9.