A service exception monitoring method, system, device, electronic equipment and medium

By monitoring the server to detect application service anomalies and controlling the gateway and registry center to restart services, the problem of application services being unable to recover after server crashes was solved, achieving automated operation and maintenance of application services and improving user experience.

CN116107840BActive Publication Date: 2026-04-24CHENGDU FANWEI NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHENGDU FANWEI NETWORK TECH CO LTD
Filing Date
2023-02-20
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

In existing technologies, application services cannot be restored after a server crash in a non-container environment, and there is a gap in the service deletion process under container technology, which causes traffic to be transmitted to abnormal service nodes, resulting in a poor user experience.

Method used

By periodically polling application services through the monitoring server, detecting anomalies, and sending service shutdown commands to the gateway and registry center, the application service is restarted by the proxy service, thus achieving automatic recovery of the application service and preventing traffic from being transmitted to the abnormal service.

Benefits of technology

It enables application service anomaly detection and automatic recovery in non-container environments, improving user experience, reducing downtime awareness, lowering manual costs, and providing additional service anomaly monitoring solutions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116107840B_ABST
    Figure CN116107840B_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of operation and maintenance of micro-service architecture, and aims to provide a service exception monitoring method, system, device, electronic equipment and medium. The application can realize abnormal detection of application service and automatic recovery thereof, and in the process, users have no perception, which is beneficial to improve user experience. Specifically, since the application initiates a service offline instruction to the gateway at the same time, it can ensure that as long as the current application service is offline, the request transmitted to the current application service can be immediately cut off, thereby avoiding the problem that the front-end user transmits the request to the abnormal application service, reducing the user's perception of the application service downtime, and improving the user experience. Meanwhile, the embodiment can realize service exception monitoring without relying on container technology, can realize automatic operation and maintenance of a non-container operation and maintenance system, is beneficial to reduce labor costs, and provides an additional service exception monitoring scheme for customers of container operation and maintenance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of operation and maintenance technology of microservice architecture, specifically relating to a service anomaly monitoring method, system, device, electronic device and medium. Background Technology

[0002] Docker is an open-source application container engine that allows developers to package their application packages into a portable container in a unified way, and then deploy it to any server (including Linux and Windows machines) with the Docker engine installed, achieving virtualization. During the operation of a Docker container, one technology involved is as follows: the Docker container checks the application service's health check interface every 30 seconds, performing five consecutive checks. If all checks result in anomalies, the application service is deleted, and then a new, identical application service is added and started.

[0003] However, in using the prior art, the inventors discovered at least the following problems:

[0004] a. Not all environments use container technology, which means that if a server crashes, the corresponding application services cannot be restored;

[0005] b. During the process of deleting application services using container technology, there is a gap period. During this period, the gateway cannot detect it in time, causing some traffic to still be transmitted to the deleted application service nodes, resulting in abnormal requests initiated by the front end and a poor user experience. Summary of the Invention

[0006] The present invention aims to solve the above-mentioned technical problems to at least a certain extent, and provides a service anomaly monitoring method, system, device, electronic device and medium.

[0007] To achieve the above objectives, the present invention adopts the following technical solution:

[0008] In a first aspect, the present invention provides a service anomaly monitoring method, executed by a monitoring server, wherein the monitoring server is communicatively connected to an application server, a gateway, and a registration center, and both the gateway and the registration center are communicatively connected to the application server, and the application server deploys an application service and a proxy service bound to the application service; the method includes:

[0009] The application services in the application server are periodically polled, and if the current application service fails n times consecutively, it is determined that the current application service has failed.

[0010] A service shutdown command is sent to both the gateway and the registration center, so that the gateway and the registration center can respectively perform the shutdown operation on the current application service, and send a shutdown success message to the monitoring server after successful shutdown; wherein, the service shutdown command includes the service name and IP address information of the current application service;

[0011] A service restart command is sent to the proxy service in the application server so that the proxy service can terminate all processes of the current application service and then restart the current application service; wherein, the service restart command includes the service name and IP address information of the current application service.

[0012] This invention enables the detection and automatic recovery of application service anomalies, all without the user's awareness, thus improving user experience. Specifically, the invention monitors the abnormal state of application services via a monitoring server. Upon detecting an anomaly, it controls the gateway and registry center to restart the current application service and terminates all processes of the application service on the application server before restarting it. During this process, since information from the registry center is periodically synchronized to the gateway and application service, simply taking this information offline from the registry center would introduce a delay. Even after the current application service is taken offline from the registry center, requests might still be sent to the already abnormal application service. Therefore, this invention simultaneously sends a service offline command to the gateway, ensuring that taking the current application service offline immediately cuts off requests to it, preventing front-end users from sending requests to the abnormal application service, reducing the user's perception of application service downtime, and improving user experience. Furthermore, this invention achieves service anomaly monitoring without relying on container technology, enabling automated operation and maintenance of non-containerized systems, reducing labor costs. It also provides an additional service anomaly monitoring solution for customers using containerized systems.

[0013] In one possible design, the application service embeds a login-free health check interface. When the monitoring server periodically polls the application service in the application server, it performs anomaly detection on the application server through the health check interface.

[0014] In one possible design, polling the application services in the application server includes:

[0015] The health check interface sends an anomaly detection request to the application service so that the health check interface can check the basic information of the current application service, obtain the detection result based on the basic information, and then feed back the detection result to the monitoring server; wherein, the basic information includes the service name and IP address information of the current application service, and the detection result includes a normal status identifier code or an abnormal status identifier code.

[0016] In one possible design, the monitoring server is also communicatively connected to a management terminal; after determining that the application service is malfunctioning, the method further includes:

[0017] Send a service error message to the management terminal.

[0018] In one possible design, the application server also deploys other application services that call the current application service; after determining that the current application service has encountered an error, the method further includes:

[0019] Send a service shutdown command to the other application services so that the other application services can shut down the current application service.

[0020] In one possible design, after the proxy service restarts the current application service, the current application service actively sends its service information to the registration center so that the registration center can synchronize the service information to the gateway; wherein, the service information includes the service name and IP address information of the current application service.

[0021] The second aspect includes a monitoring server, an application server, a gateway, and a registration center. The application server, gateway, and registration center are all communicatively connected to the monitoring server. The gateway and the registration center are both communicatively connected to the application server. The application server deploys an application service and a proxy service bound to the application service. The monitoring server is used to execute the service anomaly monitoring method as described in any of the above.

[0022] Thirdly, the present invention provides a service anomaly monitoring device for implementing the service anomaly monitoring method as described in any of the preceding claims; the service anomaly monitoring device includes:

[0023] The detection module is used to periodically poll the application services in the application server, and determine that the current application service is abnormal when the current application service is abnormal n times in a row.

[0024] A service offline control module, communicatively connected to the detection module, is used to initiate service offline commands to both the gateway and the registration center, so that the gateway and the registration center can respectively perform offline operations on the current application service, and send offline success information back to the monitoring server after successful offline operation; wherein, the service offline command includes the service name and IP address information of the current application service;

[0025] The service restart module is communicatively connected to the service offline control module and is used to initiate a service restart command to the proxy service in the application server, so that the proxy service terminates all processes of the current application service and then restarts the current application service; wherein, the service restart command includes the service name and IP address information of the current application service.

[0026] Fourthly, the present invention provides an electronic device, comprising:

[0027] Memory, used to store computer program instructions; and,

[0028] A processor for executing the computer program instructions to perform the operation of the service anomaly monitoring method as described in any of the preceding claims.

[0029] Fifthly, the present invention provides a computer-readable storage medium for storing computer-readable computer program instructions configured to perform operations as described in any of the preceding claims during runtime. Attached Figure Description

[0030] Figure 1 This is a flowchart of a service anomaly monitoring method in one embodiment;

[0031] Figure 2 This is a block diagram of a service anomaly monitoring system in one embodiment;

[0032] Figure 3 This is a block diagram of a service anomaly monitoring device in one embodiment. Detailed Implementation

[0033] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the present invention will be briefly introduced below in conjunction with the accompanying drawings and descriptions of the embodiments or the prior art. Obviously, the following description of the structure of the accompanying drawings is only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. It should be noted that the description of these embodiments is for the purpose of helping to understand the present invention, but does not constitute a limitation of the present invention.

[0034] Example 1:

[0035] This embodiment discloses a service anomaly monitoring method, which can be executed by, but is not limited to, a computer device or virtual machine with certain computing resources, such as a personal computer, smartphone, personal digital assistant or wearable device, or by a virtual machine.

[0036] like Figure 1As shown, a service anomaly monitoring method is implemented based on a monitoring server. The monitoring server is communicatively connected to an application server, a gateway, and a registration center. Both the gateway and the registration center are communicatively connected to the application server. The application server deploys application services and proxy services bound to the application services. It should be noted that in this embodiment, the monitoring service deployed on the monitoring server executes the service anomaly monitoring method. The monitoring service and the application service are deployed separately on different servers, thereby facilitating remote monitoring and data collection of the application services while avoiding the problem of application service unrecoverability. Furthermore, the application services include process services, document services, etc., and different application services may have multiple different IP addresses. Information from the registration center is periodically synchronized to the gateway and application services; details are not elaborated here. The method may include, but is not limited to, the following steps:

[0037] S1. Periodically poll the application services in the application server, and determine that the current application service is abnormal when the current application service fails n times consecutively. Specifically, in this embodiment, the monitoring server checks the application service every 30 seconds, where n is an integer greater than or equal to 1. In this embodiment, n is 3, meaning that the application service is determined to be abnormal when it fails 3 times consecutively.

[0038] Specifically, in this embodiment, the application service is embedded with a login-free health check interface. When the monitoring server periodically polls the application service in the application server, it performs anomaly detection on the application server through the health check interface.

[0039] In this embodiment, polling the application services in the application server includes:

[0040] An anomaly detection request is sent to the application service through the health check interface. This allows the health check interface to check the basic information of the current application service, obtain detection results based on the basic information, and then send the detection results back to the monitoring server. The basic information includes the service name and IP address of the current application service, and the detection results include a normal status identifier code or an abnormal status identifier code. Application service anomaly detection rules can be determined according to user needs, such as changes to certain fixed information in the basic information; these are not restricted here.

[0041] Specifically, in this embodiment, the health check interface is an HTTP request interface that responds to external requests. It is embedded in all application services as public code so that all application service programs can use it. This health check interface operates without requiring login. When the monitoring server sends a detection request (e.g., an HTTP GET request) to an application service, the health check interface checks basic information such as the name of the current application service, the port it uses on the server, and the application service's own IP address. It then returns the detection result to the request sender. If the application service is running normally, the health check interface returns a normal status code (e.g., a 200 status code) to indicate that the application service is operating normally. If the application service is abnormal, it does not return a result or returns an abnormal status code (e.g., a code other than 200) to indicate that the application service has malfunctioned.

[0042] S2. Send service shutdown instructions to both the gateway and the registration center, so that the gateway and the registration center can respectively perform shutdown operations on the current application service, and send shutdown success information back to the monitoring server after successful shutdown; wherein, the service shutdown instruction includes the service name and IP (Internet Protocol) address information of the current application service. For example, the service name of the current application service to be shut down is: Process Service, and the IP address information is: IP3.

[0043] In this embodiment, the gateway itself maintains the following information:

[0044]

[0045] After receiving the service offline instruction, the gateway removes IP3 from the process service corresponding list [IP1, IP2, IP3], that is, it performs an offline operation on the process service with IP address information IP3. At this time, subsequent business requests will not be sent to the process service node located at IP3.

[0046] Meanwhile, the registry center maintains the same information as the gateway, and the process for the registry center to take the current application service offline is the same as that for the gateway.

[0047] In this embodiment, the application server also deploys other application services that call the current application service; after determining that the current application service is abnormal, the method further includes:

[0048] A service shutdown command is sent to the other application services so that they can shut down the current application service. It should be noted that the other application services also maintain information related to the current application service, as shown in the following example:

[0049]

[0050] It should be noted that when other application services receive a service shutdown instruction, they will also remove the IP3 associated with the current application service. At this time, subsequent business requests from other application services will not be transmitted to the current application service corresponding to IP3.

[0051] In this embodiment, after the proxy service restarts the current application service, the method further includes:

[0052] The registry center broadcasts the updated information of the current service to other services, so that the other services can re-invoke the current service.

[0053] S3. Send a service restart command to the proxy service in the application server so that the proxy service can terminate all processes of the current application service, that is, kill the process of the target service node, and then restart the current application service; wherein, the service restart command includes the service name and IP address information of the current application service.

[0054] It should be noted that in the prior art, after the registration center takes an application service offline, the application server cannot detect the offline application service in real time because it only periodically retrieves information about the relevant online services from the registration center. In this embodiment, in order to improve the real-time detection of the application server, the registration information of each application service in the application server, including the service name and IP address, is updated before the registration center, instead of waiting for the registration center to synchronize. This allows the application server to detect the application service that has been taken offline by the registration center in real time.

[0055] In this embodiment, after the proxy service restarts the current application service, the current application service proactively sends its service information to the registration center, so that the registration center can synchronize the service information to the gateway and other application services. The service information includes the service name and IP address of the current application service. It should be noted that, based on the application service's own startup mechanism, the application service does not require additional control during startup to send its own service information to the registration center, and the registration center will also proactively synchronize this service information to the gateway and other application services that need to call the current application service.

[0056] In this process, based on the above procedures, the gateway and registry center can re-launch the current application service after it starts, thereby achieving a smooth switch of the application service.

[0057] In this embodiment, the monitoring server is also communicatively connected to a management terminal; after determining that the application service is abnormal, the method further includes:

[0058] S4. Send a service error notification to the management terminal. Specifically, in this embodiment, the service error notification is sent to the administrator of the management terminal via SMS, WeChat, or other messaging software, so that the administrator is aware of the service error and that the service will be restarted soon.

[0059] This embodiment enables anomaly detection and automatic recovery of application services, seamlessly integrating the process without user awareness, thus improving user experience. Specifically, this embodiment monitors the abnormal state of application services via a monitoring server. Upon detecting an anomaly, it controls the gateway and registry center to restart the current application service and terminates all processes of the application service on the application server before restarting it. During this process, since information from the registry center is periodically synchronized to the gateway and application service, simply removing this information from the registry center would introduce a delay. Even after the current application service is taken offline from the registry center, requests might still be sent to the already abnormal application service. Therefore, this embodiment simultaneously sends a service offline command to the gateway, ensuring that taking the current application service offline immediately cuts off requests to it. This prevents front-end users from sending requests to the abnormal application service, reducing user awareness of application service downtime and improving user experience. Furthermore, this embodiment achieves service anomaly monitoring without relying on container technology, enabling automated operation and maintenance of non-containerized systems, reducing labor costs. It also provides an additional service anomaly monitoring solution for containerized systems.

[0060] Example 2:

[0061] This embodiment discloses a service anomaly monitoring system, such as... Figure 2 As shown, the system includes a monitoring server, an application server, a gateway, and a registration center. The application server, gateway, and registration center are all communicatively connected to the monitoring server. The gateway and registration center are both communicatively connected to the application server. The application server deploys application services and proxy services bound to the application services. The monitoring server is used to execute the service anomaly monitoring method as described in Example 1.

[0062] Example 3:

[0063] This embodiment discloses a service anomaly monitoring device for implementing the service anomaly monitoring method in Embodiment 1; such as Figure 3 As shown, the service anomaly monitoring device includes:

[0064] The detection module is used to periodically poll the application services in the application server, and determine that the current application service is abnormal when the current application service is abnormal n times in a row.

[0065] A service offline control module, communicatively connected to the detection module, is used to initiate service offline commands to both the gateway and the registration center, so that the gateway and the registration center can respectively perform offline operations on the current application service, and send offline success information back to the monitoring server after successful offline operation; wherein, the service offline command includes the service name and IP address information of the current application service;

[0066] The service restart module is communicatively connected to the service offline control module and is used to initiate a service restart command to the proxy service in the application server, so that the proxy service terminates all processes of the current application service and then restarts the current application service; wherein, the service restart command includes the service name and IP address information of the current application service.

[0067] Example 4:

[0068] Based on any one of embodiments 1 to 3, this embodiment discloses an electronic device, which may be a smartphone, tablet computer, laptop computer, or desktop computer, etc. The electronic device may be referred to as a terminal, portable terminal, desktop terminal, etc., and includes:

[0069] Memory, used to store computer program instructions; and,

[0070] A processor is configured to execute the computer program instructions to perform the operation of the service anomaly monitoring method as described in any of Embodiment 1.

[0071] Example 5:

[0072] Based on any one of the embodiments 1 to 4, this embodiment discloses a computer-readable storage medium for storing computer-readable computer program instructions, which are configured to perform operations as described in the service anomaly monitoring method in embodiment 1 at runtime.

[0073] Obviously, those skilled in the art will understand that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device, or fabricating them separately as individual integrated circuit modules, or fabricating multiple modules or steps as a single integrated circuit module. Thus, the present invention is not limited to any particular hardware and software combination.

[0074] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. These modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

[0075] Finally, it should be noted that the above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A service anomaly monitoring method, characterized in that: The method is executed based on a monitoring server, which is communicatively connected to an application server, a gateway, and a registration center. Both the gateway and the registration center are communicatively connected to the application server. The application server deploys application services and proxy services bound to those application services. The application services in the application server are periodically polled, and if the current application service fails n times consecutively, it is determined that the current application service has failed. A service shutdown command is sent to both the gateway and the registration center, so that the gateway and the registration center can respectively shut down the current application service and send a shutdown success message to the monitoring server after successful shutdown; wherein, the service shutdown command includes the service name and IP address information of the current application service; A service restart command is sent to the proxy service in the application server so that the proxy service can terminate all processes of the current application service and then restart the current application service; wherein, the service restart command includes the service name and IP address information of the current application service; The application service is embedded with a login-free health check interface. When the monitoring server periodically polls the application service in the application server, it performs anomaly detection on the application server through the health check interface. Polling the application services in the application server includes: The health check interface sends an anomaly detection request to the application service so that the health check interface can check the basic information of the current application service, obtain the detection result based on the basic information, and then feed the detection result back to the monitoring server; wherein, the basic information includes the service name and IP address information of the current application service, and the detection result includes a normal status identifier code or an abnormal status identifier code; The application server also deploys other application services that call the current application service; after determining that the current application service is abnormal, the method further includes: Send a service shutdown command to the other application services so that the other application services can shut down the current application service.

2. The service anomaly monitoring method according to claim 1, characterized in that: The monitoring server is also communicatively connected to a management terminal; after determining that the application service is abnormal, the method further includes: Send a service error message to the management terminal.

3. The service anomaly monitoring method according to claim 1, characterized in that: After the proxy service restarts the current application service, the current application service actively sends its service information to the registration center so that the registration center can synchronize the service information to the gateway; wherein, the service information includes the service name and IP address information of the current application service.

4. A service anomaly monitoring system, characterized in that: The system includes a monitoring server, an application server, a gateway, and a registration center. The application server, gateway, and registration center are all communicatively connected to the monitoring server. The gateway and registration center are both communicatively connected to the application server. The application server deploys an application service and a proxy service bound to the application service. The monitoring server is used to execute the service anomaly monitoring method as described in any one of claims 1 to 3.

5. A service anomaly monitoring device, characterized in that: Used to implement the service anomaly monitoring method as described in any one of claims 1 to 3; The service anomaly monitoring device includes: The detection module is used to periodically poll the application services in the application server, and determine that the current application service is abnormal when the current application service is abnormal n times in a row. A service offline control module, communicatively connected to the detection module, is used to initiate service offline commands to both the gateway and the registration center, so that the gateway and the registration center can respectively perform offline operations on the current application service, and send offline success information back to the monitoring server after successful offline operation; wherein, the service offline command includes the service name and IP address information of the current application service; The service restart module is communicatively connected to the service offline control module and is used to initiate a service restart command to the proxy service in the application server, so that the proxy service terminates all processes of the current application service and then restarts the current application service; wherein, the service restart command includes the service name and IP address information of the current application service.

6. An electronic device, characterized in that: include: Memory is used to store computer program instructions; as well as, A processor for executing the computer program instructions to perform the operation of the service anomaly monitoring method as described in any one of claims 1 to 3.

7. A computer-readable storage medium for storing computer-readable computer program instructions, characterized in that: The computer program instructions are configured to perform the operation of the service anomaly monitoring method as described in any one of claims 1 to 3 at runtime.

Citation Information

Patent Citations

  • A micro-service monitoring method and system

    CN109873736A

  • Micro-service automatic put-out-of-service method and device, computer equipment and storage medium

    CN111176873A