A flow control method and device, electronic equipment and storage medium

By dynamically adjusting traffic quotas, the backlog problem caused by downstream node performance degradation was resolved, and the efficiency of fault recovery and precise adaptation of traffic control were achieved.

CN123185142APending Publication Date: 2026-11-27SHANGHAI JIDOU TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611512868.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-28
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

In existing technologies, when the performance of downstream nodes degrades but they are not completely down, a one-size-fits-all blocking approach deprives downstream nodes of the opportunity to process backlogged requests, hindering fault recovery, preventing the utilization of their remaining carrying capacity, and reducing fault recovery efficiency.

Method used

The current request anomaly rate is determined based on the request and response information of upstream nodes. Combined with the current traffic control status and traffic quota, the target traffic quota is dynamically adjusted to smooth traffic changes, make full use of the remaining carrying capacity of downstream nodes, and gradually digest the internal backlog of requests.

Benefits of technology

It improves fault recovery efficiency, accurately adapts to the current operating conditions of downstream nodes, and enhances the accuracy and efficiency of flow control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123185142A_ABST
    Figure CN123185142A_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a flow control method and device, electronic equipment and storage medium, and relate to the technical field of computers. The method comprises: determining a current request exception rate based on request response information of service requests sent by an upstream node to a downstream node within a current observation window; determining a target flow quota for an adaptive next observation window based on the current request exception rate, a current flow control state and a current flow quota; and performing flow control on service requests sent by the upstream node to the downstream node within the next observation window according to the target flow quota. The target flow quota can be determined based on the current running health level of the downstream node, the flow changes are relatively smooth, thereby the residual carrying capacity of the downstream node can be fully utilized, and the fault recovery efficiency is improved, so that the current running condition of the downstream node can be accurately adapted, the accuracy and efficiency of flow control are improved, and the current flow control scene can be accurately adapted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a flow control method, apparatus, electronic device, and storage medium. Background Technology

[0002] In distributed systems and microservice architectures, there are a large number of business request calls between upstream and downstream nodes. When a downstream node fails or its performance degrades severely, if the upstream node continues to send requests, it will cause the following cascading effects: the upstream node's thread / connection resources will be exhausted and timeouts will occur, the request queue will accumulate, the upstream node itself will become unavailable, and this will affect the upstream caller nodes, eventually causing the entire distributed system to collapse.

[0003] To prevent such cascading failures, existing technologies introduce a circuit breaker mechanism. The circuit breaker includes a closed state, an open state, and a semi-open state. That is, the circuit breaker is in the closed state by default, allowing all requests from the upstream node to the downstream node to be passed normally. When the anomaly rate exceeds a threshold within the observation window, the circuit breaker switches to the open state, directly blocking all requests. After a fixed time window (e.g., 30 seconds), it enters the semi-open state, allowing a small number of probe requests to verify whether the downstream node has recovered. If all probe requests are successful, it is determined that the downstream node has recovered, and the circuit breaker switches to the closed state. If any probe request fails, it is determined that the downstream node has not recovered, and the circuit breaker switches to the open state.

[0004] However, the above scheme abstracts downstream nodes into a binary model, that is, either available (closed state) or unavailable (open state and half-open state). But the performance degradation of downstream nodes is a continuous range. For downstream nodes that have degraded in performance but have not completely crashed, the one-size-fits-all blocking method will deprive downstream nodes of the opportunity to digest the backlog of requests, which will hinder the recovery of downstream nodes, thereby reducing the efficiency of fault recovery. Furthermore, it will not be able to utilize the remaining carrying capacity of downstream nodes and will not be able to adapt to the current operating conditions of downstream nodes. Summary of the Invention

[0005] This application provides a flow control method, apparatus, electronic device, and storage medium, which can improve fault recovery efficiency and make full use of the remaining carrying capacity of downstream nodes, thereby solving the problem that the prior art cannot adapt to the current operating conditions of downstream nodes.

[0006] In a first aspect, embodiments of this application provide a flow control method applied to a flow control device in a distributed system, the distributed system further including multiple nodes. The method includes: determining the current request anomaly rate based on request response information of business requests sent from an upstream node to a downstream node within the current observation window; determining a target flow quota adapted to the next observation window based on the current request anomaly rate, the current flow control status, and the current flow quota; and performing flow control on business requests sent from an upstream node to a downstream node within the next observation window according to the target flow quota.

[0007] In this embodiment, the current request anomaly rate is determined based on the request and response information of service requests sent from upstream nodes to downstream nodes within the current observation window. This allows for the aggregation and statistical analysis of request information within the current observation window, avoiding instantaneous noise caused by single request anomalies, thus making the current request anomaly rate more stable and objectively reflecting the true operational health of downstream nodes. Then, based on the current request anomaly rate, the current flow control status, and the current flow quota, a target flow quota for the next observation window is determined. Flow control is then applied to service requests sent from upstream nodes to downstream nodes within the next observation window according to the target flow quota. The current flow quota is adjusted based on the current request anomaly rate and the current flow control status to determine... The target traffic quota for the next observation window can be determined based on the current operational health of downstream nodes. For example, when downstream nodes are normal, the current traffic quota can be kept unchanged or increased, while when downstream nodes are abnormal, the current traffic quota can be reduced. The traffic change is relatively smooth, rather than a one-size-fits-all blocking approach. This allows for full utilization of the remaining capacity of downstream nodes and enables downstream nodes to gradually digest internal backlogged requests by reducing their load when abnormal, allowing downstream nodes to recover on their own. This further improves fault recovery efficiency and accurately adapts to the current operating conditions of downstream nodes, improving the accuracy and efficiency of traffic control and precisely adapting to the current traffic control scenario.

[0008] Secondly, embodiments of this application provide a flow control device applied to a flow control device in a distributed system. The distributed system further includes multiple nodes. The device includes: a first determining module, used to determine the current request anomaly rate based on the request response information of service requests sent by an upstream node to a downstream node within the current observation window; a second determining module, used to determine a target flow quota adapted to the next observation window based on the current request anomaly rate, the current flow control status, and the current flow quota; and a control module, used to perform flow control on service requests sent by an upstream node to a downstream node within the next observation window according to the target flow quota.

[0009] Thirdly, embodiments of this application provide an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable 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 execute the flow control method of any embodiment of this application.

[0010] Fourthly, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the flow control method as described in any embodiment of this application.

[0011] The descriptions of the second, third, and fourth aspects in this application can be referenced to the detailed description of the first aspect; and the beneficial effects described in the second, third, and fourth aspects can be referenced to the analysis of the beneficial effects in the first aspect, which will not be repeated here.

[0012] In this application, the names of the aforementioned flow control devices do not limit the devices or functional modules themselves. In actual implementation, these devices or functional modules may appear under other names. As long as the functions of each device or functional module are similar to those in this application, they fall within the scope of the claims of this application and their equivalents.

[0013] These or other aspects of this application will become more readily apparent in the following description. Attached Figure Description

[0014] 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.

[0015] Figure 1 This is a flowchart illustrating the flow control method provided in an embodiment of this application; Figure 2 This is another schematic flowchart of the flow control method provided in the embodiments of this application; Figure 3 This is a schematic diagram of the flow control device provided in an embodiment of this application; Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0016] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this application.

[0017] It should be noted that the terms "first," "second," "target," and "original," etc., used 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 sequences other than those illustrated or described herein. Furthermore, the terms "comprising," "having," and any variations thereof are intended to cover a 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.

[0018] Figure 1 This is a flowchart illustrating a flow control method provided in an embodiment of this application. This embodiment can be applied to scenarios requiring control of request traffic between upstream and downstream nodes. The flow control method provided in this embodiment can be executed by a flow control device provided in this application, which can be implemented through software and / or hardware. In a specific embodiment, the flow control device can be integrated into an electronic device, which is a flow control device in a distributed system. The distributed system also includes multiple nodes. The flow control device is used to control the flow of requests between upstream and downstream nodes. For example, the electronic device can be a computer or server. The executing entity of this method can be an electronic device. See also... Figure 1 The flow control method in this embodiment includes, but is not limited to, the following steps: S110. Determine the current request anomaly rate based on the request and response information of business requests sent from upstream nodes to downstream nodes within the current observation window.

[0019] The observation window aggregates request and response information from business requests, serving as the statistical period for traffic control decisions. The window length can be preset according to the business scenario, such as 10 seconds. The current observation window is the one currently being statistically analyzed.

[0020] Request response information is the call return information corresponding to the business request collected after the upstream node initiates a business request to the downstream node. It includes information such as whether the request was successful, response timeout, status code, and response time, and is used to determine whether a single request is an abnormal request.

[0021] The current request anomaly rate is the ratio of the number of anomaly requests to the total number of business requests within the current observation window.

[0022] Specifically, the request and response information of business requests sent from upstream nodes to downstream nodes within the current observation window can be obtained. Then, the current request anomaly rate can be calculated based on the request and response information within the current observation window. That is, the total number of requests, the number of successful requests, and the number of failed requests are counted based on the request and response information within the current observation window, and the ratio of the number of failed requests to the total number of requests is calculated to obtain the current request anomaly rate.

[0023] The success count refers to the number of business requests that are successfully invoked within the current observation window. When the Hypertext Transfer Protocol (HTTP) status code in the request response information of a business request is 2xx / 3xx or the gRPC (Google Remote Procedure Call) status code is OK, the business request is considered to have been successfully invoked. Other methods can also be used to determine whether a business request has been successfully invoked, but this application embodiment does not specifically limit this.

[0024] The number of failures refers to the number of business requests that failed to be invoked within the current observation window. When the request response information of a business request includes call timeout, HTTP status code 5xx error, connection refused, or protocol layer exception, the business request is determined to have failed. Other methods can also be used to determine whether a business request has failed, but this application embodiment does not specifically limit this.

[0025] S120. Determine the target traffic quota for the next observation window based on the current request error rate, current traffic control status, and current traffic quota.

[0026] The next observation window is the statistical period that follows and is immediately adjacent to the current observation window, and there are no gaps or overlaps between adjacent observation windows.

[0027] The flow control state characterizes the operating mode of flow control. The current flow control state is the flow control state within the current observation window.

[0028] Traffic quota is the maximum number of business requests that an upstream node is allowed to send to a downstream node within an observation window. It is used to control the flow of business requests. For example, traffic quota can be the Queries-per-second (QPS) quota, which is the maximum number of business requests that an upstream node is allowed to send to a downstream node within an observation window.

[0029] The current flow quota is the flow quota within the current observation window. The target flow quota is the flow quota within the next observation window.

[0030] Specifically, after determining the current request anomaly rate, the current flow control status of the current observation window can be obtained, and the current flow quota of the current observation window can be obtained.

[0031] Next, the target traffic quota for the next observation window can be determined based on the current request error rate, the current traffic control status, and the current traffic quota. For example, the current request error rate, the current traffic control status, and the current traffic quota can be input into a pre-set discriminator. This discriminator modifies the current traffic quota based on the current request error rate and the current traffic control status to output a traffic quota that adapts to the current traffic control scenario, i.e., the target traffic quota for the next observation window.

[0032] Specifically, the traffic control state can include a normal steady-state state, a rate-limiting and degradation state, and a recovery state. The discrimination logic inside the discriminator is as follows: If the current traffic control state is a normal steady-state state, and the current request anomaly rate is not greater than the preset anomaly rate threshold, it indicates that the downstream node is in a normal operating state. At this time, the traffic quota is maintained at the preset traffic quota upper limit, that is, the target traffic quota is determined to be the preset traffic quota upper limit. At this time, the next observation window is still in the normal steady-state state. If the current traffic control state is a normal steady-state state, and the current request anomaly rate is greater than the preset anomaly rate threshold, it indicates that the downstream node is in an abnormal state. At this time, the traffic quota needs to be reduced, that is, the product of the current traffic quota and the preset reduction factor is calculated to obtain the target traffic quota. The preset reduction factor has a value range of (0,1), for example, 0.5, to achieve a gradual reduction of the quota, and the next observation window is in the rate-limiting and degradation state.

[0033] If the current traffic control status is rate limiting and degradation, and the current request anomaly rate is greater than the preset anomaly rate threshold, it indicates that the downstream node is in an abnormal state. In this case, the traffic quota needs to be further reduced. That is, the current traffic quota is calculated by multiplying the current traffic quota by the preset reduction factor to obtain the target traffic quota, so as to gradually reduce the quota, and the next observation window is still in the rate limiting and degradation state. If the current traffic control status is rate limiting and degradation, and the current request anomaly rate is not greater than the preset anomaly rate threshold, it indicates that the downstream node is in a normal operating state. In this case, the traffic quota needs to be increased. That is, the current traffic quota is calculated by multiplying the current traffic quota by the preset amplification factor to obtain the target traffic quota, where the preset amplification factor is greater than 1, for example 2, so as to gradually increase the quota, and the next observation window is in the recovery state.

[0034] If the current traffic control status is in recovery mode and the current request anomaly rate is not greater than the preset anomaly rate threshold, it indicates that the downstream node is in normal operation. In this case, the traffic quota needs to be increased further. This involves calculating the product of the current traffic quota and the preset amplification factor to obtain the target traffic quota, thus gradually increasing the quota. The next observation window will still be in recovery mode. If the current traffic control status is in recovery mode and the current request anomaly rate is greater than the preset anomaly rate threshold, it indicates that the downstream node is in an abnormal state. In this case, the traffic quota needs to be reduced. This involves calculating the product of the current traffic quota and the preset reduction factor to obtain the target traffic quota, thus gradually reducing the quota. The next observation window will be in rate limiting and degradation mode.

[0035] The preset traffic quota limit is the maximum number of requests that a downstream node can handle when it is operating normally. During the recovery process, if the traffic quota reaches the preset limit, it needs to transition to a normal steady-state state to avoid continuously increasing the traffic quota.

[0036] S130. Perform traffic control on the service requests sent from the upstream node to the downstream node in the next observation window according to the target traffic quota.

[0037] Specifically, after determining the target traffic quota, the system uses this quota as a traffic threshold to control the flow of service requests sent from upstream nodes to downstream nodes within the next observation window. Specifically, within the next observation window, if the number of service requests from upstream nodes to downstream nodes does not exceed the target traffic quota, these requests are allowed to proceed to the downstream nodes, enabling them to process the requests and send corresponding responses back to the upstream nodes. Conversely, if the number of service requests from upstream nodes to downstream nodes exceeds the target traffic quota, these requests are blocked to prevent them from reaching the downstream nodes. Then, a fallback response corresponding to the blocked service requests is sent back to the upstream nodes according to a preset fallback strategy. The preset fallback strategy can be configured according to the actual application scenario.

[0038] The technical solution of this application embodiment determines the current request anomaly rate based on the request and response information of service requests sent from upstream nodes to downstream nodes within the current observation window. This allows for the aggregation and statistical analysis of request information within the current observation window, avoiding instantaneous noise caused by single request anomalies, thus making the current request anomaly rate more stable and objectively reflecting the true operational health of downstream nodes. Then, based on the current request anomaly rate, the current flow control status, and the current flow quota, a target flow quota for the next observation window is determined. Flow control is then applied to service requests sent from upstream nodes to downstream nodes within the next observation window according to the target flow quota. The current flow quota is adjusted based on the current request anomaly rate and the current flow control status. Determining the target traffic quota for the next observation window can be based on the current operational health of downstream nodes. For example, when downstream nodes are functioning normally, the current traffic quota can be kept unchanged or increased, while when downstream nodes are abnormal, the current traffic quota can be reduced. This results in a smoother traffic change rather than a one-size-fits-all blocking approach, thus fully utilizing the remaining capacity of downstream nodes. Furthermore, it allows downstream nodes to gradually digest internal backlogged requests by reducing their load during abnormal situations, enabling them to recover on their own and further improving fault recovery efficiency. This allows for precise adaptation to the current operating conditions of downstream nodes, improving the accuracy and efficiency of traffic control and accurately adapting to the current traffic control scenario.

[0039] The following further describes a flow control method provided by an embodiment of this application. Figure 2 This is another schematic flowchart of the flow control method provided in this application. The embodiments of this application are optimizations based on the above embodiments. See also... Figure 2 The method in this embodiment includes, but is not limited to, the following steps: S210. Determine the current request anomaly rate based on the request and response information of business requests sent from upstream nodes to downstream nodes within the current observation window.

[0040] S220. Determine the target flow control state for the next observation window based on the current request error rate, current flow control state, and current flow quota.

[0041] Optionally, the flow control state may include normal steady-state state, flow limiting and degradation state, flow blocking state, and detection state.

[0042] Optionally, the flow control status may also include incremental recovery status, rollback recovery status, and cooling recovery status.

[0043] Among them, the traffic quota corresponding to the normal steady state is the preset traffic quota upper limit.

[0044] The traffic quota corresponding to the traffic blocking state is zero; the traffic quota corresponding to the probe state is the preset lower limit of the traffic quota; the preset lower limit of the traffic quota is the minimum number of requests to be allowed when the downstream node is abnormal, which is a small value and is greater than 0; after maintaining the corresponding observation window in the traffic blocking state, it switches to the probe state to detect whether the downstream node has returned to normal.

[0045] The observation window corresponding to the flow blocking state can be the same as or different from the observation window corresponding to other flow control states. For example, the observation window corresponding to the flow blocking state can be a preset cooldown time (e.g., 60 seconds), which is longer than the duration of the observation window corresponding to other flow control states.

[0046] The range of traffic quota corresponding to the rate limiting and degradation state is [preset traffic quota lower limit, preset traffic quota upper limit); where the rate limiting and degradation state is a state in which the traffic quota is gradually reduced, so the traffic quota corresponding to the rate limiting and degradation state will not reach the preset traffic quota upper limit.

[0047] The range of traffic quota corresponding to the incremental recovery state is (preset traffic quota lower limit, preset traffic quota upper limit]; where, the incremental recovery state is a state in which the traffic quota gradually increases, and therefore the traffic quota corresponding to the incremental recovery state will not be less than or equal to the preset traffic quota lower limit.

[0048] The range of traffic quota values ​​corresponding to the cooling recovery state is (preset lower limit of traffic quota, preset upper limit of traffic quota).

[0049] The range of traffic quota corresponding to the rollback recovery state is [preset traffic quota lower limit, preset traffic quota upper limit); where rollback recovery state is the state obtained after reducing the traffic quota under the conditions of incremental recovery state or cooldown recovery state, so the traffic quota corresponding to the rollback recovery state will not reach the preset traffic quota upper limit.

[0050] It should be noted that, apart from maintaining the original traffic state, the system can only switch from the normal steady-state state to the rate limiting and degradation state. From the rate limiting and degradation state, it can switch to the incremental recovery state or the traffic blocking state. From the incremental recovery state, it can switch to the cooling recovery state, the rollback recovery state, or the normal steady-state state. From the cooling recovery state, it can switch to the incremental recovery state, the rollback recovery state, or the normal steady-state state. From the rollback recovery state, it can switch to the incremental recovery state, the rate limiting and degradation state, or the traffic blocking state. From the traffic blocking state, it can only switch to the detection state. From the detection state, it can switch to the traffic blocking state or the incremental recovery state.

[0051] Optionally, the first anomaly rate threshold and the second anomaly rate threshold are both less than 1, and the first anomaly rate threshold is less than the second anomaly rate threshold. These are pre-set thresholds used to determine whether a downstream node is abnormal. That is, when the current request anomaly rate is not greater than the first anomaly rate threshold, it indicates that the anomaly of the business requests sent by the upstream node to the downstream node within the current observation window is within a safe range, and the downstream node is in normal operation. When the current request anomaly rate is greater than the first anomaly rate threshold but not greater than the second anomaly rate threshold, it indicates that the downstream node is in an abnormal state, and the degree of anomaly is low. The anomaly at this time may be caused by the instantaneous fluctuation of the downstream node (such as network fluctuation). When the current request anomaly rate is greater than the second anomaly rate threshold, it indicates that the downstream node is in an abnormal state, and the degree of anomaly is high. The anomaly at this time is not caused by the instantaneous fluctuation of the downstream node.

[0052] Specifically, when the current flow control state is a normal steady state and the current request anomaly rate is not greater than the first anomaly rate threshold, it indicates that the downstream node is in a normal operating state. Therefore, it can continue to maintain a normal steady state in the next observation window, that is, the target flow control state is determined to be a normal steady state.

[0053] If the current flow control state is a normal steady state, the request anomaly rate in the previous observation window is not greater than the first anomaly rate threshold, and the current request anomaly rate is greater than the first anomaly rate threshold but not greater than the second anomaly rate threshold, it indicates that the downstream node is in an abnormal state. However, the request anomaly may be caused by the instantaneous fluctuation of the downstream node. At this time, it is necessary to continue to maintain the current flow quota in the next observation window to determine whether the request anomaly is caused by the instantaneous fluctuation. That is, the next observation window continues to maintain the normal steady state, thereby determining that the target flow control state is a normal steady state.

[0054] If the current flow control state is a normal steady state, and the request anomaly rate of a consecutive preset number of historical observation windows (e.g., 2) is greater than the first anomaly rate threshold, and the current request anomaly rate is greater than the first anomaly rate threshold but not greater than the second anomaly rate threshold, it indicates that the downstream node is in an abnormal state, but not due to the instantaneous fluctuation of the downstream node. In this case, the flow quota needs to be reduced in the next observation window, that is, the flow control quota needs to be switched to the flow limiting and degradation state in the next observation window. This determines the target flow control state as the flow limiting and degradation state. The historical observation window is the observation window that is before and adjacent to the current observation window. It can prevent false degradation caused by brief jitter (e.g., a sudden increase in the anomaly rate of a single window due to a single network interruption).

[0055] If the current flow control state is a normal steady state and the current request anomaly rate is greater than the second anomaly rate threshold, it indicates that the downstream node is in an abnormal state. At this time, the flow quota needs to be reduced in the next observation window, that is, the flow control should be switched to the flow limiting and degradation state in the next observation window. This determines the target flow control state as the flow limiting and degradation state.

[0056] Since the rate limiting and degradation state involves a gradual reduction in traffic quota, when the traffic quota corresponding to the rate limiting and degradation state is greater than the preset lower limit of traffic quota, the traffic quota can be further reduced. If the downstream node is in normal operation at this time, it needs to switch to the incremental recovery state in the next observation window; if the downstream node is in an abnormal state, the rate limiting and degradation state needs to be maintained in the next observation window. Therefore, when the current traffic control state is the rate limiting and degradation state, the current traffic quota is greater than the preset lower limit of traffic quota, and the current request anomaly rate is greater than the first anomaly rate threshold, it indicates that the downstream node is in an abnormal state and the traffic quota needs to be further reduced, that is, the rate limiting and degradation state needs to be maintained in the next observation window. Thus, the target traffic control state is determined to be the rate limiting and degradation state.

[0057] It should be noted that if the current observation window is still greater than the first anomaly rate threshold when the system is already under rate limiting and degradation, it indicates that the request anomaly is not caused by instantaneous fluctuations in downstream nodes.

[0058] When the traffic quota corresponding to the rate limiting and degradation state is equal to the preset lower limit of the traffic quota, the traffic quota cannot be further reduced. If the downstream node is in a normal operating state, it needs to switch to the incremental recovery state in the next observation window. If the downstream node is in an abnormal state, it needs to switch to the traffic blocking state in the next observation window. Therefore, when the current traffic control state is rate limiting and degradation, the current traffic quota is not greater than the preset lower limit of the traffic quota, and the current request anomaly rate is greater than the first anomaly rate threshold, it indicates that the downstream node is in an abnormal state and the traffic quota needs to be further reduced. However, the current traffic quota has already reached the minimum and cannot be further reduced. Therefore, it needs to switch to the traffic blocking state in the next observation window, thus determining the target traffic control state as the traffic blocking state. When the current traffic control state is rate limiting and degradation, and the current request anomaly rate is not greater than the first anomaly rate threshold, it indicates that the downstream node is in a normal operating state. In this case, regardless of whether the current traffic quota is greater than or equal to the preset lower limit of the traffic quota, it can switch to the incremental recovery state in the next observation window, thus determining the target traffic control state as the incremental recovery state.

[0059] When the current flow control state is the flow blocking state, it indicates that it is necessary to switch to the probe state in the next observation window, thus determining the target flow control state as the probe state.

[0060] If the current flow control state is in the probing state and the current request anomaly rate is greater than the first anomaly rate threshold, it indicates that the downstream node is still in an abnormal state, and the request anomaly is not caused by instantaneous fluctuations in the downstream node. In this case, it is necessary to switch back to the flow blocking state in the next observation window to continue cooling down, thus determining the target flow control state as the flow blocking state. If the current flow control state is in the probing state and the current request anomaly rate is not greater than the first anomaly rate threshold, it indicates that the downstream node is in a normal operating state. In this case, it is necessary to increase the flow quota in the next observation window, that is, switch to the incremental recovery state in the next observation window, thus determining the target flow control state as the incremental recovery state.

[0061] When the current traffic control state is an incremental recovery state, the current traffic quota has reached the preset traffic quota limit, and the current request anomaly rate is not greater than the first anomaly rate threshold, it indicates that the downstream node is in normal operation and the traffic quota needs to be increased in the next observation window. However, the current traffic quota has already reached the maximum and the traffic quota cannot be increased further. At this time, the preset traffic quota limit needs to be maintained in the next observation window, that is, the normal steady state is switched in the next observation window. Thus, the target traffic control state is determined to be the normal steady state.

[0062] When the current flow control state is an incremental recovery state, the current request anomaly rate is not greater than the first anomaly rate threshold, and the current flow quota is less than the preset flow quota limit, it indicates that the downstream node is in normal operation. At this time, it is necessary to continue to increase the flow quota in the next observation window, that is, to continue to maintain the incremental recovery state in the next observation window, thereby determining the target flow control state as an incremental recovery state.

[0063] When the current traffic control state is the incremental recovery state, and the current request anomaly rate is greater than the first anomaly rate threshold but not greater than the second anomaly rate threshold, it indicates that the downstream node is in an abnormal state, and the request anomaly may be caused by the instantaneous fluctuation of the downstream node. At this time, it is necessary to continue to maintain the current traffic quota in the next observation window to determine whether the request anomaly is caused by the instantaneous fluctuation. That is, the next observation window switches to the cooldown recovery state, thereby determining the target traffic control state as the cooldown recovery state.

[0064] When the current flow control state is incremental recovery state and the current request anomaly rate is greater than the second anomaly rate threshold, it indicates that the downstream node is in an abnormal state and the request anomaly is not caused by the instantaneous fluctuation of the downstream node. At this time, the flow quota needs to be reduced in the next observation window, that is, the next observation window switches to the rollback recovery state, thereby determining the target flow control state as the rollback recovery state.

[0065] When the current flow control state is in the cooling recovery state, the current flow quota has reached the preset flow quota limit, and the current request anomaly rate is not greater than the first anomaly rate threshold, it indicates that the downstream node is in normal operation and the flow quota needs to be increased in the next observation window. However, the current flow quota has already reached the maximum and the flow quota cannot be increased further. At this time, the preset flow quota limit needs to be maintained in the next observation window, that is, the normal steady state is switched in the next observation window. Thus, the target flow control state is determined to be the normal steady state.

[0066] When the current flow control state is in the cooling recovery state, the current request anomaly rate is not greater than the first anomaly rate threshold, and the current flow quota is less than the preset flow quota limit, it indicates that the downstream node is in normal operation. At this time, the flow quota needs to be increased in the next observation window, that is, the flow quota needs to be switched to the incremental recovery state in the next observation window, thus determining the target flow control state as the incremental recovery state.

[0067] When the current flow control state is in the cooldown recovery state and the current request anomaly rate is greater than the first anomaly rate threshold, it indicates that the downstream node is in an abnormal state and the request anomaly is not caused by instantaneous fluctuations. At this time, the flow quota needs to be reduced in the next observation window, that is, the flow control state is switched to the rollback recovery state in the next observation window, thus determining the target flow control state as the rollback recovery state.

[0068] When the current flow control state is in the rollback recovery state and the current request anomaly rate is not greater than the first anomaly rate threshold, it indicates that the downstream node is in normal operation. At this time, it is necessary to increase the flow quota in the next observation window, that is, switch to the incremental recovery state in the next observation window, thereby determining the target flow control state as the incremental recovery state.

[0069] When the current traffic control state is in the rollback recovery state, the current request anomaly rate is greater than the first anomaly rate threshold, and the current traffic quota is greater than the preset traffic quota lower limit, it indicates that the downstream node is in an abnormal state and the request anomaly is not caused by instantaneous fluctuations. At this time, the traffic quota needs to be reduced in the next observation window, that is, the traffic limit degradation state needs to be switched to the rate limiting degradation state in the next observation window, thus determining the target traffic control state as the rate limiting degradation state.

[0070] When the current traffic control state is in the rollback recovery state, the current request anomaly rate is greater than the first anomaly rate threshold, and the current traffic quota is not greater than the preset traffic quota lower limit, it indicates that the downstream node is in an abnormal state, and the request anomaly is not caused by instantaneous fluctuations. It is necessary to continue to reduce the traffic quota. However, the current traffic quota has already reached the minimum and cannot be further reduced. Therefore, it is necessary to switch to the traffic blocking state in the next observation window. Thus, the target traffic control state is determined to be the traffic blocking state.

[0071] S230. Determine the target flow quota for the next observation window based on the target flow control status.

[0072] Specifically, when the target flow control state is in a normal steady state, the target flow quota is determined to be the preset flow quota upper limit.

[0073] When the target flow control state is flow blocking, the target flow quota is set to zero.

[0074] When the target flow control state is in the probe state, the target flow quota is determined to be the preset lower limit of the flow quota.

[0075] When the target flow control state is in the cooldown recovery state, the target flow quota is determined to be the current flow quota.

[0076] When the target traffic control state is in the rollback recovery state, the target traffic quota is determined based on the current traffic quota and the preset rollback factor. The preset rollback factor is a pre-set rollback ratio, which is less than 1 and greater than the preset baseline reduction factor. That is, the target traffic quota = clamp(preset traffic quota lower limit, current traffic quota × preset rollback factor, preset traffic quota upper limit) to reduce the current traffic quota. Here, clamp(lower limit, current value, upper limit) is used to limit the value between the lower limit and the upper limit. In this case, clamp() is used to limit the target traffic quota between the preset traffic quota lower limit and the preset traffic quota upper limit.

[0077] When the target traffic control state is rate limiting and degradation, the target reduction factor is determined based on the current request anomaly rate, and the target traffic quota is determined based on the current traffic quota and the target reduction factor. That is, the target traffic quota = clamp(preset traffic quota lower limit, current traffic quota × target reduction factor, preset traffic quota upper limit).

[0078] Optionally, the target reduction factor can be determined based on the current request anomaly rate, and may include Sa1-Sa4: Sa1. Determine the deviation correction coefficient based on the deviation between the current request anomaly rate and the first anomaly rate threshold.

[0079] Wherein, deviation correction coefficient = clamp(preset deviation correction coefficient lower limit, 1 - k1 × (E) cur -E0)÷(1-E0),1), where k1 is the preset deviation sensitivity, used to characterize the sensitivity of the deviation correction coefficient to the deviation between the current request anomaly rate and the first anomaly rate threshold. The preset deviation sensitivity ranges from (0,1]; E cur E0 is the current request exception rate, and E0 is the first exception rate threshold.

[0080] The deviation correction coefficient ranges from [preset deviation correction coefficient lower limit, 1], such as [0.5, 1], so that the deviation correction coefficient is 1 when the current request anomaly rate does not exceed the first anomaly rate threshold. As a result, the more the current request anomaly rate exceeds the first anomaly rate threshold, the smaller the corresponding deviation correction coefficient becomes, and the greater the reduction in the current traffic quota.

[0081] Sa2. Calculate the anomaly rate of change based on the current request anomaly rate and the request anomaly rate of the previous observation window, and calculate the anomaly rate correction coefficient based on the anomaly rate of change.

[0082] Wherein, abnormal change rate = (E cur -E prev )÷T, where, E prevIt is the request anomaly rate of the previous observation window, T is the duration of the current observation window, and there are no gaps or overlaps between adjacent observation windows.

[0083] Anomaly rate correction coefficient = clamp(preset anomaly rate correction coefficient lower limit, 1 - k2 × (E)) cur -E prev )÷T,1), where k2 is the preset anomaly rate sensitivity, which is used to characterize the sensitivity of the anomaly rate correction coefficient to the anomaly rate of change. The preset anomaly rate sensitivity ranges from (0,1).

[0084] The range of the abnormal rate correction coefficient is [preset lower limit of abnormal rate correction coefficient, 1], for example [0.6, 1]. This ensures that when the abnormal rate of change is not greater than 0, the abnormal rate correction coefficient is 1, and no additional penalty is imposed. Consequently, the larger the abnormal rate of change, the smaller the corresponding abnormal rate correction coefficient, the smaller the corresponding target reduction factor, and the greater the reduction in the current traffic quota.

[0085] Sa3. Determine the proportion of each anomaly type based on the request and response information within the current observation window, and calculate the anomaly type correction coefficient based on the proportion of each anomaly type.

[0086] Wherein, the anomaly type correction coefficient = Where n is the total number of exception types, p i It is the percentage of the i-th anomaly type within the current observation window; ω i The preset baseline weight for the i-th anomaly type is determined, and the higher the fault severity of the anomaly type, the smaller the corresponding preset baseline weight; the range of the anomaly type correction coefficient is (0,1).

[0087] The higher the proportion of high-fault anomaly types, the smaller the corresponding anomaly type correction coefficient, the smaller the corresponding target reduction factor, and the greater the reduction in the current traffic quota.

[0088] Specifically, the anomaly type of the corresponding business request can be determined based on the request and response information, the number of business requests included in each anomaly type in the current observation window can be counted, and the ratio of the number of business requests included in each anomaly type to the total number of business requests in the current observation window can be calculated to obtain the proportion of the corresponding anomaly type.

[0089] Sa4. Determine the target reduction factor based on the preset benchmark reduction factor, deviation correction factor, anomaly rate correction factor, and anomaly type correction factor.

[0090] The preset baseline shrinkage factor is a pre-set basic shrinkage factor, and the value range of the preset baseline shrinkage factor is (0,1).

[0091] Target reduction factor = clamp(preset reduction factor lower limit, preset baseline reduction factor × deviation correction coefficient × anomaly rate correction coefficient × anomaly type correction coefficient, preset reduction factor upper limit); where the preset reduction factor upper limit is less than 1 and the preset reduction factor lower limit is greater than 0.

[0092] In this embodiment, the larger the deviation between the current request anomaly rate and the first anomaly rate threshold, the greater the anomaly change rate, and the higher the proportion of anomaly types with high failure severity, the smaller the corresponding target reduction factor, thereby making the current traffic quota reduction degree higher, so that the target reduction factor conforms to the current operating scenario of the downstream node.

[0093] When the target traffic control state is in the incremental recovery state, the target amplification factor is determined based on the current request anomaly rate, and the target traffic quota is determined based on the current traffic quota and the target amplification factor.

[0094] Optionally, the target amplification factor can be determined based on the current request anomaly rate, and may include Sb1-Sb4: Sb1. Determine the number of continuously increasing recovery windows in real time, and calculate the recovery stability correction coefficient based on the number of continuously increasing recovery windows in real time.

[0095] The real-time continuously increasing recovery window count is the number of windows that were in the continuously increasing recovery state most recently in the current recovery session. In the current recovery session, whenever the system switches from the increasing recovery state to the cooldown recovery state, from the increasing recovery state to the rollback recovery state, or from the cooldown recovery state to the rollback recovery state, the real-time continuously increasing recovery window count is reset to 0.

[0096] The current recovery session begins with the transition from the rate limiting / degradation state or the probe state to the incremental recovery state, and ends with the transition to the rate limiting / degradation state, the normal steady-state state, or the traffic blocking state. In other words, the transition from the rate limiting / degradation state or the probe state to the incremental recovery state marks the start of this recovery session. During this recovery session, the transition to the rate limiting / degradation state, the normal steady-state state, or the traffic blocking state signifies the end of this recovery session.

[0097] Stability restoration correction factor = clamp(1, 1 + k3 × C) cur , preset upper limit of recovery stabilization correction coefficient), where k3 is the preset recovery stabilization sensitivity, used to characterize the sensitivity of the recovery stabilization correction coefficient to the number of continuously increasing recovery windows in real time. The value range of the preset recovery stabilization sensitivity is (0,1]; C cur It is a real-time continuously increasing recovery window number; the value range of the recovery stability correction coefficient is [1, preset upper limit of recovery stability correction coefficient], for example [1, 1.3].

[0098] The observation window of the first incremental recovery state in the current recovery session has a recovery stability correction coefficient of 1 and no additional acceleration is performed. As a result, the more real-time continuously incremental recovery windows there are, the larger the corresponding recovery stability correction coefficient, the larger the corresponding target amplification factor, and the greater the increase in the current traffic quota.

[0099] Sb2. Determine the real-time number of recovery oscillation events in the current recovery session, and calculate the recovery oscillation risk correction coefficient based on the real-time number.

[0100] The recovery oscillation events include events that switch from incremental recovery to cooldown recovery, events that switch from incremental recovery to rollback recovery, and events that switch from cooldown recovery to rollback recovery. The real-time count is the number of recovery oscillation events in the current recovery session; a higher real-time count indicates a greater likelihood of repeated failures in downstream nodes.

[0101] Recovery Oscillation Risk Correction Coefficient = clamp(Preset Lower Limit of Recovery Oscillation Risk Correction Coefficient, 1 - k4 × min(N)) cur N max )÷N max ,1), where k4 is the preset recovery oscillation risk sensitivity, used to characterize the sensitivity of the recovery oscillation risk correction coefficient to the real-time number of times, and its value range is (0,1]; N cur It is the number of times in real time, N max This is a preset upper limit for the number of recovery oscillation events to prevent unlimited decay, such as 3.

[0102] The range of the recovery oscillation risk correction coefficient is [preset recovery oscillation risk correction coefficient lower limit, 1]. The more real-time events the recovery oscillation event has, the smaller the corresponding recovery oscillation risk correction coefficient, the smaller the corresponding target amplification factor, and the smaller the increase in the current traffic quota, so as to suppress the increase rate of the traffic quota.

[0103] Sb3. Calculate the safety margin correction coefficient based on the deviation between the first anomaly rate threshold and the current request anomaly rate.

[0104] Wherein, the safety margin correction factor = clamp(1,1+k5×(E0-E cur )÷E0, preset safety margin correction coefficient upper limit), where k5 is the preset safety margin sensitivity, used to characterize the sensitivity of the safety margin correction coefficient to the deviation between the first anomaly rate threshold and the current request anomaly rate, and the value range is (0,1).

[0105] The range of the safety margin correction coefficient is [1, preset upper limit of safety margin correction coefficient]. The larger the deviation between the first anomaly rate threshold and the current request anomaly rate, the larger the corresponding safety margin, the larger the corresponding safety margin correction coefficient, the larger the corresponding target amplification factor, and the greater the increase in the current traffic quota, so that the safety margin is more sufficient and the recovery step size is larger. The less sufficient the safety margin, the more conservative the recovery step size.

[0106] Sb4. Determine the target amplification factor based on the preset benchmark amplification factor, the recovery stability correction factor, the recovery oscillation risk correction factor, and the safety margin correction factor.

[0107] The preset reference magnification factor is a pre-set reference magnification factor, and the preset reference magnification factor is greater than 1.

[0108] Target amplification factor = clamp(preset amplification factor lower limit, preset benchmark amplification factor × recovery stability correction coefficient × recovery oscillation risk correction coefficient × safety margin correction coefficient, preset amplification factor upper limit); where the preset amplification factor lower limit is greater than 1, such as 1.05, to ensure at least a small increase.

[0109] In this embodiment, the more real-time continuously increasing recovery windows, the fewer real-time recovery oscillation events, and the greater the deviation between the first anomaly rate threshold and the current request anomaly rate, the larger the corresponding target amplification factor, which in turn makes the current traffic quota amplification degree higher, so that the target amplification factor conforms to the current operating scenario of the downstream node.

[0110] S240. Perform traffic control on the service requests sent from the upstream node to the downstream node in the next observation window according to the target traffic quota.

[0111] For example, if the preset number is 2, when an upstream node sends a service request to a downstream node, the traffic control state of observation window 1 is in a normal steady state, and the traffic quota of observation window 1 is the preset traffic quota upper limit. If the request anomaly rate of observation window 1 is greater than the first anomaly rate threshold but not greater than the second anomaly rate threshold, the traffic control state of observation window 2 is in a normal steady state, and the traffic quota of observation window 2 is the preset traffic quota upper limit. If the request anomaly rate of observation window 2 is still greater than the first anomaly rate threshold, the traffic control state of observation window 3 is in a rate limiting and degradation state, and the traffic quota of observation window 3 is determined. If the request anomaly rate of observation window 3 is still greater than the first anomaly rate threshold, the traffic control state of observation window 4 is in a rate limiting and degradation state, and the traffic quota of observation window 4 is determined.

[0112] If the request anomaly rate in observation window 4, and subsequently observation windows 5 and 6, remains greater than the first anomaly rate threshold, then the traffic control status of observation windows 5, 6, and 7 will all be in a rate-limiting / degradation state until the traffic quota of observation window 7 is reduced to the preset lower limit of the traffic quota. If the request anomaly rate in observation window 7 remains greater than the first anomaly rate threshold, then the traffic control status of observation window 8 will be in a traffic blocking state, with a traffic quota of 0; the traffic control status of observation window 9 will be in a probing state, with a traffic quota of the preset lower limit of the traffic quota. If the request anomaly rate in observation window 9 is not greater than the first anomaly rate threshold, then... The traffic control state of observation window 10 is in incremental recovery state, and the traffic quota of observation window 10 is determined. If the request anomaly rate of observation window 10 and subsequent observation windows 11 and 12 is not greater than the first anomaly rate threshold, then the traffic control state of observation windows 11, 12 and 13 is in incremental recovery state until the traffic quota of observation window 13 reaches the preset traffic quota limit. If the request anomaly rate of observation window 13 is not greater than the first anomaly rate threshold, then the traffic control state of observation window 14 is in normal steady state, and the traffic quota of observation window 14 is the preset traffic quota limit.

[0113] If the request anomaly rate of observation window 4 is not greater than the first anomaly rate threshold, then the traffic control state of observation window 5 is in incremental recovery state, and the traffic quota of observation window 5 is determined; if the request anomaly rate of observation window 5 is not greater than the first anomaly rate threshold, then the traffic control state of observation window 6 is in incremental recovery state, and the traffic quota of observation window 6 is determined; if the request anomaly rates of observation window 6 and subsequent observation windows 7 and 8 are not greater than the first anomaly rate threshold, then the traffic control states of observation windows 7, 8, and 9 are all in incremental recovery state, until the traffic quota of observation window 9 reaches the preset traffic quota limit; if the request anomaly rate of observation window 9 is not greater than the first anomaly rate threshold, then the traffic control state of observation window 10 is in normal steady state, and the traffic quota of observation window 10 is the preset traffic quota limit.

[0114] The technical solution of this application embodiment can determine the current request anomaly rate based on the request response information of service requests sent from upstream nodes to downstream nodes within the current observation window. It can aggregate and statistically analyze request information within the current observation window, avoiding instantaneous noise caused by single request anomalies, thus making the current request anomaly rate more stable and objectively reflecting the true operational health of downstream nodes. Next, based on the current request anomaly rate, current flow control status, and current flow quota, the target flow control status for the next observation window is determined. This allows the target flow control status to adapt to the current operating environment of downstream nodes, thereby improving the accuracy and efficiency of determining the target flow control status. Then, based on the target flow control status, a target flow quota adapted to the next observation window is determined, and the service requests sent from upstream nodes to downstream nodes within the next observation window are processed according to the target flow quota. The system requests traffic control and adjusts the current traffic quota based on the target traffic control status for the next observation window to determine the target traffic quota for that window. This target quota can be determined based on the current health of downstream nodes. For example, when downstream nodes are functioning normally, the current traffic quota can be maintained or increased; when downstream nodes are abnormal, the current traffic quota can be reduced. This results in smoother traffic changes rather than a one-size-fits-all blocking approach. This allows for full utilization of the remaining capacity of downstream nodes and enables them to gradually digest internal backlogged requests by reducing their load during abnormal situations, allowing them to recover on their own and further improving fault recovery efficiency. This allows for precise adaptation to the current operating conditions of downstream nodes, improving the accuracy and efficiency of traffic control and accurately adapting to the current traffic control scenario.

[0115] In addition, the flow throttling and degradation states, the target reduction factor, and the buffer period of the observation window between each flow throttling and degradation state ensure smooth flow changes rather than a cliff-like drop; the incremental recovery state, the target amplification factor, and the buffer period of the observation window between each incremental recovery state can prevent a secondary collapse caused by a sudden surge back to the full load.

[0116] Figure 3 This is a schematic diagram of a flow control device provided in an embodiment of this application, referring to... Figure 3 The flow control device may include: The first determining module 310 is used to determine the current request anomaly rate based on the request and response information of the business requests sent by the upstream node to the downstream node within the current observation window; The second determining module 320 is used to determine the target traffic quota for the next observation window based on the current request exception rate, the current traffic control status and the current traffic quota. The control module 330 is used to control the flow of service requests sent from the upstream node to the downstream node in the next observation window according to the target flow quota.

[0117] In one embodiment, the second determining module 320 is specifically used to: determine the target traffic control state for the next observation window based on the current request anomaly rate, the current traffic control state, and the current traffic quota; and determine the target traffic quota for the next observation window based on the target traffic control state.

[0118] In one embodiment, the flow control state includes a normal steady-state state, a rate limiting and degradation state, a flow blocking state, and a detection state. The second determining module 320 determines the target flow control state for the next observation window based on the current request anomaly rate, the current flow control state, and the current flow quota, including: determining the target flow control state as a normal steady-state state when the current flow control state is a normal steady-state state and the current request anomaly rate is not greater than a first anomaly rate threshold; determining the target flow control state as a normal steady-state state when the current flow control state is a normal steady-state state, the request anomaly rate of the previous observation window is not greater than the first anomaly rate threshold, and the current request anomaly rate is greater than the first anomaly rate threshold but not greater than a second anomaly rate threshold; and determining the target flow control state as a normal steady-state state when the current flow control state is a normal steady-state state, the request anomaly rate of a consecutive preset number of historical observation windows is greater than the first anomaly rate threshold, and the current request anomaly rate is greater than the first anomaly rate threshold but not greater than the second anomaly rate threshold. When the anomaly rate threshold is reached, the target traffic control state is determined to be a rate-limiting and degradation state. When the current traffic control state is a normal steady-state state and the current request anomaly rate is greater than the second anomaly rate threshold, the target traffic control state is determined to be a rate-limiting and degradation state. When the current traffic control state is a rate-limiting and degradation state, the current traffic quota is greater than the preset lower limit of the traffic quota, and the current request anomaly rate is greater than the first anomaly rate threshold, the target traffic control state is determined to be a rate-limiting and degradation state. When the current traffic control state is a rate-limiting and degradation state, the current traffic quota is not greater than the preset lower limit of the traffic quota, and the current request anomaly rate is greater than the first anomaly rate threshold, the target traffic control state is determined to be a traffic blocking state. When the current traffic control state is a traffic blocking state, the target traffic control state is determined to be a probing state. When the current traffic control state is a probing state and the current request anomaly rate is greater than the first anomaly rate threshold, the target traffic control state is determined to be a traffic blocking state.

[0119] In one embodiment, the flow control state further includes an incremental recovery state, a rollback recovery state, and a cooldown recovery state. The second determining module 320 determines the target flow control state for the next observation window based on the current request anomaly rate, the current flow control state, and the current flow quota, including: when the current flow control state is an incremental recovery state or a cooldown recovery state, the current flow quota reaches a preset flow quota upper limit, and the current request anomaly rate is not greater than a first anomaly rate threshold, the target flow control state is determined to be a normal steady-state state; when the current flow control state is a probing state, and the current request anomaly rate is not greater than a first anomaly rate threshold, the target flow control state is determined to be an incremental recovery state; when the current flow control state is a rate limiting / degradation state, an incremental recovery state, a cooldown recovery state, or a rollback recovery state, the current request anomaly rate is not greater than a first anomaly rate threshold, and the current flow quota is less than a preset flow quota upper limit, the target flow control state is determined to be an incremental recovery state. When the current traffic control state is incremental recovery, and the current request anomaly rate is greater than the first anomaly rate threshold but not greater than the second anomaly rate threshold, the target traffic control state is determined to be cooling recovery. When the current traffic control state is incremental recovery, and the current request anomaly rate is greater than the second anomaly rate threshold, the target traffic control state is determined to be rollback recovery. When the current traffic control state is cooling recovery, and the current request anomaly rate is greater than the first anomaly rate threshold, the target traffic control state is determined to be rollback recovery. When the current traffic control state is rollback recovery, the current request anomaly rate is greater than the first anomaly rate threshold, and the current traffic quota is greater than the preset traffic quota lower limit, the target traffic control state is determined to be rate limiting and degradation. When the current traffic control state is rollback recovery, the current request anomaly rate is greater than the first anomaly rate threshold, and the current traffic quota is not greater than the preset traffic quota lower limit, the target traffic control state is determined to be traffic blocking.

[0120] In one embodiment, the flow control state includes a normal steady-state state, a rate limiting and degradation state, a flow blocking state, and a detection state. The second determining module 320 determines the target flow quota for the next observation window based on the target flow control state, including: when the target flow control state is a normal steady-state state, determining the target flow quota as a preset upper limit of the flow quota; when the target flow control state is a flow blocking state, determining the target flow quota as zero; when the target flow control state is a detection state, determining the target flow quota as a preset lower limit of the flow quota; and when the target flow control state is a rate limiting and degradation state, determining a target reduction factor based on the current request anomaly rate, and determining the target flow quota based on the current flow quota and the target reduction factor.

[0121] In one embodiment, the second determining module 320 determines the target reduction factor based on the current request anomaly rate, including: determining a deviation correction coefficient based on the deviation between the current request anomaly rate and a first anomaly rate threshold; calculating the anomaly change rate based on the current request anomaly rate and the request anomaly rate of the previous observation window, and calculating an anomaly rate correction coefficient based on the anomaly change rate; determining the proportion of each anomaly type based on the request response information in the current observation window, and calculating anomaly type correction coefficient based on the proportion of each anomaly type; and determining the target reduction factor based on the preset baseline reduction factor, deviation correction coefficient, anomaly rate correction coefficient, and anomaly type correction coefficient.

[0122] In one embodiment, the flow control state further includes an incremental recovery state, a rollback recovery state, and a cooldown recovery state. The second determining module 320 determines the target flow quota adapted to the next observation window based on the target flow control state, including: when the target flow control state is a cooldown recovery state, determining the target flow quota as the current flow quota; when the target flow control state is a rollback recovery state, determining the target flow quota based on the current flow quota and a preset rollback factor; when the target flow control state is an incremental recovery state, determining the target amplification factor based on the current request anomaly rate, and determining the target flow quota based on the current flow quota and the target amplification factor.

[0123] In one embodiment, the second determining module 320 determines the target amplification factor based on the current request anomaly rate, including: determining the number of real-time continuously increasing recovery windows and calculating a recovery stability correction coefficient based on the number of real-time continuously increasing recovery windows; determining the real-time number of recovery oscillation events in the current recovery session and calculating a recovery oscillation risk correction coefficient based on the real-time number; recovery oscillation events include events switching from an increasing recovery state to a cooling recovery state, events switching from an increasing recovery state to a rollback recovery state, and events switching from a cooling recovery state to a rollback recovery state; the current recovery session begins with a switch from a rate limiting / degradation state or a probe state to an increasing recovery state and ends with a switch to a rate limiting / degradation state, a normal steady-state state, or a traffic blocking state; calculating a safety margin correction coefficient based on the deviation between a first anomaly rate threshold and the current request anomaly rate; and determining the target amplification factor based on a preset benchmark amplification factor, a recovery stability correction coefficient, a recovery oscillation risk correction coefficient, and a safety margin correction coefficient.

[0124] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional modules is merely an example. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The specific working process of the functional modules described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0125] The flow control device provided in this embodiment can be applied to the flow control method provided in any of the above embodiments, and has the corresponding functions and beneficial effects.

[0126] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 4 A block diagram is shown of an exemplary electronic device 11 suitable for implementing embodiments of the present application. Figure 4 The electronic device 11 shown is merely an example and should not impose any limitations on the functionality and scope of use of this embodiment.

[0127] like Figure 4 As shown, the electronic device 11 is represented in the form of a general-purpose computing electronic device. The components of the electronic device 11 may include, but are not limited to: one or more processors or processing units 16, system memory 28, and bus 18 connecting different system components (including system memory 28 and processing unit 16).

[0128] Bus 18 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. Examples of these architectures include, but are not limited to, industry-standard architecture buses, microchannel architecture buses, enhanced industry-standard architecture buses, Video Electronics Standards Association (VESA) local buses, and peripheral component interconnect buses.

[0129] Electronic device 11 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by electronic device 11, including volatile and non-volatile media, removable and non-removable media.

[0130] System memory 28 may include computer system readable media in the form of volatile memory, such as random access memory 30 and / or cache memory 32. Electronic device 11 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 4 Not shown; usually referred to as a "hard drive"). Although Figure 4 As not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disk drive for reading and writing to a removable non-volatile optical disk may be provided. In these cases, each drive may be connected to bus 18 via one or more data media interfaces. System memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of this application.

[0131] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28. Such program modules 42 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 42 typically perform the functions and / or methods described in the embodiments of this application.

[0132] Electronic device 11 can also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), and with one or more devices that enable a user to interact with electronic device 11, and / or with any device that enables electronic device 11 to communicate with one or more other computing devices (e.g., network interface card and modem, etc.). Such communication can be performed through input / output interface 22. Furthermore, electronic device 11 can also communicate with one or more networks (e.g., local area network, wide area network, and / or public network) through network adapter 20.

[0133] like Figure 4 As shown, network adapter 20 communicates with other modules of electronic device 11 via bus 18. It should be understood that, although... Figure 4 As not shown, other hardware and / or software modules may be used in conjunction with electronic device 11, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, tape drives, and data backup storage systems.

[0134] The processing unit 16 executes various functional applications and page displays by running programs stored in the system memory 28, such as implementing a flow control method provided in any embodiment of this application.

[0135] This application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements a flow control method, such as that provided in any embodiment of this application.

[0136] The computer storage medium of this embodiment can be any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. For example, a computer-readable storage medium can be, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical fiber, a portable compact disk read-only memory, an optical storage device, a magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0137] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.

[0138] Program code contained on a computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, radio frequency, etc., or any suitable combination thereof.

[0139] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof. Programming languages ​​include object-oriented programming languages ​​as well as conventional procedural programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0140] Those skilled in the art will understand that the modules or steps described above in this application can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, which can then be stored in a storage device for execution by a computing device. Alternatively, they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.

[0141] Note that the above are merely preferred embodiments and the technical principles employed in this application. Those skilled in the art will understand that this application is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of this application. Therefore, although this application has been described in detail through the above embodiments, this application is not limited to the above embodiments. Many other equivalent embodiments may be included without departing from the inventive concept of this application, and the scope of this application is determined by the scope of the appended claims.

Claims

1. A flow control method, characterized in that, A flow control device applied in a distributed system, wherein the distributed system further includes multiple nodes, the method comprising: The current request anomaly rate is determined based on the request and response information of business requests sent from upstream nodes to downstream nodes within the current observation window. Based on the current request anomaly rate, current traffic control status, and current traffic quota, determine the target traffic quota for the next observation window; According to the target traffic quota, the upstream node performs traffic control on the service requests sent to the downstream node in the next observation window.

2. The flow control method according to claim 1, characterized in that, Based on the current request anomaly rate, current traffic control status, and current traffic quota, determine the target traffic quota for the next observation window, including: The target flow control state for the next observation window is determined based on the current request anomaly rate, the current flow control state, and the current flow quota. The target flow quota for the next observation window is determined based on the target flow control status.

3. The flow control method according to claim 2, characterized in that, Traffic control states include normal steady-state state, rate limiting and degradation state, traffic blocking state, and detection state. The target traffic control state for the next observation window is determined based on the current request anomaly rate, the current traffic control state, and the current traffic quota, including: When the current traffic control state is a normal steady state and the current request anomaly rate is not greater than the first anomaly rate threshold, the target traffic control state is determined to be a normal steady state. When the current flow control state is a normal steady state, the request anomaly rate of the previous observation window is not greater than the first anomaly rate threshold, and the current request anomaly rate is greater than the first anomaly rate threshold but not greater than the second anomaly rate threshold, the target flow control state is determined to be a normal steady state. When the current flow control state is a normal steady state, the request anomaly rate of a consecutive preset number of historical observation windows is greater than a first anomaly rate threshold, and the current request anomaly rate is greater than the first anomaly rate threshold but not greater than a second anomaly rate threshold, the target flow control state is determined to be a rate limiting and degradation state. When the current traffic control state is a normal steady state and the current request anomaly rate is greater than the second anomaly rate threshold, the target traffic control state is determined to be a rate limiting and degradation state. When the current traffic control state is a rate limiting and degradation state, the current traffic quota is greater than the preset traffic quota lower limit, and the current request anomaly rate is greater than the first anomaly rate threshold, the target traffic control state is determined to be a rate limiting and degradation state. When the current traffic control state is a rate limiting and degradation state, the current traffic quota is not greater than the preset lower limit of the traffic quota, and the current request anomaly rate is greater than the first anomaly rate threshold, the target traffic control state is determined to be a traffic blocking state. When the current flow control state is a flow blocking state, the target flow control state is determined to be a probe state; When the current traffic control state is a probing state and the current request anomaly rate is greater than a first anomaly rate threshold, the target traffic control state is determined to be a traffic blocking state.

4. The flow control method according to claim 3, characterized in that, The flow control state also includes incremental recovery state, rollback recovery state, and cooldown recovery state. The target flow control state for the next observation window is determined based on the current request anomaly rate, the current flow control state, and the current flow quota, including: When the current traffic control state is an incremental recovery state or a cool-down recovery state, the current traffic quota reaches the preset traffic quota limit, and the current request anomaly rate is not greater than the first anomaly rate threshold, the target traffic control state is determined to be a normal steady state. When the current flow control state is the probe state and the current request anomaly rate is not greater than the first anomaly rate threshold, the target flow control state is determined to be the incremental recovery state. When the current traffic control state is a rate limiting and degradation state, an incremental recovery state, a cooling recovery state, or a rollback recovery state, the current request anomaly rate is not greater than a first anomaly rate threshold, and the current traffic quota is less than a preset traffic quota upper limit, the target traffic control state is determined to be an incremental recovery state. When the current flow control state is an incremental recovery state, and the current request anomaly rate is greater than a first anomaly rate threshold but not greater than a second anomaly rate threshold, the target flow control state is determined to be a cooling recovery state. When the current traffic control state is an incremental recovery state and the current request anomaly rate is greater than the second anomaly rate threshold, the target traffic control state is determined to be a rollback recovery state. When the current flow control state is a cooldown recovery state and the current request anomaly rate is greater than a first anomaly rate threshold, the target flow control state is determined to be a rollback recovery state. When the current traffic control state is a rollback recovery state, the current request anomaly rate is greater than a first anomaly rate threshold, and the current traffic quota is greater than a preset traffic quota lower limit, the target traffic control state is determined to be a rate limiting and degradation state. When the current traffic control state is a rollback recovery state, the current request anomaly rate is greater than a first anomaly rate threshold, and the current traffic quota is not greater than a preset traffic quota lower limit, the target traffic control state is determined to be a traffic blocking state.

5. The flow control method according to claim 2, characterized in that, Flow control states include normal steady-state state, flow limiting and degradation state, flow blocking state, and detection state. Based on the target flow control state, a target flow quota adapted to the next observation window is determined, including: When the target flow control state is a normal steady state, the target flow quota is determined to be the preset flow quota upper limit; When the target flow control state is a flow blocking state, the target flow quota is determined to be zero; When the target flow control state is a detection state, the target flow quota is determined to be a preset flow quota lower limit; When the target traffic control state is a rate limiting and degradation state, a target reduction factor is determined based on the current request anomaly rate, and a target traffic quota is determined based on the current traffic quota and the target reduction factor.

6. The flow control method according to claim 5, characterized in that, Determining the target reduction factor based on the current request anomaly rate includes: A deviation correction coefficient is determined based on the deviation between the current request anomaly rate and the first anomaly rate threshold. The abnormal change rate is calculated based on the current request abnormality rate and the request abnormality rate of the previous observation window, and the abnormal rate correction coefficient is calculated based on the abnormal change rate. The proportion of each anomaly type is determined based on the request and response information within the current observation window, and the anomaly type correction coefficient is calculated based on the proportion of each anomaly type. The target reduction factor is determined based on the preset benchmark reduction factor, the deviation correction coefficient, the anomaly rate correction coefficient, and the anomaly type correction coefficient.

7. The flow control method according to claim 5, characterized in that, The flow control state also includes an incremental recovery state, a rollback recovery state, and a cooling recovery state. Based on the target flow control state, a target flow quota adapted to the next observation window is determined, including: When the target flow control state is the cooling recovery state, the target flow quota is determined to be the current flow quota; When the target flow control state is a rollback recovery state, the target flow quota is determined based on the current flow quota and the preset rollback factor; When the target traffic control state is an incremental recovery state, the target amplification factor is determined based on the current request anomaly rate, and the target traffic quota is determined based on the current traffic quota and the target amplification factor.

8. The flow control method according to claim 7, characterized in that, Determining the target amplification factor based on the current request anomaly rate includes: Determine the number of continuously increasing recovery windows in real time, and calculate the recovery stability correction coefficient based on the number of continuously increasing recovery windows in real time; The real-time number of recovery oscillation events in the current recovery session is determined, and a recovery oscillation risk correction coefficient is calculated based on the real-time number. The recovery oscillation events include events that switch from incremental recovery state to cool-down recovery state, events that switch from incremental recovery state to rollback recovery state, and events that switch from cool-down recovery state to rollback recovery state. The current recovery session begins with a switch from rate limiting / degradation state or probe state to incremental recovery state and ends with a switch to rate limiting / degradation state, normal steady-state state, or traffic blocking state. Calculate the safety margin correction coefficient based on the deviation between the first anomaly rate threshold and the current request anomaly rate; The target amplification factor is determined based on the preset benchmark amplification factor, the recovery stability correction coefficient, the recovery oscillation risk correction coefficient, and the safety margin correction coefficient.

9. 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 to enable the at least one processor to perform the flow control method according to any one of claims 1 to 8.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the flow control method as described in any one of claims 1 to 8.