Device health check method, service system, load balancing device and readable storage medium
By adaptively adjusting the health check response time in the load balancing system, combining equipment performance information and historical data, the problem of misjudgment of health check results in the prior art is solved, and the accuracy of health checks is improved.
Patent Information
- Application Number
- CN202510223511.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-27
- Publication Date
- 2025-04-04
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In existing load balancing systems, a fixed response time health check method is likely to lead to misjudgment of health check results in complex computer systems, especially when the system load is high or resources are tight.
By obtaining the current response time and device performance information of the target device, the allowable delay time of the health check response is determined, and the health check results of the target device are comprehensively determined based on the response time, allowable delay time and historical response time information.
Adaptive control of health check response time is achieved, the accuracy of health check results is improved, and misjudgment is avoided.
Smart Images

Figure CN119759725A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of load balancing, and in particular to a device health check method, a service system, a load balancing device, and a readable storage medium. Background Art
[0002] With the rapid development of information technology, computer systems have gradually evolved from simple stand-alone structures to complex distributed architectures. For this large and complex distributed architecture, a load balancing system can be deployed to evenly distribute request traffic to different target devices, thereby providing more complex and high-quality service functions.
[0003] In the load balancing system, the health check function is one of the core functions. Through the health check function, it can be monitored whether the target device in the corresponding computer system can provide services normally. At present, the relevant technical solutions provide a health check method with a fixed response time, which will expose many problems when facing complex computer systems, especially the health check results may be seriously misjudged. Summary of the invention
[0004] In view of the problems mentioned in the above background technology, multiple aspects of the present application provide a device health check method, service system, load balancing device and readable storage medium that solve the above problems or at least partially solve the above problems.
[0005] In a first aspect, the present application provides a device health check method. The method comprises: Get the current response time of health check on the target device; Determine the current allowable delay time of the health check response according to the current device performance information of the target device; A health check result of the target device is determined based on the allowed delay time, the response time, and historical response time information of the health check of the target device.
[0006] In a second aspect, the present application provides a service system. The system includes: Target device, used to provide corresponding network services; A health check device is used to implement the steps in the device health check method provided in the first aspect of the present application.
[0007] In a third aspect, the present application provides a load balancing device. The load balancing device includes: a memory and a processor, wherein the memory is used to store one or more computer programs; the processor is coupled to the memory and is used to execute the one or more computer programs stored in the memory to implement the steps in the device health check method provided in the first aspect of the present application.
[0008] In a fourth aspect, the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a computer, it can implement the steps in the device health check method provided by the present application in the first aspect.
[0009] The technical solutions provided by the embodiments of the present application, after obtaining the current response time of the health check on the target device and determining the current allowable delay time of the health check response according to the current device performance information of the target device, comprehensively determine the health check result of the target device based on the allowable delay time, the current response time of the health check on the target device, and the historical response time information of the health check of the target device. It can be seen that the solution of the present application realizes a health check method that supports adaptive control of the response time, which is conducive to improving the accuracy of the health check results and avoiding misjudgment. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following is a brief introduction to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0011] Figure 1 A schematic diagram of a device health check method provided in an embodiment of the present application; Figure 2 A schematic diagram of the structure of a service system provided in one embodiment of the present application; Figure 3 A schematic diagram of a process for a health check device in a service system according to an embodiment of the present application to actively perform a health check on a target device that needs to be checked. DETAILED DESCRIPTION
[0012] With the rapid development of information technology, computer systems have gradually evolved from simple single-machine structures to complex multi-machine structures, such as complex distributed systems, cloud computing environments, and microservice architectures. In early single-machine systems, the system was relatively simple, with limited functions, and the management of system resources and fault detection were relatively straightforward. However, today's large distributed systems may contain thousands of servers, virtual machines, containers, and a large number of software services that work together to provide complex business functions. In practical applications, load balancing systems are often deployed in complex computer systems to achieve balanced distribution of request traffic to different servers for processing, thereby providing users with better services. In a load balancing system, the health detection function is one of the core functions. Through the health check function, it is possible to monitor whether each server in the corresponding computer system can provide services normally, so as to ensure that the request traffic can be forwarded to the server that can provide services normally, thereby providing stable business functions.
[0013] At present, the relevant technical solutions include a traditional health check method with a fixed time response. This traditional health check method exposes many problems when facing complex systems, especially the health check results may be inaccurate and contain serious misjudgments.
[0014] For example, the implementation process of an existing health check solution with a fixed time response is as follows: after obtaining the health status change of the backend server, when the backend server (Real Server, RS) is perceived to have a reported status change, the currently generated report change information will be synchronized to the RS status management module, and it will be determined whether the next check interval has arrived, and then the next check interval will be updated in real time according to the preset interval check cycle algorithm to dynamically adjust the check interval, so as to determine whether to perform the detection action at the moment based on the current health status information of the backend server and the updated check interval information, and dynamically adjust the check interval based on the current backend server's own state feedback and the historical results of active health checks to determine the time point for sending the next detection request. Although the above existing health check solution can alleviate the detection pressure of the load balancer and the backend server to a certain extent, and can detect the change of state in time, the above solution of dynamically adjusting the check interval based on the feedback and historical results of the active health check's own state does not consider the adjustment of the response time, which may easily lead to misjudgment of the health check results.
[0015] In addition, when system resources are tight (such as high CPU usage, memory usage, network bandwidth usage, etc.), the traditional health check solution does not take into account the adjustment of response time, which may cause the system to be misjudged as unhealthy due to the inability to respond to health check requests in time. For example, during a shopping carnival, an e-commerce website's corresponding server needs to process a large number of user orders and page requests. At this time, the system load is extremely high. If the health check is still performed according to the usual short time interval and fast response requirements, it may interfere with the normal business processing of the system. And due to the tight system resources, the health check may misjudge the system as unhealthy due to the lack of timely response.
[0016] In order to solve the problems existing in the above-mentioned traditional health detection schemes, the present application provides a new health detection scheme that supports adaptive control of the health detection response time. Specifically, during the system health detection process, the present application scheme can automatically adjust the response time of the detection operation according to factors such as the current state of the system, the load situation, and the complexity of the detection. For example, in a health check of a network service, when the system load is low, the health check can be completed and the results can be fed back in a shorter time; when the system is under high load, the response time can be appropriately extended to avoid adding too much burden to the system or obtaining inaccurate detection results.
[0017] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0018] In some processes described in the specification, claims and the above-mentioned figures of this application, multiple operations appearing in a specific order are included, and these operations may not be executed or executed in parallel in the order in which they appear in this article. The serial numbers of the operations, such as 101, 102, etc., are only used to distinguish different operations, and the serial numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel. It should be noted that the descriptions of "first", "second", etc. in this article are used to distinguish different messages, devices, modules, etc., and do not represent the order of precedence, nor do they limit "first" and "second" to different types. The term "or / and" in this application is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example: A or / and B, indicating that A can exist alone, A and B can exist at the same time, and B can exist alone; the character " / " in this application generally indicates that the front and back associated objects are an "or" relationship. It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a product or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such product or system. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the product or system including the elements. In addition, the following embodiments are only some embodiments of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application.
[0019] The data processing technical solutions provided in each embodiment of the present application are described in detail below.
[0020] Figure 1 A flow chart of a device health check method provided by an embodiment of the present application is shown. The method is applied to a health check device in a service system, and the health check device may be a load balancing device therein, such as a load balancer, and the load balancer may be software (such as an LVS virtual server) or hardware (such as a computer specially configured for load balancing), etc. Among them, the above-mentioned service system may be, but is not limited to, a complex computer system such as a distributed system, a cloud service system (such as a cloud computing system), and a microservice system. In addition to the deployed load balancing device, the service system may also include other types of devices, such as at least one host device, and the host device is a target device that needs to be checked (such as a back-end server, hereinafter referred to as a server). The solution provided by the present application mainly uses the load device to perform a health check on the target device that needs to be checked in the corresponding service system.
[0021] See Figure 1 As shown, the device health check method provided in the embodiment of the present application includes the following steps: 101. Get the current response time of the health check on the target device; 102. Determine an allowable delay time for a health check response according to current device performance information of the target device; 103. Determine a health check result of the target device based on the allowed delay time, the response time, and historical response information of the health check of the target device.
[0022] In the above 101, the health check of the target device can be specifically implemented by a health check module in the health check device, and the health check module is configured to perform an active health check on the target device. In specific implementation, the health check module can, but is not limited to, use TCP (Transmission Control Protocol) to perform a health check on the target device. That is, the health check device can perform a health check by a three-way handshake with the target device. In the process of performing a health check on the target device using the above-mentioned TCP communication protocol, the health check module in the health check device sends a request message such as a TCP SYN message to the target device, and waits for a response from the target device. After the target device receives the TCP SYN message, it will normally return a corresponding response message (that is, a response message, such as a SYN+ACK message).
[0023] As mentioned above, in this application, the response time refers to the time interval from when the health check device sends a request message, such as a TCP SYN message, to the corresponding target device, to when it receives a response message returned by the target device to the request.
[0024] like Figure 2 The health check device structure shown in the figure, in addition to the aforementioned health check module, the health check device may also have other modules such as a computing module. The computing module includes a first computing module, a second computing module and a comprehensive computing module. The first computing module is used to implement the above step 102, and the second computing module is used to implement the calculation of the average value of the health check response time of the target device within a period described later. The comprehensive computing module is used to combine the output results of the health check module, the first computing module and the second computing module to finally determine the output health check result.
[0025] In specific implementation, when the health check device implements the above step 102 through the second computing module therein, it can first detect the current relevant device performance information of the target device based on the snmp oid, such as processor usage information, memory usage information, etc., and then determine the allowable delay time of the health check response in the current cycle based on the detected device performance information. Among them, the oid (object identifier) in the above snmp (simple network management protocol) is a string used to identify management objects, and these management objects represent specific performance information on the corresponding device, such as interface status, CPU usage, etc.
[0026] Based on the above content, before executing the above step 102, the method provided in the embodiment of the present application may further include the following steps: S21 . Detect the current device performance information of the target device based on a management protocol to trigger execution of step 102 .
[0027] The management protocol described herein may be, but is not limited to, the aforementioned SNMP protocol. The detected current device performance information of the target device includes processor usage information, and the processor usage information may include processor usage rate. The processor in the target device may be, but is not limited to, a central processing unit (CPU).
[0028] Preferably, the present application determines the allowable delay time of the health check response in the current cycle based on the current processor usage of the target device. And the allowable delay time determined here can be understood as: the average response time difference value allowed by the current health check, that is, the average delay degree allowed by the current health check response.
[0029] For example, when the CPU usage of the target device is in the range of 0~20% (including 20%), the allowed average delay degree may be a first time value, such as 3s; when the CPU usage is in the range of 20% (excluding 20%)~50% (including 50%), the allowed average delay degree may be a second time value, such as 6s; when the CPU usage is in the range of 50% (excluding 50%)~80% (including 80%), the allowed average delay degree may be a third time value, such as 10s; and so on.
[0030] With the above example, in a specific implementation scheme, a corresponding relationship table between the processor usage rate and the allowed delay time can be established in advance, and then the corresponding allowed delay time can be determined according to the current processor usage rate of the detected target device by looking up the table. Of course, other implementation schemes can also be adopted, such as establishing a functional expression relationship between the CPU usage rate and the allowed delay time based on a large amount of experimental test data analysis, and then determining the corresponding allowed time according to the current processor usage rate of the detected target device based on the functional expression relationship, etc.
[0031] In the present application, when the active health check of the target device is implemented through the load balancing device, a preset time period (such as 300s) is used as a check cycle, and in each cycle, the load balancing device performs a health check on the target device at a set time interval (such as 5s, 10s or 30s, etc.). Based on this, when executing the above step 103, the health check device can first calculate the average value of the health check response time of the target device in a cycle based on the historical response time information of the health check of the target device through the second calculation module therein, and then combine the average value, the response time of the current health check of the target device, and the allowed delay time to finally determine the health detection result of the target device.
[0032] That is, in an implementable solution, the above 103 “determining the health check result of the target device based on the allowed delay time, the response time and the historical response time information of the health check of the target device” may include: 1031. Determine an average value of the health check response time of the target device within a period based on the historical response time information of the health check of the target device; 1032. Determine a health detection result of the target device based on the allowed delay time, the response time, and the average value.
[0033] A specific implementation of the above step 1031 may include: determining the average value based on the response time information of the health check of the target device within a set time period before the current time.
[0034] For example, suppose the current time is t o , you can take the time within 300s from the current time (that is, take t o -300s to t o The target device health check response time information of the target device within this period is used to calculate the average target device health check response time within a period.
[0035] In the above 1032, if the difference between the response time and the average value is greater than the allowed delay time, it is determined that the current health check has failed. It is understandable that the failure of the health check can indicate that the result of the current health check is unhealthy (i.e., the target device is in an abnormal service state). If the difference between the response time and the average value is less than or equal to the allowed delay time, it is determined that the current health check has succeeded. It is understandable that the success of the health check can indicate that the result of the current health check is healthy (i.e., the target device is in a normal service state).
[0036] For example, assuming that the response time for the current health check on the target device is 10s, and the calculated average value of the target device health check response time within a cycle is 5s, and the allowable response time delay (i.e., the allowable delay time) within the current cycle is 3s, then: the difference between the above response time and the average value is 5s (greater than 3s), which is not within the allowable error range (i.e., not within the allowable response time delay range), and thus the current health check is determined to have failed, that is, the current health check result is an abnormal service status.
[0037] For the above example, further, if the health check fails for several consecutive times (such as 3 times), it can be directly determined that the target device is unavailable. Specifically, for example, it can be determined that the target device is in an unavailable state during the current cycle or during the time period of several consecutive health checks.
[0038] Based on the above example content, the method provided in the embodiment of the present application may also include the following steps: 104. Determine a health output result of the target device according to a plurality of consecutive health check results of the target device; If a set number of consecutive health check results are abnormal service status, the health output result is unavailable status. The set number may be 3, 4, 5, etc.
[0039] In summary, the technical solution provided by the embodiment of the present application, after obtaining the current response time of the health check on the target device and determining the current allowable delay time of the health check response according to the current device performance information of the target device, comprehensively determines the health check result of the target device based on the allowable delay time, the current response time of the health check on the target device, and the historical response time information of the health check of the target device. It can be seen that the solution of the present application realizes a health check method that supports adaptive control of the response time, which is conducive to improving the accuracy of the health check results and avoiding misjudgment.
[0040] The health check solution provided in the above embodiment of the present application can be briefly described as follows: See Figure 3 As shown, the implementation principle of health check through health check equipment (such as load balancing equipment) is: according to the CPU usage of the real host (target device), the corresponding average response time difference value (that is, the aforementioned allowable delay time and the allowable average delay difference degree) is calculated and determined, and the average value of the health check response time of the target device within a cycle and the response time of the health check of the target device are combined to comprehensively judge the health check result of the target device (the service status of the target device, such as normal service status and abnormal service status).
[0041] The health check device (such as a load balancing device) is configured to actively perform health checks on the devices that need to be checked, and the health check cycle is set to be 300 seconds. The health check implementation process includes the following steps: 1) Calculate the average health check response time within a cycle. The average health check response time within a cycle can be calculated by taking the health check response time results within 300 seconds from the current time point to calculate the average.
[0042] 2) Detect the CPU usage of the real host to determine the average delay difference allowed (i.e., the allowed delay time) based on the CPU usage. For example, when the CPU usage is 20%, the allowed average delay is 3s; when the CPU usage is 50%, the allowed average delay is 6s; when the CPU usage is 80%, the allowed average delay is 10s.
[0043] 3) Determine whether the response time meets expectations and determine the health check results.
[0044] For example, assuming that the response time of this health check is 10s, the average value of the health check response time in one cycle is 5s, and the average delay allowed is 3s, then the response time of this health check is not within the error range, so the health check is judged to have failed, that is, the health check result is an abnormal service status. If the health check fails for three consecutive times, the real host can be considered unavailable.
[0045] An embodiment of the present application also provides a service system. Figure 2 As shown, the service system includes a target device and a health check device. Among them, the health check device is used to implement the method embodiment provided by the present application. For detailed descriptions of the form and structure of the target device and the health check device, and the specific implementation of the corresponding functions, please refer to the relevant contents in other embodiments, which will not be repeated here.
[0046] In one scenario, the health check device is a load balancing device. Based on this, an embodiment of the present application further provides a load balancing device, which includes a memory and a processor. The memory is used to store one or more computer instructions, and the processor is coupled to the memory for one or more computer instructions (such as computer instructions for implementing data storage logic) to implement the above Figure 1 The steps in the device health check method embodiment are shown.
[0047] The above-mentioned memory can be implemented by any type of volatile or non-volatile memory device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0048] Further, see Figure 2 or Figure 3 As shown, the processor may include a health check module, a computing module (including a first computing module, a second computing module and a comprehensive computing module), etc. For detailed descriptions of the functions of each module / module included in the processor, please refer to the relevant contents in other embodiments, and no further details will be given here.
[0049] Furthermore, in some other implementations, if the load balancing device is hardware (such as a computer specially configured for load balancing), the load balancing device also includes other components such as a communication component, a power component, and an audio component. Figure 2 3 only schematically shows some components of the load balancing device, which does not mean that the load balancing device only includes Figure 2 or Figure 3 Components shown in .
[0050] Another embodiment of the present application provides a computer program product (no corresponding figure is shown in the drawings of the specification). The computer program product includes a computer program or instructions. When the computer program or instructions are executed by a processor, the processor is enabled to implement the steps of the device health check method provided in other embodiments of the present application.
[0051] Accordingly, an embodiment of the present application further provides a computer-readable storage medium storing a computer program, and when the computer program is executed by a computer, the steps or functions in the roaming processing method provided in the above embodiments can be implemented.
[0052] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a target device, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0053] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A device health check method, characterized in that: include: Get the current response time of health check on the target device; Determine the current allowable delay time of the health check response according to the current device performance information of the target device; A health check result of the target device is determined based on the allowed delay time, the response time, and historical response time information of the health check of the target device.
2. The method according to claim 1, characterized in that Determining a health check result of the target device based on the allowed delay time, the response time, and historical response time information of the health check of the target device includes: Based on the historical response time information of the health check of the target device, determine the average value of the health check response time of the target device within a period; The health check result is determined based on the allowed delay time, the response time and the average value.
3. The method according to claim 2, characterized in that Determining an average value of the health check response time of the target device within a period based on the historical response time information of the health check of the target device includes: The average value is determined based on the response time information of the health check of the target device within a set time period before the current time.
4. The method according to claim 2, characterized in that: Determining a health check result of the target device based on the allowed delay time, the response time, and the average value includes: If the difference between the response time and the average value is greater than the allowed delay time, the health check result is an abnormal service status; If the difference between the response time and the average value is less than or equal to the allowed delay time, the health check result is a normal service status.
5. The method according to any one of claims 1 to 4, characterized in that Also includes: Determining a health output result of the target device according to a plurality of consecutive health check results of the target device; If a set number of consecutive health check results are abnormal service status, the health output result is unavailable.
6. The method according to any one of claims 1 to 4, characterized in that Also includes: Detecting the current device performance information of the target device based on a management protocol to trigger the execution of determining the current allowable delay time of the health check response according to the device performance information; The management protocol includes a simple network management protocol (SNMP), the device performance information includes processor usage information, and the processor usage information includes a usage rate.
7. A service system, characterized in that: include: Target device, used to provide corresponding network services; A health check device, used to implement the method described in any one of claims 1 to 6.
8. The system according to claim 7, characterized in that The health check device is a load balancing device, and the target device is a server.
9. A load balancing device, characterized in that: include: A memory and a processor, wherein The memory is used to store one or more computer programs; The processor, coupled to the memory, is configured to execute the one or more computer programs stored in the memory to implement the method according to any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a computer, the method according to any one of claims 1 to 6 can be implemented.
Citation Information
Patent Citations
Block chain cross-chain system test method and device, equipment and storage medium
CN115454819A
Isolation method and device for sub-health nodes in storage cluster and electronic equipment
CN117221091A