A network timeout detection method, apparatus, device, medium and product
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HONGHU WANLIAN (JIANGSU) TECH DEV CO LTD
- Filing Date
- 2026-05-27
- Publication Date
- 2026-08-07
AI Technical Summary
[0003]目前,现有技术中针对网络连通性的检测手段较为单一,普遍采用固定参数的检测方式开展相关检测工作,难以适应复杂多变的网络环境
[0010]本申请实施例的技术方案中,通过预设检测周期触发检测、基于历史检测时长集合确定动态超时阈值、根据判断结果维护集合,实现网络超时自适应检测,解决固定阈值易误判、漏判的问题,提升超时判定准确性和灵活性,同时保障检测实时性和算法稳定性,适配不同网络场景波动。
Smart Images

Figure CN122533992A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a method, apparatus, device, medium and product for network timeout detection. Background Technology
[0002] Background Technology Introduction. In the field of network communication, real-time network connectivity detection is a crucial foundation for ensuring stable system operation. It is widely used in various network devices, servers, and terminal systems. Its core purpose is to promptly detect network interruptions, link anomalies, and other problems, providing a basis for subsequent fault handling, link switching, and other operations.
[0003] Currently, existing technologies for network connectivity detection are relatively limited, generally employing fixed-parameter detection methods, which are ill-suited to complex and ever-changing network environments. This leads to frequent misjudgments, compromising the accuracy and flexibility of network timeout detection and failing to guarantee its stability. Summary of the Invention
[0004] This application provides a network timeout detection method, apparatus, device, medium, and product to improve the accuracy and flexibility of timeout determination, while ensuring real-time detection and algorithm stability, and adapting to fluctuations in different network scenarios.
[0005] According to one aspect of this application, a network timeout detection method is provided, comprising: In response to the preset detection cycle, trigger the current network detection event and obtain the current detection duration; Based on the historical detection duration set maintained since the last detection, determine the current timeout judgment threshold for the current network detection event; Based on the current detection duration and the current timeout threshold, determine whether a timeout event has occurred; Based on the judgment result, determine whether to update the current timeout judgment threshold to the historical detection duration set in order to maintain the historical detection duration set.
[0006] According to another aspect of this application, a network timeout detection device is provided, comprising: The current detection duration acquisition module is used to respond to a preset detection cycle, trigger the current network detection event, and acquire the current detection duration. The current judgment threshold determination module is used to determine the current timeout judgment threshold for the current network detection event based on the historical detection duration set maintained after the last detection. The timeout event determination module is used to determine whether a timeout event has occurred based on the current detection duration and the current timeout determination threshold. The historical detection set maintenance module is used to determine whether to update the current timeout judgment threshold to the historical detection duration set based on the judgment result, so as to maintain the historical detection duration set.
[0007] According to another aspect of this application, an electronic device is provided, the electronic device comprising: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, which enables the at least one processor to perform the network timeout detection method described in any embodiment of this application.
[0008] According to another aspect of this application, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the network timeout detection method according to any embodiment of this application.
[0009] According to another aspect of this application, a computer program product is provided, the computer program product including a computer program that, when executed by a processor, implements the network timeout detection method according to any embodiment of this application.
[0010] In the technical solution of this application embodiment, detection is triggered by a preset detection period, a dynamic timeout threshold is determined based on a set of historical detection durations, and a set is maintained according to the judgment results. This achieves adaptive network timeout detection, solves the problem of misjudgment and missed judgment by fixed thresholds, improves the accuracy and flexibility of timeout judgment, and ensures the real-time performance of detection and the stability of the algorithm, adapting to fluctuations in different network scenarios.
[0011] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description
[0012] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0013] Figure 1 This is a flowchart of a network timeout detection method according to Embodiment 1 of this application; Figure 2This is a schematic diagram of a network timeout detection method according to Embodiment 2 of this application; Figure 3 This is a schematic diagram of a network timeout detection device according to Embodiment 3 of this application; Figure 4 This is a schematic diagram of the structure of an electronic device that implements the network timeout detection method of the embodiments of this application. Detailed Implementation
[0014] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0015] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0016] Example 1 Figure 1 This application provides a flowchart of a network timeout detection method according to Embodiment 1. This embodiment is applicable to network timeout detection. The method can be executed by a network timeout detection device, which can be implemented in hardware and / or software and can be configured in an electronic device. Figure 1 As shown, the method includes: S110. In response to the preset detection period, trigger the current network detection event and obtain the current detection duration.
[0017] The preset detection period can refer to a fixed time interval set in advance to trigger network detection events. It is the basis for ensuring the real-time performance of network detection. The detection period can be set by technical personnel in the relevant field based on a large number of experiments or human experience. For example, in this embodiment, the preset detection period can be set to 10 seconds, that is, the system triggers a network detection operation once every 10 seconds. This application does not limit this.
[0018] The current network detection event can be a single network connectivity detection operation that can be executed after the current detection period is reached. It is relative to historical detection events, and each detection period corresponds to one current network detection event.
[0019] The current detection duration can be the actual time consumed from sending the detection request to receiving the detection response (or determining timeout) for this network detection event. It is the core data for determining whether this detection has timed out, and the unit can be seconds.
[0020] For example, when the time reaches the preset detection period, the network connectivity detection operation (i.e., the current network detection event) can be automatically triggered. By recording the sending time of the detection request and the receiving time of the detection response, the actual time consumed by this detection (i.e., the current detection duration) can be calculated and obtained, providing data support for subsequent judgment on whether a timeout has occurred.
[0021] S120. Based on the set of historical detection durations maintained since the last detection, determine the current timeout threshold for the current network detection event.
[0022] The previous detection can refer to the most recent network detection event before the current network detection event. After the previous detection is completed, the historical detection duration set will be updated to provide historical data support for the current detection.
[0023] Maintenance can refer to the continuous updating and management of the historical detection duration set (including adding new data and deleting old data) to ensure that the data in the set is always the most recent N detection durations. For example, a circular queue can be used for maintenance.
[0024] The historical detection duration set can be a collection used to store the time values consumed by multiple network detections in the historical detection process, with each element in the set representing the duration data of each detection. This set can be stored in various formats such as arrays, tables, and matrices, and this embodiment does not limit the specific format used.
[0025] The current timeout threshold can be a critical time value used to determine whether the current network detection event has timed out. It is a dynamic value calculated based on the set of historical detection durations and is recalculated after each detection for the timeout determination of the next detection.
[0026] For example, the historical detection duration set maintained after the last detection is completed is called, and the critical time value (i.e. the current timeout judgment threshold) used to determine whether the current network detection has timed out is calculated according to the preset calculation rules, so as to provide a clear standard for the current timeout judgment.
[0027] S130. Based on the current detection duration and the current timeout threshold, determine whether a timeout event has occurred.
[0028] Among them, a timeout event can refer to an event in which the current detection time exceeds the current timeout judgment threshold or no detection response information is received from the preset network address, resulting in the inability to complete the detection within the specified time. It is an important signal that the network may be disconnected.
[0029] For example, the current detection duration obtained in S110 is compared with the current timeout judgment threshold determined in S120. The comparison result determines whether the network detection has exceeded the specified time: if the current detection duration is greater than the current timeout judgment threshold, or the system has not received the detection response information, then a timeout event is determined to have occurred; if the current detection duration is less than or equal to the current timeout judgment threshold, and the system has received the detection response information, then no timeout event is determined to have occurred, and the timeout judgment for this detection is completed.
[0030] S140. Based on the judgment result, determine whether to update the current timeout judgment threshold to the historical detection duration set in order to maintain the historical detection duration set.
[0031] The judgment result can refer to the conclusion of "a timeout event has occurred" or "no timeout event has occurred" obtained in S130, which is the core basis for deciding how to update the historical detection duration set.
[0032] For example, based on the timeout judgment result in S130, it is determined whether a network timeout has occurred, and further judgment is made on what maintenance to perform on the historical detection duration set based on whether a timeout event has occurred. It can be understood that whether a timeout event has occurred determines whether the current timeout judgment threshold should be updated to the historical detection duration set.
[0033] In the technical solution of this application embodiment, detection is triggered by a preset detection period, a dynamic timeout threshold is determined based on a set of historical detection durations, and a set is maintained according to the judgment results. This achieves adaptive network timeout detection, solves the problem of misjudgment and missed judgment by fixed thresholds, improves the accuracy and flexibility of timeout judgment, and ensures the real-time performance of detection and the stability of the algorithm, adapting to fluctuations in different network scenarios.
[0034] In one optional implementation, the step of determining whether to update the current timeout threshold to the historical detection duration set based on the judgment result in S140 may include: A1. In response to a timeout event, update the current timeout threshold to the historical detection duration set.
[0035] When a timeout event occurs, updating the set with the "timeout" itself (such as infinity or a maximum value) will cause the timeout threshold to increase sharply in subsequent calculations, affecting the stability of subsequent network timeout detection. Therefore, in this embodiment, the current timeout judgment threshold is added to the historical detection duration set as update data to achieve smooth processing of outliers.
[0036] A2. In response to the absence of a timeout event, update the current detection duration to the historical detection duration set.
[0037] When no timeout event occurs, the current detection duration can accurately reflect the actual situation of this network detection. Updating it to the historical detection duration set can ensure that historical data can accurately reflect the recent network connectivity status, providing a reliable basis for subsequent timeout threshold calculation.
[0038] It should be noted that A1 and A2 do not have a specific execution order, but are labeled for ease of explanation.
[0039] In the above implementation, the historical set is updated differentially based on the judgment result of whether or not it has timed out. In the case of timeout, the detection threshold of the current detection period is used to smooth out detection anomalies (such as timeout and disconnection). In the case of normal operation, the actual duration is used to ensure data authenticity, avoid threshold distortion caused by outliers, and ensure the stable operation of network detection.
[0040] In one alternative implementation, the method may further include: In response to an update of the historical detection duration set, the earliest element in the historical detection duration set is deleted; wherein, the number of elements in the historical detection duration set is less than ten.
[0041] The earliest element can refer to the detection duration data stored for the longest time in the historical detection duration set, i.e., the data that was first added to the set. The number of elements in the set can be set by relevant technical personnel based on extensive experiments or manual experience to ensure that the set always maintains a fixed length and avoids data redundancy. It should be noted that if the number of elements in the set is large, it means that the detection durations corresponding to various detection cycles over a considerable historical period are stored; correspondingly, relying on a large set of historical detection durations maintained for a long time to determine the dynamically changing current timeout judgment threshold, this current timeout judgment threshold is suitable for long-term network conditions. Conversely, if the number of elements in the set is small, it means that the detection durations over a short period of time are stored; correspondingly, relying on a set of historical detection durations maintained for a short time to determine the dynamically changing current timeout judgment threshold, this current timeout judgment threshold is more suitable for short-term network fluctuations. For example, in this embodiment, the number of elements in the total historical detection duration is less than 10, which is more conducive to identifying short-term network fluctuations. Such flexible settings can improve the adaptability of network timeout detection.
[0042] In the above implementation, limiting the number of elements in the historical set and deleting the oldest element avoids data redundancy and ensures that the set always stores the most recently detected data, making subsequent threshold calculations more consistent with the current network state and further improving the timeliness and accuracy of detection.
[0043] In one optional implementation, the step of determining the current timeout threshold for the current network detection event based on the historical detection duration set maintained since the last detection in S120 may include: S121. Determine the dynamic duration threshold based on the weighted average of all elements in the historical detection duration set maintained since the last detection.
[0044] The weighted average can be the average value calculated by assigning different weights to all elements in the historical detection duration set according to their importance. Although the ordinary arithmetic average can also be used, the weight of elements in the historical detection duration set that are more recently added can be set to be higher than that of the ordinary arithmetic average, so as to emphasize the impact of the most recent detection data.
[0045] The dynamic duration threshold is a baseline value that is dynamically adjusted as historical data changes and is calculated based on the weighted average of the historical detection duration set. It serves as intermediate data for calculating the current timeout judgment threshold and reflects the overall trend of recent network detection duration.
[0046] For example, all elements in the historical detection duration set maintained after the last detection are extracted, and a weighted average is calculated for these elements. This calculation yields a dynamic duration threshold that reflects the overall trend of recent network detection duration, providing an intermediate basis for subsequent calculation of the current timeout judgment threshold.
[0047] S122. Determine the current timeout threshold based on the dynamic duration threshold and the preset offset.
[0048] The preset offset can be a fixed time value that is pre-set and added to the dynamic duration threshold. Its function is to provide a certain amount of redundancy for timeout judgment and avoid misjudgment due to slight network jitter. In this embodiment, the preferred preset offset is 1 second.
[0049] For example, the dynamic duration threshold calculated in S121 is added to a pre-set 1-second offset. The timeout threshold for the current network detection event is then determined using the formula "Current Timeout Threshold = Dynamic Duration Threshold + Offset," thus clarifying the critical standard for "exceeding this time constitutes a timeout" in this detection. For instance, if the dynamic duration threshold is 10 seconds and the offset is 1 second, then the current timeout threshold is 11 seconds.
[0050] In the above implementation, a dynamic duration threshold is determined by weighted average value, and a timeout judgment threshold is obtained by combining it with a preset offset. This allows the threshold to dynamically adapt to the most recent network state, reducing false judgments caused by slight network jitter and further improving the rationality and accuracy of timeout judgment.
[0051] In one optional implementation, the step of determining whether a timeout event has occurred based on the current detection duration and the current timeout threshold in step S130 may include: B1. In response to the current detection duration exceeding the current timeout threshold, a timeout event is determined to have occurred.
[0052] The current detection time exceeds the current timeout threshold, indicating that the time consumed by this detection has exceeded the preset critical standard, and network connectivity may be abnormal. Therefore, it is judged as a timeout event.
[0053] B2. In response to the current detection duration being less than or equal to the current timeout judgment threshold, it is determined that no timeout event has occurred.
[0054] If the current detection time is less than or equal to the current timeout threshold, it means that the time consumed by this detection is within the preset critical standard, the network connectivity is normal, and therefore it is determined that no timeout event has occurred.
[0055] It should be noted that B1 and B2 do not have a specific execution order, but are labeled for ease of explanation.
[0056] The above implementation clearly defines the judgment logic for timeout events. By comparing the current detection duration with the threshold value, it can quickly and accurately determine whether a timeout has occurred. The logic is clear and the execution is efficient, ensuring that network anomalies can be captured in a timely manner, providing a clear basis for subsequent collection maintenance and anomaly handling.
[0057] In one optional implementation, the step S110, which involves triggering a current network detection event in response to a preset detection period and obtaining the current detection duration, may include: S111. In response to the preset detection period, send a detection request to the preset network address and record the time when the detection request is sent.
[0058] The preset network address refers to a pre-defined target network address used to receive detection requests. It is the object of network detection. In this embodiment, the preset network address can be an Internet Protocol address (IP address) or a public Domain Name System (DNS) address, used to simulate the connectivity detection target in a real network environment. The detection request can be a signal command sent to the preset network address to detect network connectivity. For example, it can be an ICMP (Internet Control Message Protocol) Ping packet, which requests a response from the target network address to determine whether the network is connected. The request sending time can be the specific time point at which the detection request (e.g., a Ping packet) is sent to the preset network address, serving as the starting time reference for calculating the current detection duration.
[0059] S112. Receive the detection response information fed back from the preset network address, and record the response reception time corresponding to the detection response information.
[0060] The detection response information can be a signal returned by a preset network address after receiving a detection request, indicating that it is normally connected; it serves as a verification signal for network connectivity. Correspondingly, the response reception time can be the specific point in time when the detection response information from the preset network address is successfully received; it is the end time reference for calculating the current detection duration.
[0061] S113. Determine the current detection duration based on the request sending time and response receiving time.
[0062] For example, based on the request sending time and response receiving time recorded in the aforementioned steps, the actual time consumed from sending the request to receiving the response in this network detection is calculated, and the specific value of the current detection duration is finally determined.
[0063] The above implementation clarifies the process for obtaining the current detection duration. By recording the times of request sending and response receiving, the duration is calculated to ensure that the duration data is accurate and traceable, providing reliable data support for subsequent timeout determination, avoiding judgment deviations caused by duration acquisition errors, and improving detection accuracy.
[0064] Example 2 Figure 2 This is a schematic diagram illustrating a network timeout detection method provided in Embodiment 2 of this application. This embodiment is a practical example provided based on the foregoing embodiments and implementation methods. Figure 2 As shown, the details are as follows: First, set a fixed detection cycle of once every 10 seconds for network detection.
[0065] Initialize a historical time array A[N] of length N (equivalent to a form of the historical detection duration set in the aforementioned embodiments and implementations) to store the time values consumed by the most recent N detections. In this embodiment, N is set to 5. Initially, all elements of the array are set to a base time value, which is preferably 10 seconds.
[0066] An offset value is set and added to the average value to obtain the final timeout threshold. In this embodiment, the offset value is set to 1 second.
[0067] Wait and perform periodic checks, that is, perform a network connectivity check every 10 seconds.
[0068] The system sends a detection request, such as an ICMP Ping packet, to a preset target network address (e.g., a gateway IP of 192.168.1.1 or a public DNS of 8.8.8.8).
[0069] Record the time T_start when the request is sent, and wait for the response.
[0070] Record the actual time consumed in this detection. If a response is received, record the time T_end when the response is received, and calculate the actual time consumed in this detection, T_actual = T_end - T_start, which is the current detection duration.
[0071] If no response is received, a timeout occurs, and the occurrence of the timeout event can be saved.
[0072] Then, update the historical time array. A circular queue is used to maintain array A[N]. Each update overwrites the oldest data with the new data. The specific update rules are as follows: If the current test is successful, update the value of the oldest element in the array to the actual time T_actual of this test.
[0073] If the current detection times out, update the value of the oldest element in the array to the current timeout threshold determined in the current detection period, instead of recording the timeout itself.
[0074] Assume the current array state is [10, 12, 11, 9, 10] (unit: seconds), ordered from left to right from oldest to newest.
[0075] For example, if the current test is normal and the actual time taken is 8 seconds, after the update, the array becomes [12, 11, 9, 10, 8]. The oldest value of 10 seconds is removed, and 8 seconds is added as the latest value.
[0076] For example, if the detection times out, after the update, the array becomes [12, 11, 9, 10, 10]. The oldest 10 seconds are removed, and the current timeout threshold of 10 seconds is added as the latest value.
[0077] The current timeout threshold for each detection period is calculated as follows: Based on the updated array A[N], calculate the dynamic timeout threshold Timeout_next to be used in the next detection. The calculation formula is: Timeout_next = (A[0] + A[1] + ... + A[N-1]) / N + offset value; It should be noted that, for the sake of simplification, the weighted average calculation here uses the average weight, which means that all weights are the same and there is no particular weighting bias.
[0078] In this embodiment, N=5, and the offset value=1 second, therefore the formula is: Timeout_next = (A[0] + A[1] + A[2] + A[3] + A[4]) / 5 + 1; For example, if the current array is [12, 11, 9, 10, 8], then the average timeout is (12+11+9+10+8) / 5 = 10 seconds, and the current timeout threshold is 10 + 1 = 11 seconds. If the array is [12, 11, 9, 10, 10], then the average timeout is 10.4 seconds, and the current timeout threshold is 11.4 seconds.
[0079] Finally, a dynamic timeout threshold is applied to determine network disconnection. The calculated Timeout_next is used as the timeout for the next network check. In the next check, if the actual time consumed exceeds Timeout_next, it is determined as a network timeout, and subsequent maintenance operations on the historical time array are triggered.
[0080] Example 3 Figure 3 This is a schematic diagram of a network timeout detection device provided in Embodiment 3 of this application. Figure 3 As shown, the device 300 includes: The current detection duration acquisition module 310 is used to respond to a preset detection period, trigger the current network detection event, and acquire the current detection duration. The current judgment threshold determination module 320 is used to determine the current timeout judgment threshold for the current network detection event based on the historical detection duration set maintained after the last detection. The timeout event determination module 330 is used to determine whether a timeout event has occurred based on the current detection duration and the current timeout determination threshold. The historical detection set maintenance module 340 is used to determine whether to update the current timeout judgment threshold to the historical detection duration set based on the judgment result, in order to maintain the historical detection duration set.
[0081] In the technical solution of this application embodiment, detection is triggered by a preset detection period, a dynamic timeout threshold is determined based on a set of historical detection durations, and a set is maintained according to the judgment results. This achieves adaptive network timeout detection, solves the problem of misjudgment and missed judgment by fixed thresholds, improves the accuracy and flexibility of timeout judgment, and ensures the real-time performance of detection and the stability of the algorithm, adapting to fluctuations in different network scenarios.
[0082] In one optional implementation, the historical detection set maintenance module 340 may include: The threshold maintenance set unit is used to update the current timeout threshold to the historical detection duration set in response to a timeout event. The detection duration maintenance set unit is used to update the current detection duration to the historical detection duration set in response to the absence of a timeout event.
[0083] In one alternative embodiment, the device 300 may further include: The set deletion and maintenance module is used to delete the earliest element in the historical detection duration set in response to the update of the historical detection duration set; wherein the number of elements in the historical detection duration set is less than ten.
[0084] In one optional implementation, the current judgment threshold determination module 320 may include: The dynamic duration threshold determination unit is used to determine the dynamic duration threshold based on the weighted average of all elements in the historical detection duration set maintained since the last detection. The current judgment threshold determination unit is used to determine the current timeout judgment threshold based on the dynamic duration threshold and the preset offset.
[0085] In one optional implementation, the timeout event determination module 330 may include: The timeout determination unit is used to determine that a timeout event has occurred when the current detection duration exceeds the current timeout determination threshold. The "no timeout" unit is used to determine that no timeout event has occurred when the current detection duration is less than or equal to the current timeout threshold.
[0086] In one optional embodiment, the current detection duration acquisition module 310 may include: The detection request sending unit is used to send a detection request to a preset network address in response to a preset detection period, and to record the time when the detection request is sent. The detection response receiving unit is used to receive detection response information fed back from a preset network address and record the response reception time corresponding to the detection response information. The detection duration determination unit is used to determine the current detection duration based on the request sending time and response receiving time.
[0087] The network timeout detection device provided in this application embodiment can execute the network timeout detection method provided in any embodiment of this application, and has the corresponding functional modules and beneficial effects for executing each network timeout detection method.
[0088] Example 4 Figure 4 A schematic diagram of an electronic device 10, which can be used to implement embodiments of this application, is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the application described and / or claimed herein.
[0089] like Figure 4As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0090] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0091] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as network timeout detection methods.
[0092] In some embodiments, the network timeout detection method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the network timeout detection method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the network timeout detection method by any other suitable means (e.g., by means of firmware).
[0093] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0094] Computer programs used to implement the methods of this application may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0095] In the context of this application, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0096] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0097] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0098] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0099] This application also discloses a computer program product, which includes a computer program that, when executed by a processor, implements the network timeout detection method provided in any embodiment of this application. This program product shares the same inventive concept as the network timeout detection methods disclosed in the embodiments of this application, and therefore will not be described in detail here.
[0100] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this application can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this application can be achieved, and this is not limited herein.
[0101] The specific embodiments described above do not constitute a limitation on the scope of protection of this application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A network timeout detection method, characterized in that, include: In response to the preset detection cycle, trigger the current network detection event and obtain the current detection duration; Based on the historical detection duration set maintained since the last detection, determine the current timeout judgment threshold for the current network detection event; Based on the current detection duration and the current timeout threshold, determine whether a timeout event has occurred; Based on the judgment result, determine whether to update the current timeout judgment threshold to the historical detection duration set in order to maintain the historical detection duration set.
2. The method according to claim 1, characterized in that, The step of determining whether to update the current timeout threshold to the historical detection duration set based on the judgment result includes: In response to the occurrence of the timeout event, the current timeout judgment threshold is updated to the historical detection duration set; In response to the absence of the timeout event, the current detection duration is updated to the historical detection duration set.
3. The method according to claim 2, characterized in that, The method further includes: In response to the update of the historical detection duration set, the earliest element in the historical detection duration set is deleted; wherein the number of elements in the historical detection duration set is less than ten.
4. The method according to claim 1, characterized in that, The step of determining the current timeout threshold for the current network detection event based on the historical detection duration set maintained since the last detection includes: The dynamic duration threshold is determined based on the weighted average of all elements in the historical detection duration set maintained since the last detection. The current timeout threshold is determined based on the dynamic duration threshold and the preset offset.
5. The method according to claim 1, characterized in that, The step of determining whether a timeout event has occurred based on the current detection duration and the current timeout threshold includes: In response to the current detection duration being greater than the current timeout determination threshold, it is determined that the timeout event has occurred; In response to the current detection duration being less than or equal to the current timeout judgment threshold, it is determined that the timeout event has not occurred.
6. The method according to claim 1, characterized in that, The response to the preset detection period, triggering the current network detection event, and obtaining the current detection duration includes: In response to a preset detection period, a detection request is sent to a preset network address, and the time of sending the corresponding detection request is recorded. Receive the detection response information fed back from the preset network address, and record the response reception time corresponding to the detection response information; The current detection duration is determined based on the time the request was sent and the time the response was received.
7. A network timeout detection device, characterized in that, include: The current detection duration acquisition module is used to respond to a preset detection cycle, trigger the current network detection event, and acquire the current detection duration. The current judgment threshold determination module is used to determine the current timeout judgment threshold for the current network detection event based on the historical detection duration set maintained after the last detection. The timeout event determination module is used to determine whether a timeout event has occurred based on the current detection duration and the current timeout determination threshold. The historical detection set maintenance module is used to determine whether to update the current timeout judgment threshold to the historical detection duration set based on the judgment result, so as to maintain the historical detection duration set.
8. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the network timeout detection method according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the network timeout detection method according to any one of claims 1-6.
10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the network timeout detection method according to any one of claims 1-6.