A network debugging method, apparatus, and storage medium

By obtaining the number of requests and network status, adapting to adjust the network request parameters, solving the problem of unstable upstream service unstable due to the timeout of downstream service response or network abnormalities in the micro -service architecture, and realizing the stability of the system and the improvement of user experience.

CN118972249BActive Publication Date: 2025-01-28E SURFING VISION TECHNOLOGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411434761.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-15
Publication Date
2025-01-28
Estimated Expiration
2044-10-15

AI Technical Summary

Technical Problem

In the microservice architecture, downstream service response timeout or network exceptions lead to unstable upstream services, and no effective solution has been proposed in the existing technology.

Method used

By obtaining the number of requests within the preset period, the corresponding input instructions are generated, and the current network status is obtained. The target network status is determined based on the input instructions, and the current network status is switched to the target network status. Finally Corresponding debugging action.

Benefits of technology

Under different circumstances, adaptive parameters are regulated, which improves the stability and reliability of the system, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118972249B_ABST
    Figure CN118972249B_ABST
Patent Text Reader

Abstract

The present application relates to a network debugging method, device and storage medium, wherein the network debugging method includes: obtaining the number of request timeouts within a preset time period; generating an input instruction based on the number of request timeouts; obtaining the detected current network state; determining the target network state based on the input instruction, and switching the current network state to the target network state; and performing corresponding debugging actions on the request parameters of the network request based on the target network state. Through the present application, the problem of upstream service instability caused by downstream service response timeout or network anomaly in the microservice architecture in the related technology is solved, and adaptive parameter adjustment is achieved in different situations, thereby providing users with a smoother and more reliable network experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network communication technology, and in particular to a network debugging method, device and storage medium. Background Art

[0002] With the continuous development of business, microservice architecture has become the mainstream trend of large-scale system design. The system is divided into multiple independent and independently deployable small services, and most of the services are called through the RestFul API (Representational State Transfer Application Programming Interface). This decomposition improves the scalability and maintainability of the system, but it also brings new problems and challenges.

[0003] In the microservice architecture, the system is increasingly split based on microservices, and the call links between services are getting longer and longer. Therefore, any response delay or failure in any link may cause a chain reaction on the upstream service and even the entire system, resulting in system performance degradation or even crash. When the call links between services become complex and long, it will cause service response timeouts or network instability. If the downstream service responds with a timeout, the upstream service may retry the request, thereby increasing its own load and increasing system resource consumption; if the upstream service depends on a core capability of the downstream service, the abnormality of the downstream service will cause the upstream service to fail to work properly, thus affecting the function of the entire system.

[0004] In order to prevent the system from completely crashing due to the failure of a service, a service fuse mechanism is usually used in the prior art. However, in a unitized or multi-active node architecture, the fuse may accidentally damage normal nodes, resulting in reduced service availability.

[0005] Currently, no effective solution has been proposed for the instability of upstream services caused by downstream service response timeouts or network anomalies in microservice architectures in related technologies. Summary of the invention

[0006] Embodiments of the present application provide a network debugging method, apparatus, system, electronic device, and storage medium to at least solve the problem of upstream service instability caused by downstream service response timeout or network anomaly in the microservice architecture in the related art.

[0007] In a first aspect, an embodiment of the present application provides a network debugging method, including:

[0008] Get the number of request timeouts within a preset time period;

[0009] generating an input instruction based on the number of request timeouts;

[0010] Get the current detected network status;

[0011] Based on the input instruction, determine a target network state, and switch the current network state to the target network state;

[0012] Based on the target network state, a corresponding debugging action is performed on the request parameters of the network request.

[0013] In some embodiments, obtaining the number of request timeouts within a preset time period includes:

[0014] The number of request timeouts within a preset time period is obtained by using a sliding window mechanism.

[0015] In some embodiments, before obtaining the number of request timeouts within a preset time period, the method further includes:

[0016] Set the counting switch;

[0017] When the counting switch is turned on, the number of request timeouts within the preset time period begins to be obtained;

[0018] When the counting switch is turned off, the acquisition of the number of request timeouts within the preset time period is stopped.

[0019] In some embodiments, the generating of the input instruction based on the request timeout number includes:

[0020] The request timeout number includes the connection timeout number;

[0021] Comparing the connection timeout number with a preset connection timeout count threshold;

[0022] When the number of connection timeouts exceeds the connection timeout count threshold, generating an input instruction as a connection timeout instruction;

[0023] When the number of connection timeouts does not exceed the connection timeout count threshold, the input instruction is generated as a connection success instruction.

[0024] In some embodiments, after comparing the connection timeout number with a preset connection timeout count threshold, the method further includes:

[0025] The request timeout number also includes the response timeout number;

[0026] Comparing the response timeout number with a preset response timeout count threshold;

[0027] When the number of response timeouts exceeds the response timeout count threshold, changing the input instruction to a read timeout instruction;

[0028] When the response timeout number does not exceed the response timeout count threshold, the input instruction is changed to a read success instruction.

[0029] In some embodiments, the obtaining the detected current network status includes:

[0030] If it is detected that the historical switching operation is missing, determining that the current network state is a connection recovery state, and the historical switching operation is an operation of switching the current network state to the target network state within a historical time period;

[0031] If it is detected that the historical switching operation has been performed, the current network state is determined according to a detection result of the network request during the transmission process.

[0032] In some embodiments, determining the target network state based on the input instruction includes:

[0033] If the input instruction is a connection timeout instruction, determining that the target network state is a connection timeout state;

[0034] If the input instruction is a connection success instruction, determining that the target network state is a connection recovery state;

[0035] If the input instruction is a read timeout instruction, determining that the target network state is a read timeout state;

[0036] If the input instruction is a read success instruction, it is determined that the target network state is a read normal state.

[0037] In some embodiments, performing corresponding debugging actions on request parameters of the network request based on the target network state includes:

[0038] Get the preset adjustment parameters;

[0039] If the target network state is a connection timeout state, based on the adjustment parameter, lowering the connection timeout parameter;

[0040] If the target network state is a connection recovery state, based on the adjustment parameter, increase the connection timeout parameter;

[0041] If the target network state is a read timeout state, based on the adjustment parameter, lowering the read timeout parameter;

[0042] If the target network state is a normal reading state, based on the adjustment parameter, increase the reading timeout parameter;

[0043] The request parameters include the connection timeout parameter and the read timeout parameter. The connection timeout parameter is the maximum time to wait for a network connection to be successfully established, and the read timeout parameter is the maximum time to wait for reading response data.

[0044] In a second aspect, an embodiment of the present application provides a network debugging device, including:

[0045] A counting module is used to obtain the number of request timeouts within a preset time period;

[0046] The counting module is further used to generate an input instruction based on the number of request timeouts;

[0047] A status confirmation module is used to obtain the detected current network status;

[0048] The state confirmation module is further used to determine the target network state based on the input instruction, and switch the current network state to the target network state;

[0049] The debugging module is used to perform corresponding debugging actions on the request parameters of the network request based on the target network state.

[0050] In a third aspect, an embodiment of the present application provides a storage medium on which a computer program is stored, and when the program is executed by a processor, the network debugging method described in the first aspect above is implemented.

[0051] Compared with the related art, the network debugging method provided in the embodiment of the present application obtains the number of request timeouts, generates corresponding input instructions, obtains the current network status, determines the target network status based on the input instructions, switches the current network status to the target network status, and then performs corresponding debugging actions on the request parameters of the network request. It solves the problem of upstream service instability caused by downstream service response timeout or network anomaly in the microservice architecture in the related art, and realizes adaptive parameter adjustment in different situations, thereby providing users with a smoother and more reliable network experience.

[0052] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0054] Figure 1 is a hardware structure block diagram of a terminal according to a network debugging method according to an embodiment of the present invention;

[0055] Figure 2 is a flow chart of a network debugging method according to an embodiment of the present application;

[0056] Figure 3 is a schematic diagram of transfer rules of a network debugging method according to an embodiment of the present application;

[0057] Figure 4 It is a structural block diagram of a network debugging device according to an embodiment of the present application. DETAILED DESCRIPTION

[0058] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application. In addition, it can also be understood that although the efforts made in this development process may be complex and lengthy, for ordinary technicians in the field related to the contents disclosed in the present application, some changes such as design, manufacturing or production based on the technical contents disclosed in the present application are only conventional technical means, and should not be understood as insufficient contents disclosed in the present application.

[0059] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.

[0060] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantity limitation, and may indicate the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application means greater than or equal to two. "And / or" describes the association relationship of associated objects, indicating that there can be three relationships. For example, "A and / or B" can mean: A exists alone, A and B exist at the same time, and B exists alone. The terms "first", "second", "third" and the like involved in the present application are merely used to distinguish similar objects and do not represent a specific ordering of the objects.

[0061] The method embodiment provided in this embodiment can be executed in a terminal, a computer or a similar computing device. Taking running on a terminal as an example, Figure 1 FIG. 1 is a hardware structure diagram of a terminal of a network debugging method according to an embodiment of the present invention. Figure 1 As shown, the terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is for illustration only and does not limit the structure of the above terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0062] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the network debugging method in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0063] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (Radio Frequency, referred to as RF) module, which is used to communicate with the Internet wirelessly.

[0064] This embodiment provides a network debugging method. Figure 2 is a flow chart of a network debugging method according to an embodiment of the present application, such as Figure 2 As shown, the process includes the following steps:

[0065] Step S201, obtaining the number of request timeouts within a preset time period.

[0066] Among them, by establishing a connection timeout counter and a response timeout counter, the sliding window mechanism can be used to track and count the timeouts of HTTP requests within a preset specific time period (such as 5 minutes, 10 minutes, etc.). The sliding window mechanism slides a fixed-size window (i.e., the preset time period) on the data stream or data set, that is, adjusts the start and end positions of the window, and performs corresponding operations at each position as the fixed-size window moves gradually. This step can use the sliding window mechanism to update and calculate the number of HTTP request timeouts in real time within the time period. This step can more comprehensively understand the performance and stability of network requests through accurate statistics of the number of request timeouts. Real-time updates ensure the accuracy and timeliness of data, providing strong support for subsequent decision-making and adjustments.

[0067] Step S202: Generate an input instruction based on the number of request timeouts.

[0068] Among them, a connection timeout threshold is pre-set in the connection timeout counter to determine whether the number of request timeouts has reached the trigger condition. According to the comparison result of the statistical number of request timeouts and the preset threshold, the corresponding input instructions are generated, including connection timeout instructions and connection success instructions. This application establishes a finite state machine (a mathematical calculation model) to handle the transition between the states of the system and perform corresponding actions. The finite state machine contains a set of finite states and the transition rules between them. The input instruction refers to the corresponding instruction sent to the state machine at the end of each sliding window. In this step, by comparing the number of timeouts with the threshold, we can flexibly respond to different network conditions. The generation of input instructions is the basis for subsequent state transitions and parameter adjustments.

[0069] Step S203, obtaining the detected current network status.

[0070] Step S204: determine the target network state based on the input instruction, and switch the current network state to the target network state.

[0071] Among them, the finite state machine (FSM) or other state management tools can be used to track and record the current network state. By reading the current state of the state machine, we can obtain the basic health status of the network. The current network state refers to the operating status and performance of the network system at a specific time point or time period. The states recorded by the finite state machine include connection timeout state, connection recovery state, read timeout state, and read normal state. The finite state machine can be used to detect the current network state. After obtaining the current network state, the target state of the finite state machine is determined according to the input instructions and the preset state transition rules, and the state transition operation is performed to switch the current state to the target state. The real-time acquisition of the current network state in this step helps to accurately understand the actual status of the network and is the basis for performing the state transition operation. The state transition operation can ensure that the network state is consistent with the actual network status, so that the state can be adaptively adjusted to better cope with network changes.

[0072] Step S205: Based on the target network state, a corresponding debugging action is performed on the request parameters of the network request.

[0073] Among them, according to the target network status, adjust the relevant parameters of the HTTP request (such as the request timeout, etc.), and the debugging action can include operations such as increasing, decreasing or maintaining the current parameter value. For example, in a network request, if the request timeout is too long, it may cause the application to respond slowly. According to the current network status, the request timeout can be reasonably lowered, and the request can be quickly terminated when the request cannot be responded in time, thereby avoiding unnecessary waiting. In this step, by adaptively adjusting the request parameters, we can optimize the performance and stability of network requests, improve user experience and system efficiency.

[0074] Through the above steps, by specifically counting the number of HTTP request timeouts within a fixed time period, and generating corresponding input instructions based on the comparison results of the counted timeout number and the preset threshold, an accurate real-time network status can be obtained; by determining the target state of the finite state machine according to the input instructions and the preset state transition rules, executing the state transition operation, and switching the current state to the target state, the network can adaptively adjust the state; according to the target network state, adjust the relevant parameters of the HTTP request, if the request timeout is too long, reasonably lower the request timeout, and quickly terminate the request when the request cannot be responded to in time to avoid unnecessary waiting. This application dynamically adjusts key parameters such as the timeout parameters of the HTTP request according to the real-time network conditions, ensuring the stability and efficiency of the network request, which not only improves the overall performance of the system, but also provides users with a smoother and more reliable network experience.

[0075] In some embodiments, obtaining the number of request timeouts within a preset time period includes:

[0076] Use the sliding window mechanism to obtain the number of request timeouts within a preset time period.

[0077] Among them, the size of the sliding window is pre-set, that is, the length of a preset fixed time period (for example, the past 10 minutes), and a counter is established to record the number of timed-out requests in the current window. Compared with the statistical method of fixed time intervals, the sliding window mechanism is more flexible and accurate, and can accurately count the number of request timeouts in the preset time period; and can reflect the request timeouts in the current time period in real time, which helps to timely discover and deal with potential performance problems or network failures; it can also adapt to different time period lengths and timeout threshold settings, and has a wide range of applicability. In addition, the sliding window mechanism only needs to store the request records in the current window, so it occupies less resources, which makes this method have higher performance when processing a large number of requests.

[0078] In some embodiments, before obtaining the number of request timeouts within a preset time period, the method further includes:

[0079] Set the counting switch;

[0080] When the counting switch is turned on, the number of request timeouts within the preset time period begins to be obtained;

[0081] When the counting switch is turned off, the number of request timeouts within the preset time period is stopped.

[0082] Among them, a counting switch is set to control whether to record timeout requests. The counting switch allows users to dynamically turn on or off the counting function as needed without changing the underlying logic, and can accurately control when to start and stop counting, thereby ensuring the accuracy and relevance of the counting and improving the flexibility of the system.

[0083] In some embodiments, based on the number of request timeouts, generating an input instruction includes:

[0084] The number of request timeouts includes the number of connection timeouts;

[0085] Comparing the number of connection timeouts with a preset connection timeout count threshold;

[0086] When the number of connection timeouts exceeds the connection timeout count threshold, an input instruction is generated as a connection timeout instruction;

[0087] When the number of connection timeouts does not exceed the connection timeout count threshold, the input instruction is generated as a connection success instruction.

[0088] Among them, each time an input instruction is generated, the input instruction needs to be sent to a finite state machine so that the finite state machine can confirm the current network state and the target network state in real time. The number of connection timeouts is the number of times a connection request fails to complete successfully and reaches the timeout limit within a fixed time period. The connection timeout count threshold is a preset value used to determine the maximum number of connection timeout events allowed within a specific time period. By tracking the number of connection timeouts in real time, the system can promptly discover and respond to network connection problems. When the number of connection timeouts exceeds the threshold, the corresponding input instruction is automatically generated as a connection timeout instruction. When the number of connection timeouts does not exceed the threshold, the corresponding input instruction is automatically generated as a connection success instruction. After that, the connection timeout instruction will be input into the finite state machine for corresponding state transfer. The comparison result of the connection timeout number and the threshold in this embodiment can provide a basis for subsequent operations, so that the system can clearly understand the network status and make corresponding adjustments.

[0089] In some embodiments, after comparing the number of connection timeouts with a preset connection timeout count threshold, the method further includes:

[0090] The number of request timeouts also includes the number of response timeouts;

[0091] comparing the number of response timeouts with a preset response timeout count threshold;

[0092] When the number of response timeouts exceeds the response timeout count threshold, the input instruction is changed to a read timeout instruction;

[0093] When the number of response timeouts does not exceed the response timeout count threshold, the input command is changed to a read success command.

[0094] Among them, after comparing the number of connection timeouts with the preset connection timeout count threshold, the input instruction can be a connection timeout instruction or a connection success instruction. By comparing the number of response timeouts with the preset response timeout count threshold, the input instruction is modified to a read timeout instruction or a read success instruction. After each modification of the input instruction, the modified input instruction needs to be sent to the finite state machine so that the finite state machine can confirm the current network status and the target network status in real time. The number of response timeouts is the number of times the request issued has not received a complete response within a preset time, and the response timeout count threshold is the maximum number of response timeout events allowed to occur within a specific time period. By tracking the number of connection timeouts and response timeouts respectively, it is possible to more accurately understand the problems in network communications, understand the network status more clearly and make corresponding adjustments.

[0095] In some embodiments, obtaining the detected current network status includes:

[0096] If it is detected that the historical switching operation is missing, it is determined that the current network state is a connection recovery state, and the historical switching operation is an operation of switching the current network state to the target network state within the historical time period;

[0097] If it is detected that a historical switching operation has been performed, the current network state is determined according to the detection result of the network request during the transmission process.

[0098] Among them, each switching operation will leave a record in the finite state machine. The finite state machine can be used to check whether an operation of switching the current network state to the target network state has been performed within the historical time period. If no historical switching operation is detected, the current network state is the preset initial state, that is, it is set to the connection recovery state. The connection recovery state is one of the finite states of the finite state machine. The finite states of the finite state machine include the connection timeout state, the connection recovery state, the read timeout state, and the read normal state. If a switching operation has been performed within the historical time period, it is necessary to determine the current network state through real-time detection of the finite state machine. This embodiment presets the initial state when no state switching operation is performed, and directly determines the current network state when a switching operation has been performed, thereby improving the operation logic and providing a basis for subsequent state switching.

[0099] In some embodiments, determining a target network state based on an input instruction includes:

[0100] If the input command is a connection timeout command, determining that the target network state is a connection timeout state;

[0101] If the input command is a connection success command, determining that the target network state is a connection recovery state;

[0102] If the input command is a read timeout command, determining that the target network state is a read timeout state;

[0103] If the input command is a read success command, it is determined that the target network state is a read normal state.

[0104] Among them, determine the preset state transition rules, Figure 3 is a schematic diagram of the transition rules of the network debugging method according to an embodiment of the present application. The specific state transition rules are as follows Figure 3 For example, the current network state is a connection timeout state. If the input instruction is a connection timeout instruction, the target network state is determined to be a connection timeout state, and the current network state is switched to the target network state of connection timeout state; if the input instruction is a connection success instruction, the target network state is determined to be a connection recovery state, and the current network state is switched to the target network state of connection recovery state; if the input instruction is a read timeout instruction, the target network state is determined to be a read timeout state, and the current network state is switched to the target network state of read timeout state; if the input instruction is a read success instruction, the target network state is determined to be a normal read state, and the current network state is switched to the target network state of read normal state.

[0105] More specifically, the above state transition rule can be expressed by the following formula: (Wherein, ω represents the output function, Σ is the input instruction obtained in the previous step, S is the current network state set, and Γ is the target network state set). The input instruction set Σ contains the aforementioned four input instructions, and the current network state set S contains the aforementioned four current network states. Each input instruction can be combined with the four current network states to finally obtain the corresponding target network state. Then the current network state is switched to the target network state. There are also four network states in the target network state set Γ. If the current network state is the same as the target network state, no switching operation is performed. For example: when the current state is a connection timeout, inputting a connection success instruction will switch to the connection recovery state.

[0106] This embodiment determines the target state result by executing different instructions, which can ensure that the target network state is consistent with the actual network status, so that the state can be adaptively adjusted to better cope with network changes.

[0107] In some of the embodiments, based on the target network state, a corresponding debugging action is performed on the request parameters of the network request, including:

[0108] Get the preset adjustment parameters;

[0109] If the target network status is a connection timeout status, the connection timeout parameter is lowered based on the adjustment parameter;

[0110] If the target network status is a connection recovery status, the connection timeout parameter is increased based on the adjustment parameter;

[0111] If the target network status is a read timeout status, the read timeout parameter is lowered based on the adjustment parameter;

[0112] If the target network status is in a normal reading state, the read timeout parameter is increased based on the adjustment parameter;

[0113] The request parameters include a connection timeout parameter and a read timeout parameter. The connection timeout parameter is the maximum time to wait for a network connection to be successfully established, and the read timeout parameter is the maximum time to wait for reading response data.

[0114] This embodiment pre-sets adjustment parameters, which include the adjustment range of the timeout period and the upper and lower limit parameters of the timeout period. The request parameters of the network request include a connection timeout parameter and a read timeout parameter, which represent the timeout period of the connection or read. The target network status is also the real-time network status.

[0115] When the target network status is the connection timeout status, the connection timeout time is controlled to be lowered according to the adjustment range and the lower limit parameters. Because a long request timeout time may cause the application to respond slowly, a reasonable lowering of the request timeout time can quickly terminate the request when the request cannot be responded in time, thereby avoiding unnecessary waiting. This solves the problem of service instability caused by a long network connection timeout time when a large number of http calls to the downstream service interface are waiting for a long network connection timeout time when the network is abnormal.

[0116] When the target network status is the connection recovery status, the connection timeout time is controlled to be increased according to the adjustment range and the upper limit parameters. Because when the network status recovers from unstable to stable, increasing the connection timeout time can give the network more buffering and response time, which helps to reduce short-term connection failures caused by network fluctuations, thereby improving the stability and reliability of network connections. Increasing the connection timeout time can ensure that after the network is restored, user requests have enough time to establish connections and obtain responses, thereby improving user experience, reducing system resource consumption caused by frequent connection retries, using resources more efficiently, and processing more user requests. After the network is restored, the original network connection timeout parameters are restored to avoid affecting the normal connection of some interfaces that originally took a long time to connect.

[0117] When the target network status is the read timeout status, the read timeout time is controlled and lowered according to the adjustment range and the lower limit parameters. This solves the problem that when a large number of HTTP requests call the downstream service interface, the response timeout time of some or all interfaces is long due to partial or complete failure of the downstream service, so that the upstream service waits for the request response for a long time, causing the upstream service to be unstable. By reasonably lowering the request timeout time, the request can be quickly terminated when the request cannot be responded in time, thus avoiding unnecessary waiting.

[0118] When the target network status is in a normal reading state, the read timeout is adjusted upward according to the adjustment range and upper limit parameters. After the downstream service returns to normal, the read timeout is adjusted upward to restore the original response timeout parameters to avoid affecting the normal response of some interfaces that originally took a long time to respond.

[0119] The embodiments of the present application are described and illustrated below through preferred embodiments.

[0120] This preferred embodiment includes three modules: a management configuration module, a counter module, and a finite state machine.

[0121] Management configuration module: responsible for configuring the parameters of the management counter, such as switch, connection timeout count threshold, response timeout count threshold, sliding window size, etc. The configured parameters can be stored in the configuration center or database, etc.

[0122] Counter module: responsible for calculating the state transition conditions of the state machine. Using a sliding window mechanism, the number of connection / read timeout requests within a fixed window is calculated. When the configured threshold is exceeded, the input instruction is rewritten into a connection timeout instruction / read timeout instruction; when the configured threshold is not exceeded, the input instruction is rewritten into a connection success instruction / read success instruction. At the end of each sliding window, the corresponding instruction is sent to the state machine.

[0123] Finite state machine: responsible for handling transitions and actions between states, etc.

[0124] The main process is as follows:

[0125] S1, configuration parameters.

[0126] Configuration switch, connection timeout count threshold, read timeout count threshold, sliding window size, timeout adjustment range, timeout upper and lower limits. When closed, counting ends; when opened, counting starts.

[0127] S2, build a counter.

[0128] Establish a connection timeout counter. Use a sliding window mechanism to calculate the number of connection timeouts within a fixed window. When it exceeds the configured threshold, the input instruction is rewritten into a connection timeout instruction; when it does not exceed the configured threshold, the input instruction is rewritten into a connection success instruction. At the end of each sliding window, a corresponding instruction is sent to the state machine.

[0129] Establish a response timeout counter. Use a sliding window mechanism to calculate the request response timeout counter within a fixed window. When it exceeds the configured threshold, the input instruction is rewritten into a read timeout instruction; when it does not exceed the configured threshold, the input instruction is rewritten into a read success instruction. At the end of each sliding window, a corresponding instruction is sent to the state machine.

[0130] S3, build a finite state machine.

[0131] Determine the four states of the state machine: connection timeout state, connection recovery state, read timeout state, and read normal state.

[0132] The initial state of the state machine: connection recovery state.

[0133] S4, determine the transition rules for each state. For specific transitions, see Figure 3 .

[0134] For example: When the current state is connection timeout, inputting the connection success command will switch to the connection recovery state.

[0135] S5, determine the action for each state.

[0136] The action of the connection timeout state is to control and lower the connection timeout time according to the adjustment range and lower limit parameters;

[0137] The action of the connection recovery state is to control the upward adjustment of the connection timeout period according to the adjustment range and upper limit parameters;

[0138] The action of the read timeout state is to control the read timeout period downward according to the adjustment amplitude and lower limit parameters;

[0139] The action of reading the normal state is to control the increase of the read timeout period according to the adjustment range and the upper limit parameters.

[0140] This embodiment also provides a network debugging device, which is used to implement the above embodiments and preferred implementation modes, and will not be repeated here. As used below, the terms "module", "unit", "subunit", etc. can implement a combination of software and / or hardware for a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0141] Figure 4is a structural block diagram of a network debugging device according to an embodiment of the present application, such as Figure 4 As shown, the device comprises:

[0142] A counting module 10 is used to obtain the number of request timeouts within a preset time period;

[0143] The counting module 10 is further used to generate an input instruction based on the number of request timeouts;

[0144] The status confirmation module 20 is used to obtain the detected current network status;

[0145] The state confirmation module 20 is further used to determine the target network state based on the input instruction and switch the current network state to the target network state;

[0146] The debugging module 30 is used to perform corresponding debugging actions on the request parameters of the network request based on the target network state.

[0147] The counting module 10 is also used to obtain the number of request timeouts within a preset time period using a sliding window mechanism.

[0148] The counting module 10 is also used to set a counting switch;

[0149] When the counting switch is turned on, the number of request timeouts within the preset time period begins to be obtained;

[0150] When the counting switch is turned off, the number of request timeouts within the preset time period is stopped.

[0151] The counting module 10 is also used to request the number of timeouts including the number of connection timeouts;

[0152] Comparing the number of connection timeouts with a preset connection timeout count threshold;

[0153] When the number of connection timeouts exceeds the connection timeout count threshold, an input instruction is generated as a connection timeout instruction;

[0154] When the number of connection timeouts does not exceed the connection timeout count threshold, the input instruction is generated as a connection success instruction.

[0155] The counting module 10 is also used to count the number of request timeouts and the number of response timeouts;

[0156] comparing the number of response timeouts with a preset response timeout count threshold;

[0157] When the number of response timeouts exceeds the response timeout count threshold, the input instruction is changed to a read timeout instruction;

[0158] When the number of response timeouts does not exceed the response timeout count threshold, the input command is changed to a read success command.

[0159] The state confirmation module 20 is also used to determine that the current network state is a connection recovery state if it is detected that the historical switching operation is missing, and the historical switching operation is an operation of switching the current network state to the target network state within a historical time period;

[0160] If it is detected that a historical switching operation has been performed, the current network state is determined according to the detection result of the network request during the transmission process.

[0161] The state confirmation module 20 is also used to determine that the target network state is a connection timeout state if the input instruction is a connection timeout instruction;

[0162] If the input command is a connection success command, determining that the target network state is a connection recovery state;

[0163] If the input command is a read timeout command, determining that the target network state is a read timeout state;

[0164] If the input command is a read success command, it is determined that the target network state is a read normal state.

[0165] The above-mentioned debugging module 30 is also used to obtain preset adjustment parameters;

[0166] If the target network status is a connection timeout status, the connection timeout parameter is lowered based on the adjustment parameter;

[0167] If the target network status is a connection recovery status, the connection timeout parameter is increased based on the adjustment parameter;

[0168] If the target network status is a read timeout status, the read timeout parameter is lowered based on the adjustment parameter;

[0169] If the target network status is in a normal reading state, the read timeout parameter is increased based on the adjustment parameter;

[0170] The request parameters include a connection timeout parameter and a read timeout parameter. The connection timeout parameter is the maximum time to wait for a network connection to be successfully established, and the read timeout parameter is the maximum time to wait for reading response data.

[0171] It should be noted that the above modules can be functional modules or program modules, and can be implemented by software or hardware. For modules implemented by hardware, the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.

[0172] In addition, in combination with the network debugging method in the above embodiment, the embodiment of the present application can provide a storage medium for implementation. The storage medium stores a computer program; when the computer program is executed by a processor, any one of the network debugging methods in the above embodiment is implemented.

[0173] Those skilled in the art should understand that the technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0174] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A network debugging method, characterized in that: include: Get the number of request timeouts within a preset time period; generating an input instruction based on the number of request timeouts; Get the current detected network status; Based on the input instruction, determine a target network state, and switch the current network state to the target network state; Based on the target network state, performing corresponding debugging actions on the request parameters of the network request, including: Get the preset adjustment parameters; If the target network state is a connection timeout state, based on the adjustment parameter, lowering the connection timeout parameter; If the target network state is a connection recovery state, based on the adjustment parameter, increase the connection timeout parameter; If the target network state is a read timeout state, based on the adjustment parameter, lowering the read timeout parameter; If the target network state is a normal reading state, based on the adjustment parameter, increase the reading timeout parameter; The request parameters include the connection timeout parameter and the read timeout parameter. The connection timeout parameter is the maximum time to wait for a network connection to be successfully established, and the read timeout parameter is the maximum time to wait for reading response data.

2. The network debugging method according to claim 1, characterized in that: The obtaining of the number of request timeouts within a preset time period includes: The number of request timeouts within a preset time period is obtained by using a sliding window mechanism.

3. The network debugging method according to claim 1, characterized in that: Before obtaining the number of request timeouts within a preset time period, the method further includes: Set the counting switch; When the counting switch is turned on, the number of request timeouts within the preset time period begins to be obtained; When the counting switch is turned off, the acquisition of the number of request timeouts within the preset time period is stopped.

4. The network debugging method according to claim 1, characterized in that: The step of generating an input instruction based on the request timeout number includes: The request timeout number includes the connection timeout number; Comparing the connection timeout number with a preset connection timeout count threshold; When the number of connection timeouts exceeds the connection timeout count threshold, generating an input instruction as a connection timeout instruction; When the number of connection timeouts does not exceed the connection timeout count threshold, the input instruction is generated as a connection success instruction.

5. The network debugging method according to claim 4, characterized in that: After comparing the connection timeout quantity with a preset connection timeout count threshold, the method further includes: The request timeout number also includes the response timeout number; Comparing the response timeout number with a preset response timeout count threshold; When the number of response timeouts exceeds the response timeout count threshold, changing the input instruction to a read timeout instruction; When the response timeout number does not exceed the response timeout count threshold, the input instruction is changed to a read success instruction.

6. The network debugging method according to claim 5, characterized in that: The obtaining of the detected current network status includes: If it is detected that the historical switching operation is missing, determining that the current network state is a connection recovery state, and the historical switching operation is an operation of switching the current network state to the target network state within a historical time period; If it is detected that the historical switching operation has been performed, the current network state is determined according to a detection result of the network request during the transmission process.

7. The network debugging method according to claim 6, characterized in that: The step of determining the target network state based on the input instruction includes: If the input instruction is a connection timeout instruction, determining that the target network state is a connection timeout state; If the input instruction is a connection success instruction, determining that the target network state is a connection recovery state; If the input instruction is a read timeout instruction, determining that the target network state is a read timeout state; If the input instruction is a read success instruction, it is determined that the target network state is a read normal state.

8. A network debugging device, characterized in that: include: A counting module is used to obtain the number of request timeouts within a preset time period; The counting module is further used to generate an input instruction based on the number of request timeouts; A status confirmation module is used to obtain the detected current network status; The state confirmation module is further used to determine the target network state based on the input instruction, and switch the current network state to the target network state; A debugging module, used to perform corresponding debugging actions on the request parameters of the network request based on the target network state, including: Get the preset adjustment parameters; If the target network state is a connection timeout state, based on the adjustment parameter, lowering the connection timeout parameter; If the target network state is a connection recovery state, based on the adjustment parameter, increase the connection timeout parameter; If the target network state is a read timeout state, based on the adjustment parameter, lowering the read timeout parameter; If the target network state is a normal reading state, based on the adjustment parameter, increase the reading timeout parameter; The request parameters include the connection timeout parameter and the read timeout parameter. The connection timeout parameter is the maximum time to wait for a network connection to be successfully established, and the read timeout parameter is the maximum time to wait for reading response data.

9. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the network debugging method according to any one of claims 1 to 7 when running.

Citation Information

Patent Citations

  • Fuse and service adaptive fusing method

    CN114363153A