Detection method, device, equipment and readable storage medium

By introducing an unstable factor in the load balancing server and dynamically adjusting the success threshold, the state switching problem when the business server is unstable is solved, the task success rate and reliability are improved, and the service time of the unstable server is reduced.

CN113934610BActive Publication Date: 2025-10-03CHINANETCENT TECH
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111040551.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-06
Publication Date
2025-10-03
Estimated Expiration
2041-09-06

AI Technical Summary

Technical Problem

In the prior art, when a load balancing server detects that a service server is unstable, there is a problem that the service server cannot correctly execute tasks during a window period, and cannot switch its state to an unavailable state in time.

Method used

By introducing an unstable factor in the load balancing server, dynamically adjusting the success threshold, and extending the unavailable time of the business server, we can ensure that tasks are assigned to stable servers and reduce the service time of unstable servers.

Benefits of technology

It improves the success rate and reliability of tasks, reduces the service time of unstable servers, avoids task allocation failures, and reduces the need for repeated caching.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113934610B_ABST
    Figure CN113934610B_ABST
Patent Text Reader

Abstract

The present application discloses a detection method, apparatus, device and readable storage medium. After each detection of a service server, the load balancing server determines the instability factor, determines the stability of the service server based on the instability factor, and then determines the success threshold value of the current detection based on the stability. Finally, it is determined whether the service server is available after this detection based on the detection result and the success threshold value of this detection. In this process, the success threshold value is calculated after each detection, so that the success threshold value is not a fixed value, but a dynamically changing value. The larger the success threshold value, the lower the probability of state switching when the service server is unstable, that is, the length of time the service server is in an unavailable state is extended, so that new tasks are assigned to other service servers, thereby improving the quality of tasks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of server technology, and in particular to a detection method, apparatus, device, and readable storage medium. Background Art

[0002] Currently, servers, with their enormous computing and storage capabilities, are able to provide services to multiple terminal devices connected via the network. Servers are also called business servers, background servers, back-end servers, etc.

[0003] When a large number of users access the same service server through terminal devices, it may cause the service server to run slowly or even crash. To this end, the load balancing server performs service detection on the service server. If the detection fails a certain number of times in a row, the service server is placed in an unavailable state. If the detection succeeds a certain number of times in a row, the service server is placed in an available state, and new tasks are subsequently assigned to the available server.

[0004] In the above solution, a service server is declared unavailable only after a certain number of consecutive detection failures, each of which results in a failure. If a service server is in an available state and then experiences instability and crashes, there is a window between the start of the crash and when the service server is declared unavailable. During this window, the service server is unable to provide services but is still marked as available. If new tasks are assigned to this service server, it will be unable to execute them correctly. Summary of the Invention

[0005] The embodiments of the present application provide a detection method, apparatus, device and readable storage medium, which extend the unavailable time of a business server when the business server is unstable, so that new tasks can be assigned to other business servers, thereby improving task quality.

[0006] In a first aspect, an embodiment of the present application provides a detection method applied to a load balancing server, the method comprising:

[0007] After performing the i-th detection on the service server, determining an instability factor, where the instability factor is used to indicate the degree of instability of the service server;

[0008] determining the stability of the service server according to the instability factor;

[0009] determining a success threshold value of the i-th detection based on the stability, wherein the success threshold value of the i-th detection is used to indicate a minimum number of consecutive successful detections if the service server is switched from an unavailable state to an available state, wherein the consecutive detections include the i-th detection;

[0010] Whether the service server is available after the i-th detection is determined according to the detection result of the i-th detection and the success threshold value of the i-th detection.

[0011] In a second aspect, an embodiment of the present application provides a detection device, comprising:

[0012] A first determining module is configured to determine an instability factor after performing an i-th detection on the service server, where the instability factor is used to indicate a degree of instability of the service server;

[0013] A second determining module, configured to determine the stability of the service server according to the instability factor;

[0014] a third determining module, configured to determine a success threshold value of the i-th detection based on the stability, wherein the success threshold value of the i-th detection is used to indicate a minimum number of consecutive successful detections if the service server is switched from an unavailable state to an available state, wherein the consecutive detections include the i-th detection;

[0015] The fourth determining module is configured to determine whether the service server is available after the i-th detection according to the detection result of the i-th detection and the success threshold of the i-th detection.

[0016] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and runnable on the processor, wherein when the processor executes the computer program, the electronic device implements the method described in the first aspect or various possible implementation methods of the first aspect.

[0017] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed by a processor, they are used to implement the method described in the first aspect or various possible implementation methods of the first aspect.

[0018] In a fifth aspect, an embodiment of the present application provides a computer program product comprising a computing program, which, when executed by a processor, implements the method described in the first aspect or various possible implementations of the first aspect.

[0019] The detection method, apparatus, device, and readable storage medium provided by the embodiments of the present application determine the instability factor after each detection of a service server. Based on the instability factor, the load balancing server determines the stability of the service server, and then determines the success threshold of the current detection based on the stability. Finally, the service server is determined to be available after the current detection based on the detection result and the success threshold of the current detection. In this process, the success threshold is calculated after each detection, so that the success threshold is not a fixed value but a dynamically changing value. The larger the success threshold, the lower the probability of the service server switching state when it is unstable. This prolongs the period of time that the service server is unavailable, allowing new tasks to be assigned to other service servers and improving task quality. Furthermore, calculating the instability factor helps identify unstable service servers. Furthermore, the lower the probability of switching when a service server is unstable, which can reduce duplicate caching for tasks involving caching. Furthermore, the data involved in the embodiments of the present application still only represents the availability and unavailability of the service server, eliminating the need to collect other data. This means that no additional data is introduced and there is no dependency on other data in the cluster. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0021] Figure 1 Schematic diagram of the implementation environment of the detection method provided in the embodiment of the present application;

[0022] Figure 2 is a flow chart of the detection method provided in an embodiment of the present application;

[0023] Figure 3 This is a flow chart of determining the success threshold value of the i-th detection in the detection method provided in an embodiment of the present application;

[0024] Figure 4 This is a flow chart of storing and updating detection results in the detection method provided in an embodiment of the present application;

[0025] Figure 5 This is a flow chart of determining an instability factor in the detection method provided in an embodiment of the present application;

[0026] Figure 6 This is a flowchart of determining whether a service server is available in a detection method provided in an embodiment of the present application;

[0027] Figure 7This is another flow chart for determining whether a service server is available in the detection method provided in an embodiment of the present application;

[0028] Figure 8 A schematic diagram of a detection device provided in an embodiment of the present application;

[0029] Figure 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0030] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.

[0031] In order to prevent multiple terminal devices from accessing the same business server at the same time, which would cause the business server to be overloaded and paralyzed, the load balancing server decides whether to assign new tasks to the business server based on the real-time status of the business server, thereby balancing the tasks on each business server. The real-time status of the business server includes an available state or an unavailable state. The load balancing server determines the real-time status of the business server based on the detection results obtained by performing business detection on the business server. For example, for each business server, if the detection is performed a certain number of times in a row and each time the detection is successful, the business server is set to an available state. If the detection is performed a certain number of times in a row and each time the detection fails, the business server is set to an unavailable state. If a business server is in an unavailable state, it means that the business server is abnormal, and the load balancing server will no longer assign new tasks to the business server.

[0032] With the rapid development of the internet, simply assigning a service server an available or unavailable status based on the number of consecutive successful or failed probes presents a drawback: when a service server is unstable, it frequently switches states. However, since load balancing servers require a certain number of consecutive probes to switch service server states, each transition from available to unavailable state involves a window period. During this window, the service server is unable to provide services but is still marked as available. If new tasks are assigned to this service server, it will be unable to execute them correctly.

[0033] For example, if a service server is set to available and then goes down at 8:00, that means that although the service server is marked as available, it has actually been unavailable since 8:00. Assuming there are 6 consecutive probe failures and a probe cycle of 10 seconds, the load balancing server will conduct a probe every 10 seconds. If there are 6 consecutive probe failures and each one fails, the load balancing server will set the service server to unavailable at 8:01. However, from 8:00 to 8:01, the service server is still marked as available, causing the load balancing server to assign new tasks to the service server during this minute, causing the new tasks to fail. This 1-minute window is the aforementioned window period.

[0034] Based on this, the embodiments of the present application provide a detection method, apparatus, device and readable storage medium, which extend the unavailable time of the business server when the business server is unstable, so that new tasks can be assigned to other business servers, thereby improving task quality.

[0035] Figure 1 This is a schematic diagram of the implementation environment of the detection method provided in the embodiment of this application. Figure 1 The implementation environment includes a load balancing server 11, at least one service server 12, and a terminal device 13. The load balancing server 11 establishes a network connection with each service server 12 and also with the terminal device 13. After the terminal device 13 initiates an access request carrying a service identifier, the load balancing server 11 identifies a service server 12 from the at least one service server 12 that can provide the service indicated by the service identifier. It then identifies an available service server 12 and sends the access request to that service server 12, enabling the service server 12 to establish a network connection with the terminal device 13 and return service data to the terminal device 13.

[0036] The load balancing server 11 also continuously detects the service server 12, continuously adjusts the success threshold of the current detection according to the instability factor, and determines whether to switch the service server from an unavailable state to an available state according to the success threshold of the current detection.

[0037] The service server 12 has substantial computing and storage capabilities, and is capable of providing services to the terminal device 13. The service server 12 can be hardware or software. When the service server 12 is hardware, it can be a single server or a distributed server cluster consisting of multiple servers. When the service server 12 is software, it can be multiple software modules or a single software module, etc., and the embodiments of the present application are not limiting.

[0038] The terminal device 13 can be either hardware or software. When the terminal device 13 is hardware, it can be, for example, a mobile phone, tablet computer, personal computer, e-book reader, laptop computer, desktop computer, etc., installed with an Android operating system, Microsoft operating system, Symbian operating system, Linux operating system, or Apple iOS operating system. When the terminal device 13 is software, it can be installed in the hardware devices listed above. In this case, the terminal device 13 can be, for example, multiple software modules or a single software module, etc., and the embodiments of the present application are not limited thereto.

[0039] It should be understood that Figure 1 The number of load balancing servers 11, service servers 12, and terminal devices 13 is merely illustrative. In actual implementation, any number of load balancing servers 11, service servers 12, and terminal devices 13 may be deployed according to actual needs.

[0040] Below, based on Figure 1 The detection method provided by the embodiment of the present application is described in detail in the implementation environment shown. For example, please refer to Figure 2 .

[0041] Figure 2 This is a flow chart of the detection method provided by an embodiment of the present application. This embodiment is described from the perspective of a load balancing server. This embodiment includes:

[0042] 201. After performing the i-th detection on the service server, determine an instability factor, where the instability factor is used to indicate the degree of instability of the service server.

[0043] For example, the load balancing server periodically performs service detection on the service server, and after each detection, it is necessary to determine the instability factor. The detection period is, for example, 5 seconds (s), 10 seconds, etc., which is not limited in the embodiment of the present application.

[0044] The i-th probe refers to the current probe, the last probe in a series of consecutive probes. If only one probe has been performed, i = 1. If 20 consecutive probes have been performed, i = 20, indicating the 20th probe. The load balancing server generates a probe result after each probe, which indicates success or failure. For example, assuming the initial instability factor is 0 and the preset order is failure → success, "① success" indicates the first successful probe. The results of the 10 consecutive probes are as follows: ① success, ② success, ③ success, ④ success, ⑤ failure, ⑥ failure, ⑦ success, ⑧ failure, ⑨ success, ⑩ failure. When calculating the instability factor after the tenth probe, since the sixth and seventh probes, and the eighth and ninth probes all meet the preset order, the instability factor is 2. Although the results of the fourth and fifth probes, the seventh and eighth probes, and the ninth and tenth probes are opposite, they do not meet the preset order and therefore cannot be used to calculate the instability factor.

[0045] 202. Determine the stability of the service server according to the instability factor.

[0046] Stability indicates whether a service server is unstable or stable. Whether a service server is stable is not directly related to whether the service server is available. For example, if a service server is unstable, it does not mean that the service server is currently unavailable. Alternatively, if a service server is stable, it may mean that the service server is always available, or it may mean that the service server is always unavailable.

[0047] When determining the stability of a service server based on the instability factor, a threshold is pre-set. Each time the load balancing server calculates the instability factor, it compares it with the threshold. If the instability factor is greater than or equal to the threshold, the service server is unstable, resulting in frequent changes in detection results during continuous detection. If the instability factor is less than the threshold, the service server is stable, and the detection results are relatively stable during the detection process.

[0048] 203. Determine a success threshold for the i-th detection based on the stability, where the success threshold for the i-th detection is used to indicate a minimum number of successful consecutive detections required to switch the service server from an unavailable state to an available state, where the consecutive detections include the i-th detection.

[0049] In traditional methods, after each probe, the number of consecutive successful probes and the number of consecutive failed probes are calculated. If the probe is successful, the number of consecutive successful probes is compared with the success threshold. If the number of consecutive successful probes is greater than or equal to the success threshold, the service server is set to an available state. If the number of consecutive successful probes is less than the success threshold, the service server remains in its current state, which refers to the state of the service server before the probe, and can be either available or unavailable.

[0050] If the current detection fails, the number of consecutive detection failures is compared with the failure threshold. If the number of consecutive detection failures is greater than or equal to the failure threshold, the service server is placed in an unavailable state. If the number of consecutive detection failures is less than the failure threshold, the service continues in the current state.

[0051] In the above-mentioned traditional method, both the success threshold and the failure threshold are fixed.

[0052] In the embodiment of the present application, the failure threshold value is fixed, but the success threshold value is not fixed. After each detection, the load balancing server determines the instability factor, and then determines the stability of the business server based on the instability factor. Afterwards, the load balancing server determines the success threshold value of this detection based on the stability, that is, the success threshold value of the above-mentioned i-th detection. The success threshold value of the i-th detection is used to indicate: if the business server is in an unavailable state when the i-th detection is performed, then after the i-th detection is performed, the minimum number of consecutive successful detections including the i-th detection. Obviously, the success threshold value corresponding to each detection may change. By flexibly using the characteristics of the success threshold value, the purpose of determining the stability of the business server is achieved, and at the same time, the state switching of the business server is more accurate.

[0053] 204. Determine whether the service server is available after the i-th detection according to the detection result of the i-th detection and the success threshold of the i-th detection.

[0054] Exemplarily, if the i-th detection is successful, the load balancing server determines the number of consecutive successful detections based on the detection results before the i-th detection and the detection results of the i-th detection. The number of consecutive successful detections is compared with the success threshold value of the i-th detection. If the number of consecutive successful detections is greater than or equal to the success threshold value of the i-th detection, the service server is set to an available state; if the number of consecutive successful detections is less than the success threshold value of the i-th detection, the service server maintains its current state, which refers to the state of the service server before this detection, and can be either an available state or an unavailable state.

[0055] If the i-th detection fails, the load balancing server determines the number of consecutive detection failures based on the detection results before the i-th detection and the detection results of the i-th detection. It compares this number of consecutive detection failures with the failure threshold. If the number of consecutive detection failures is greater than or equal to the failure threshold, the service server is placed in an unavailable state. If the number of consecutive detection failures is less than the failure threshold, the service continues in its current state.

[0056] The detection method provided in the embodiment of the present application is that after each detection of the service server by the load balancing server, the instability factor is determined, the stability of the service server is determined based on the instability factor, and then the success threshold value of the current detection is determined based on the stability. Finally, whether the service server is available after this detection is determined based on the detection result and the success threshold value of this detection. In this process, the success threshold value is calculated after each detection, so that the success threshold value is not a fixed value, but a dynamically changing value. The larger the success threshold value, the lower the probability of state switching when the service server is unstable, that is, the length of time the service server is in an unavailable state is extended, so that new tasks are assigned to other service servers, improving the quality of tasks. Moreover, by calculating the instability factor, it is helpful to discover unstable service servers. At the same time, the probability of switching when the service server is unstable is relatively low, which can reduce duplicate caching for tasks involving caching. Furthermore, the data involved in the embodiment of the present application is still the availability and unavailability of the service server, and there is no need to collect other data, that is, no additional data is introduced, and there is no dependence on other data in the cluster.

[0057] Figure 3 This is a flow chart of determining the success threshold value of the i-th detection in the detection method provided in an embodiment of the present application. This embodiment includes:

[0058] 301. The load balancing server records the detection result of the i-th detection.

[0059] For example, after each detection of the service server, the load balancing server records the detection result. The detection result includes detection success, detection failure, etc. A detection success can be represented by "√", "0", etc., and a detection failure can be represented by "×", "1", etc.

[0060] 302. The load balancing server calculates the instability factor.

[0061] For example, the load balancing server determines the instability factor based on the detection results from the first detection to the i-th detection. In another example, considering accuracy, the load balancing server determines the instability factor based on the detection results of multiple detections performed within a preset time period, where the end time point of the preset time period is the time point corresponding to the i-th detection. For example, if the detection period is 10 seconds, the load balancing server determines the instability factor based on the detection results within 500 seconds, where the last detection within 500 seconds is the i-th detection. In another example, the load balancing server determines the instability factor based on the detection results of the most recent 30 detections, the last of which is the i-th detection.

[0062] 303. The load balancing server determines whether the instability factor is greater than or equal to the threshold. If the instability factor is greater than or equal to the threshold, step 304 is executed; if the instability factor is less than the threshold, step 308 is executed.

[0063] Exemplarily, a threshold is pre-set, such as 3, 5, etc., which is not limited in the embodiments of the present application. After the load balancing server determines the instability factor, it determines whether the instability factor is greater than or equal to the threshold. If the instability factor is greater than or equal to the threshold, it means that sometimes the detection is successful and sometimes it fails, and the detection result switches frequently. In other words, the business server is unstable. At this time, the load balancing server executes step 304. If the instability factor is less than the threshold, it means that the detection result is relatively stable, either always successful or always failed, and the detection result does not switch frequently. In other words, the business server is relatively stable. At this time, the load balancing server executes step 308.

[0064] 304. The load balancing server determines that the business server is unstable.

[0065] Exemplarily, the load balancing server labels the service server as unstable.

[0066] 305. The load balancing server determines whether the success threshold value of the i-1th detection is less than the preset upper limit value. If the success threshold value of the i-1th detection is less than the preset upper limit value, execute step 306; if the success threshold value of the i-1th detection is greater than or equal to the preset upper limit value, execute step 307.

[0067] 306 . The load balancing server increases the success threshold of the (i-1) th detection to obtain the success threshold of the i th detection, and then executes step 307 .

[0068] Exemplarily, an upper limit value and an initial value are pre-set for the success threshold, for example, the upper limit value is 12 and the initial value is 3. If the service server is unstable after the i-th detection and the success threshold value of the i-1-th detection is less than the upper limit value, then in this step, the load balancing server increases the success threshold value of the i-1-th detection to obtain the success threshold value of the i-th detection. For example, if the success threshold value of the i-1-th detection is 3 and the increment is 1, then the success threshold value of the i-th detection is 4. For another example, if the success threshold value of the i-1-th detection is 3 and the increment is 2, then the success threshold value of the i-th detection is 5.

[0069] 307. The load balancing server performs the (i+1)th detection.

[0070] 308. The load balancing server determines that the business server is stable.

[0071] Exemplarily, the load balancing server labels the business server as stable.

[0072] 309. The load balancing server determines whether the success threshold value of the i-1th detection is greater than the preset initial value. If the success threshold value of the i-1th detection is greater than the preset initial value, execute step 310; if the success threshold value of the i-1th detection is equal to the preset upper limit value, execute step 307.

[0073] 310 . The load balancing server reduces the success threshold of the (i-1) th detection to obtain the success threshold of the i th detection, and then executes step 307 .

[0074] Exemplarily, an upper limit value and an initial value are pre-set for the success threshold, for example, the upper limit value is 12 and the initial value is 3. If the service server is stable after the i-th detection and the success threshold value of the i-1-th detection is greater than the initial value, then in this step, the load balancing server reduces the success threshold value of the i-1-th detection to obtain the success threshold value of the i-th detection. For example, if the success threshold value of the i-1-th detection is 5 and the reduction is 1, then the success threshold value of the i-th detection is 4. For another example, if the success threshold value of the i-1-th detection is 5 and the reduction is 2, then the success threshold value of the i-th detection is 3.

[0075] With this solution, when a service server is unstable, the success threshold is increased after each detection, making it difficult for the service server to switch from an unavailable state to an available state. This prolongs the duration of the unavailable state, preventing the load balancing server from assigning new tasks to the unstable server. This reduces the service time of the unstable server and improves task security and reliability. When the service server is stable, the success threshold is reduced after each detection, making it easier for the service server to switch states. This reduces the duration of the unavailable state, making it easier for the service server to switch to an available state to handle new tasks, avoiding the problem of new tasks being unable to be assigned, and improving service reliability.

[0076] In the embodiments of the present application, using the preset order of "failure → success" as an example, a larger instability factor indicates a greater frequency of probe results switching from failure to success, i.e., frequent probe result switching. This switching may be caused by factors such as full service server bandwidth, network packet loss, or probabilistic hijacking. A larger instability factor indicates a more unstable service server. If an unstable service server is in an available state and receives a new task, the task will fail to execute. To accurately calculate the instability factor, the load balancing server uses a recorder to record the results of each probe. After each probe, the instability factor is determined based on all the probe results in the recorder. The recorder can be understood as an array with a length of n, meaning that the load balancing server can record the results of up to n probes, where n is, for example, 20, 30, etc., and this embodiment of the present application does not limit this. When i ≤ n, the load balancing server determines the instability factor based on the results of probes from the 1st to the i-th probe, where n is the maximum number of probe results stored by the load balancing server. When i > n, the load balancing server determines the instability factor based on the results of n consecutive probes, including the i-th probe.

[0077] For example, with n = 30, the array is initially empty, meaning the load balancing server doesn't store any detection results. The result of the first detection is stored in the first position of the recorder, meaning it represents a single data item in the array. The result of the i-th detection is stored in the i-th position.

[0078] When i is equal to 30, that is, after the 30th detection is performed, the recorder is full of data. Starting from the 31st detection, each time the detection result is stored, the oldest data in the array must be deleted, and then the latest detection result is added to the array. Taking the storage of the 31st detection result as an example, in one method, the detection result of the first detection is deleted, and the detection result of the 31st detection is stored in the first position. After the 32nd detection, the detection result of the second detection is deleted, and the detection result of the 32nd detection is stored in the second position, and so on. In this method, there is no need to move the position of the detection result, and all the detection results form a closed loop. When i>n, for example, i=32, n=30, the load balancing server determines the instability factor based on the detection results of the 3rd to 32nd detections.

[0079] In another approach, the detection result of the first detection is deleted and the detection results of the 2nd to 30th detections are moved forward, thereby freeing up the last position in the array for storing the detection result of the 31st detection. In this approach, the latest detection result is always at the end of the array.

[0080] Figure 4 This is a flowchart of the storage and update of detection results in the detection method provided in an embodiment of the present application. In this embodiment, all detection results form a closed loop. This embodiment includes:

[0081] 401. Determine the initial position.

[0082] For example, assuming the length of the array is n, the array is empty by default when the program starts, and the storage location of the detection result of the first detection is the initial location, which can be the location of the first data in the array or other locations. Usually, the default initial location is 0, so the storage location of the detection result of the first detection is a[1], the storage location of the second detection result is a[2]... The storage location of the 30th detection result is a

[30] , the storage location of the detection result of the 31st detection is a[1], and the storage location of the 32nd detection result is a[2].

[0083] 402. Perform the i-th detection to obtain the i-th detection result.

[0084] 403. Determine whether i is less than or equal to the array length n. If i≤n, execute step 404; if i>n, execute step 405.

[0085] 404. Determine the storage location of the i-th detection result as a[i].

[0086] When i≤n, index=i, for example, a

[28] indicates the location where the 28th detection result is stored.

[0087] 405. Determine the storage location of the i-th detection result as a[i-βn].

[0088] Here, β represents an integer multiple. For example, from the 31st to the 60th detection, β = 1, and from the 61st to the 90th detection, β = 2.

[0089] 406. Store the i-th detection result, and then, if i=i+1, execute step 402.

[0090] Below, Figure 4 Taking the storage method shown as an example, how to determine the instability factor is described in detail. For example, please refer to Figure 5 . Figure 5 This is a flow chart of determining the instability factor in the detection method provided in an embodiment of the present application. In this embodiment, it is assumed that the preset order is "failure → success" and the instability factor is initially 0. This embodiment includes:

[0091] 501. Determine the preset order and array length, etc.

[0092] 502. Perform the i-th detection to obtain a detection result of the i-th detection.

[0093] 503. Determine whether i≤n. If i≤n, execute step 504; if i>n, execute step 505.

[0094] 504 . Determine the instability factor according to the detection results from the 1st to the i-th detection, and then execute step 506 .

[0095] Exemplarily, if i=1, then the instability factor=0. If 1<i≤n, then step 504 includes:

[0096] 5041. Determine whether the detection result of the i-1th detection is a detection failure. If the detection result of the i-1th detection is a detection failure, execute step 5042; if the detection result of the i-1th detection is a detection success, execute step 5044.

[0097] 5042. Determine whether the detection result of the i-th detection is a detection success. If the detection result of the i-th detection is a detection success, execute step 5043; if the detection result of the i-th detection is a detection failure, execute step 5044.

[0098] 5043. The instability factor is increased by 1. Then, steps 5044 and 506 are executed.

[0099] 5044. i=i+1, then execute step 502.

[0100] 505. Determine the instability factor based on detection results of n consecutive detections, where the n consecutive detections include the i-th detection, and then execute step 506. The n consecutive detections include the i-th detection.

[0101] In this step, for any two adjacent detections, hereinafter referred to as the i-1th detection and the ith detection, as long as the detection results of these two detections conform to the above preset sequence, the instability factor is increased by 1. For example, if the detection results of the 5th and 6th, the 12th and 13th, and the 18th and 19th detections in 30 times are all in the order of failure followed by success, the instability factor is 3.

[0102] 506. Output an instability factor, and determine the stability of the service server according to the instability factor.

[0103] 507. Determine a success threshold value of the i-th detection based on the stability.

[0104] 508. Determine whether the service server is available after the i-th detection based on the detection result of the i-th detection and the success threshold of the i-th detection.

[0105] This solution is used to achieve the purpose of accurately determining the unstable factor of the load balancing server.

[0106] Figure 6 This is a flow chart of determining whether a service server is available in the detection method provided in the embodiment of this application. Assuming that the service server is in an unavailable state after the i-1th detection, this embodiment includes:

[0107] 601. After the (i-1)th detection, the load balancing server determines the number of consecutive detection successes R1 and the number of consecutive detection failures F1.

[0108] For example, after each detection, the load balancing server updates and records the number of consecutive detection successes R1 and the number of consecutive detection failures F1

[0109] 602. The load balancing server performs the i-th detection.

[0110] 603. The load balancing server determines whether the i-th detection is successful. If the detection is successful, step 604 is executed; if the detection fails, step 608 is executed.

[0111] 604. The load balancing server updates the number of consecutive successful detections and the number of consecutive failed detections, R1=R1+1, F1=0.

[0112] That is, if the i-th detection is successful, the load balancing server accumulates the number of consecutive detection successes and resets the number of consecutive detection failures to zero.

[0113] 605. The load balancing server determines whether the number of consecutive successful detections is greater than or equal to a success threshold for the i-th detection.

[0114] Exemplarily, after the load balancing server updates the number of consecutive successful detections, it compares the updated number of consecutive successful detections with the success threshold value of the i-th detection. If the updated number of consecutive successful detections is greater than or equal to the success threshold value of the i-th detection, step 606 is executed; if the updated number of consecutive successful detections is less than the success threshold value of the i-th detection, step 607 is executed.

[0115] 606. The load balancing server determines that the business server is an available server.

[0116] Exemplarily, the load balancing server restores the service server to an available state. Afterwards, i=i+1, and step 602 is executed.

[0117] 607. The load balancing server determines that the service server is an unavailable server. After that, i=i+1, and step 602 is executed.

[0118] Exemplarily, if the updated number of consecutive successful detections is less than the success threshold of the i-th detection, it means that the service server cannot be switched from an unavailable state to an available state.

[0119] 608. The load balancing server updates the number of consecutive successful detections and the number of consecutive failed detections, F1=F1+1, R1=0.

[0120] That is, if the i-th detection fails, the load balancing server accumulates the number of consecutive detection failures and resets the number of consecutive detection successes to zero.

[0121] 609. The load balancing server determines that the service server is still an unavailable server. Then, i=i+1, and step 602 is executed.

[0122] Figure 7 This is another flow chart for determining whether a service server is available in the detection method provided in the embodiment of this application. Assuming that the service server is in an available state after the i-1th detection, this embodiment includes:

[0123] 701. After the (i-1)th detection, the load balancing server determines the number of consecutive detection successes R1 and the number of consecutive detection failures F1.

[0124] For example, after each detection, the load balancing server updates and records the number of consecutive detection successes R1 and the number of consecutive detection failures F1

[0125] 702. The load balancing server performs the i-th detection.

[0126] 703. The load balancing server determines whether the i-th detection is successful. If the detection is successful, step 704 is executed; if the detection fails, step 706 is executed.

[0127] 704. The load balancing server updates the number of consecutive successful detections and the number of consecutive failed detections, R1=R1+1, F1=0.

[0128] That is, if the i-th detection is successful, the load balancing server accumulates the number of consecutive detection successes and resets the number of consecutive detection failures to zero.

[0129] 705. The load balancing server determines that the service server is still available, then i=i+1, and executes step 702.

[0130] 706. The load balancing server updates the number of consecutive successful detections and the number of consecutive failed detections, F1=F1+1, R1=0.

[0131] That is, if the i-th detection fails, the load balancing server accumulates the number of consecutive detection failures and resets the number of consecutive detection successes to zero.

[0132] 707. The load balancing server determines whether the number of consecutive detection failures is greater than or equal to a preset failure threshold.

[0133] Exemplarily, after the load balancing server updates the number of consecutive detection failures, it compares the updated number of consecutive detection failures with the preset failure threshold value. If the updated number of consecutive detection failures is greater than or equal to the failure threshold value, step 708 is executed; if the updated number of consecutive detection failures is less than the failure threshold value, step 709 is executed.

[0134] 708. The load balancing server determines that the business server is an unavailable server.

[0135] Exemplarily, the load balancing server restores the service server to an available state. Afterwards, i=i+1, and step 702 is executed.

[0136] 709. The load balancing server determines that the business server is still an available server.

[0137] With this solution, if the business server is unavailable, after this detection, the success threshold of this detection is used to determine whether to set the business server to an available state; if the business server is available, after this detection, the preset failure threshold is used to determine whether to set the business server to an unavailable state. This allows for timely switching of the business server's state to ensure the accuracy of task allocation.

[0138] Optionally, in the above embodiment, after the i-th detection, if the service server is set to an available state, the load balancing server, upon receiving an access request from the terminal device, sends the access request to the service server. If, after the i-th detection, the service server is set to an unavailable state, the load balancing server, upon receiving an access request from the terminal device, sends the access request to another service server.

[0139] For example, let's assume that both service server A and service server B can provide video A. After the load balancing server performs its i-th detection on service server A, if service server A is available, the load balancing server receives an access request from the terminal device for resources related to video A. At this point, the load balancing server sends the access request to service server A. If service server A is unavailable but service server B is, the load balancing server sends the access request to service server B.

[0140] The following examples illustrate the detection method described in the embodiments of the present application. In these examples, the preset initial threshold value is 3, the upper limit value is 12, the failure threshold value is 2, the maximum number of detection results stored by the load balancing server is n = 30, the threshold value of the instability factor is 3, the detection period is 5, the initial state of the service server is available, "√" represents a successful detection, and "×" represents a failed detection.

[0141] Case 1:

[0142] Table 1

[0143] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 √ √ √ √ × × √ √ √ √ × × √ √ √ 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 √ × × √ √ √ √ × × √ √ √ √ × ×

[0144] In this case, the business server exhibited regular anomalies. As shown in Table 1 above, after four consecutive successful detections, two detection failures occurred. This anomaly is often caused by hardware issues or frequent business server startups.

[0145] If the existing detection method is used, the success threshold and failure threshold are fixed at 3 and 2 respectively. After the 6th detection, the business server is set to an unavailable state because the number of consecutive detection failures is 2. After the 9th detection, the business server is switched to an available state because the number of consecutive detection successes is 3. Similarly, after the 12th, 18th, 24th, and 30th detections, the business server is switched to an unavailable state. After the 15th, 21st, and 27th detections, the business server is switched to an available state. During this process, the proportion of time that the business server continues to provide services when it is abnormal is 33.3%. Obviously, this regular anomaly will cause the proportion of time that the business server continues to provide services when it is abnormal to remain stable at around 33.3%.

[0146] In the embodiment of the present application, assuming that the preset order is "failure→success", the 6th and 7th detections, the 12th and 13th detections, the 18th and 19th detections, and the 24th and 25th detections all comply with the above preset order. In the 1st to 19th detections, the instability factor is less than the threshold value 3. Therefore, the success threshold value corresponding to each detection is 3. After the 19th detection, the instability factor is 3. At this time, the instability factor is equal to the threshold value 3. Therefore, it is necessary to determine the success threshold value of the 19th detection. The success threshold value of the 19th detection is obtained based on the success threshold value of the 18th detection. Since the success threshold value of the 18th detection is 3, the success threshold value of the 19th detection is obtained by increasing the success threshold value of the 18th detection. The success threshold value of the 19th detection is 4.

[0147] If the detection continues, the success threshold value of the 20th detection is 5, the success threshold value of the 21st detection is 6, the success threshold value of the 22nd detection is 7... After the 18th detection, the business server switches to an unavailable state. Although the number of consecutive successful detections is 4 after the 22nd detection (the 19th to 22nd consecutive detections are successful), since the success threshold value of the 22nd detection is 7, it is obvious that the business server cannot switch to an available state. It can be seen that after the 19th detection, the load balancing server believes that the business server is an unstable server, and the success threshold value continues to increase, making it difficult for the business server to switch from an unavailable state to an available state. The time that the business server continues to provide services when it is abnormal accounts for 20%.

[0148] If the detection results from the 31st to 60th detections are repeated as shown in Table 1, the instability factor will remain above 3, and the success threshold will continue to increase, likely reaching the upper limit of 12. Table 1 does not show 12 consecutive successful detections. Therefore, the proportion of time the service server continues to operate when it is abnormal will gradually decrease to 0%.

[0149] Case 2:

[0150] Table 2

[0151] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 √ √ √ √ × √ √ × √ √ √ × √ × √ 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 √ × × √ √ √ × × √ √ √ √ × √ √

[0152] In this case, the irregular anomalies of the business server are commonly caused by network packet loss, network card problems, etc.

[0153] If the existing detection method is used, since there are 9 detection failures in Table 2, the service duration during an abnormality is approximately 30%. If the detection results from the 31st to 60th, 61st to 90th, and so on repeat the results in Table 1, the service duration during an abnormality remains stable at 30%.

[0154] In the embodiment of the present application, assuming that the preset order is "failure → success", the 5th and 6th detections, the 8th and 9th detections, and the 12th and 13th detections all comply with the above preset order. Therefore, the instability factor after the 13th detection is 3. Starting from the 13th time, the success threshold value continues to increase. Since the business server is initially in an available state, the number of consecutive detection failures from the 1st detection to the 16th detection is always less than the failure threshold value. Therefore, the business server is in an available state from the 1st detection to the 16th detection. Only after the 18th detection, the number of consecutive detection failures is equal to the failure threshold value, and the business server switches to an unavailable state. Starting from the 19th detection, the business server no longer switches states. From the 1st detection to the 18th detection, the detection of business server abnormalities is the 5th, 8th, 12th, 14th, 17th and 18th respectively, and the proportion of time that the business server continues to provide service when it is abnormal is 6 / 30=20%.

[0155] As the success threshold value continues to increase, if the detection results from the 31st to the 60th, 61st to the 90th, ... repeat Table 1, the proportion of the time when the business server continues to provide services when it is abnormal will gradually decrease to 0%.

[0156] Case 3:

[0157] Table 3

[0158] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 √ √ √ √ × × × × × × × × × √ √ 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 √ √ √ √ √ √ √ √ √ √ √ √ √ √ √

[0159] This case corresponds to the scenario of business server downtime and restart or business software restart.

[0160] If the existing detection method is used, as shown in Table 3, after the sixth detection, the number of consecutive detection failures is two, so the business server is switched to an unavailable state. The time during which the business server continues to provide service during an abnormality includes the fifth and sixth detections, and the proportion of time during which the business server continues to provide service during an abnormality is approximately 6.7%.

[0161] In the embodiment of the present application, since the instability factor is 1, the instability factor does not exceed the threshold. Therefore, the success threshold value of each detection does not change. In other words, for a stable business server, a regular restart of the business server, etc., will not trigger the solution of the embodiment of the present application.

[0162] The following are device embodiments of the present application, which can be used to implement the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.

[0163] Figure 8Schematic diagram of a detection device provided in an embodiment of the present application. The detection device 800 includes: a first determination module 81 , a second determination module 82 , a third determination module 83 and a fourth determination module 84 .

[0164] A first determining module 81 is configured to determine an instability factor after performing an i-th detection on the service server, where the instability factor indicates the degree of instability of the service server;

[0165] A second determining module 82 is configured to determine the stability of the service server according to the instability factor;

[0166] a third determining module 83, configured to determine a success threshold value of the i-th detection based on the stability, wherein the success threshold value of the i-th detection is used to indicate a minimum number of consecutive successful detections required to switch the service server from an unavailable state to an available state, wherein the consecutive detections include the i-th detection;

[0167] The fourth determining module 84 is configured to determine whether the service server is available after the i-th detection according to the detection result of the i-th detection and the success threshold of the i-th detection.

[0168] In a feasible implementation, the third determination module 83 is used to determine whether the success threshold value of the i-1th detection is less than a preset upper limit value when the stability indication indicates that the business server is unstable; if the success threshold value of the i-1th detection is less than the upper limit value, the success threshold value of the i-1th detection is increased to obtain the success threshold value of the i-th detection.

[0169] In a feasible implementation, the third determination module 83 is used to determine whether the success threshold value of the i-1th detection is greater than a preset initial value when the stability indication indicates that the server is stable; if the success threshold value of the i-1th detection is greater than the initial value, the success threshold value of the i-1th detection is reduced to obtain the success threshold value of the i-1th detection.

[0170] In a feasible implementation, the fourth determination module 84 is used to update the number of consecutive successful detections and the number of consecutive failed detections if the detection result of the i-th detection indicates that the business server is successfully detected; determine whether the number of consecutive successful detections is greater than or equal to the success threshold value of the i-th detection; if the number of consecutive successful detections is greater than or equal to the success threshold value of the i-th detection, determine that the business server is an available business server; if the number of consecutive successful detections is less than the success threshold value of the i-th detection, determine that the business server is an unavailable business server.

[0171] In a feasible implementation, the first determination module 81 is used to determine the instability factor based on the detection results of the 1st to i-th detection when i≤n, where n is the maximum number of detection results stored by the load balancing server; when i>n, determine the instability factor based on the detection results of n consecutive detections, where the n consecutive detections include the i-th detection.

[0172] In a feasible implementation, when the first determination module 81 determines the instability factor based on the detection results of n consecutive detections, it is used to determine the number of two adjacent detection results in the detection results of the n consecutive detections in opposite order according to a preset order, and use the number as the instability factor.

[0173] In a feasible implementation, the fourth determination module 84 is also used to update the number of consecutive detection failures if the detection result of the i-th detection indicates a detection failure; determine whether the number of consecutive detection failures is greater than or equal to a preset failure threshold; if the number of consecutive detection failures is greater than or equal to the failure threshold, determine that the business server is an unavailable business server; if the number of consecutive detection failures is less than the failure threshold, determine that the business server is an available business server.

[0174] Please refer to Figure 8 In a feasible implementation, the detection device 800 further includes:

[0175] The transceiver module 85 is configured to receive an access request from a terminal device, and if the service server is available, send the access request to the service server.

[0176] The detection device provided in the embodiment of the present application can perform the actions of the load balancing server in the above embodiment. Its implementation principle and technical effects are similar and will not be repeated here.

[0177] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 9 As shown, the electronic device 900 is, for example, the load balancing server described above, and the electronic device 900 includes:

[0178] Processor 91 and memory 92;

[0179] The memory 92 stores computer instructions;

[0180] The processor 91 executes the computer instructions stored in the memory 902, so that the processor 901 performs the method implemented by the load balancing server as described above.

[0181] The specific implementation process of the processor 901 can be found in the above method embodiment. Its implementation principle and technical effects are similar and will not be repeated here in this embodiment.

[0182] Optionally, the electronic device 900 further includes a communication component 93 , wherein the processor 91 , the memory 92 and the communication component 93 may be connected via a bus 94 .

[0183] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, they are used to implement the method implemented by the load balancing server as described above.

[0184] An embodiment of the present application also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the method implemented by the load balancing server as described above.

[0185] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present application that follow the general principles of the present application and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0186] It should be understood that the present application is not limited to the exact structure described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A detection method, characterized in that: Applied to a load balancing server, the method includes: After performing the i-th detection on the service server, determining an instability factor, wherein the instability factor is used to indicate the degree of instability of the service server, and the instability factor is used to indicate the probability that the detection results of two adjacent detections meet a preset order and are opposite; determining the stability of the service server according to the instability factor; determining a success threshold value for the i-th detection based on the stability, where the success threshold value for the i-th detection is used to indicate a minimum number of consecutive successful detections required to switch the service server from an unavailable state to an available state, the consecutive detections including the i-th detection, and the success threshold value is negatively correlated with the stability; Whether the service server is available after the i-th detection is determined according to the detection result of the i-th detection and the success threshold of the i-th detection; if the i-th detection indicates that the service server is available, the service server is used to process the access request.

2. The method according to claim 1, characterized in that The determining the success threshold value of the i-th detection according to the stability includes: When the stability indication indicates that the service server is unstable, determining whether the success threshold value of the (i-1)th detection is less than a preset upper limit value; If the success threshold value of the (i-1)th detection is less than the upper limit value, the success threshold value of the (i-1)th detection is increased to obtain the success threshold value of the i-th detection.

3. The method according to claim 1, characterized in that The determining the success threshold value of the i-th detection according to the stability includes: When the stability indication indicates that the server is stable, determining whether a success threshold value of the (i-1)th detection is greater than a preset initial value; If the success threshold value of the (i-1)th detection is greater than the initial value, the success threshold value of the (i-1)th detection is reduced to obtain the success threshold value of the i-th detection.

4. The method according to any one of claims 1 to 3, characterized in that The determining, based on the detection result of the i-th detection and the success threshold value of the i-th detection, whether the service server is available after the i-th detection includes: If the detection result of the i-th detection indicates that the service server is successfully detected, the number of consecutive successful detections and the number of consecutive failed detections are updated; Determining whether the number of consecutive successful detections is greater than or equal to a success threshold of the i-th detection; If the number of consecutive successful detections is greater than or equal to the success threshold of the i-th detection, determining that the service server is an available service server; If the number of consecutive successful detections is less than the success threshold of the i-th detection, the service server is determined to be an unavailable service server.

5. The method according to any one of claims 1 to 3, characterized in that After performing the i-th detection on the service server, determining the instability factor includes: When i≤n, determining the instability factor according to the detection results from the 1st to the i-th detection, where n is the maximum number of detection results stored by the load balancing server; When i>n, the instability factor is determined according to detection results of n consecutive detections, where the n consecutive detections include the i-th detection.

6. The method according to claim 5, characterized in that The determining of the instability factor according to the detection results of n consecutive detections includes: Determine the number of detection results of two adjacent detections in opposite order in the n consecutive detection results, and use the number as the instability factor.

7. The method according to any one of claims 1 to 3, characterized in that Also includes: If the detection result of the i-th detection indicates a detection failure, updating the number of consecutive detection failures; Determining whether the number of consecutive detection failures is greater than or equal to a preset failure threshold; If the number of consecutive detection failures is greater than or equal to the failure threshold, determining that the service server is an unavailable service server; If the number of consecutive detection failures is less than the failure threshold, the service server is determined to be an available service server.

8. The method according to any one of claims 1 to 3, characterized in that After determining whether the service server is available after the i-th detection according to the detection result of the i-th detection and the success threshold value of the i-th detection, the method further includes: receiving an access request from a terminal device; If the service server is available, the access request is sent to the service server.

9. A detection device, characterized in that: include: A first determination module is configured to determine an instability factor after performing an i-th detection on the service server, wherein the instability factor is used to indicate a degree of instability of the service server and a probability that the detection results of two adjacent detections meet a preset order and are opposite; A second determining module, configured to determine the stability of the service server according to the instability factor; a third determining module, configured to determine a success threshold value of the i-th detection based on the stability, wherein the success threshold value of the i-th detection is used to indicate a minimum number of successful consecutive detections if the service server is switched from an unavailable state to an available state, the consecutive detections including the i-th detection, and the success threshold value is negatively correlated with the stability; The fourth determination module is used to determine whether the business server is available after the i-th detection based on the detection result of the i-th detection and the success threshold value of the i-th detection. If the i-th detection indicates that the business server is available, the business server is used to process the access request.

10. An electronic device comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the electronic device implements the method according to any one of claims 1 to 8.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Background service quality detection method, device and computer device

    CN108964947A