CN-122027560-A - Flow control method and device, electronic equipment and program product
Abstract
The application provides a flow control method, a flow control device, electronic equipment and a program product. The method comprises the steps of obtaining a first current limiting threshold corresponding to application service and a second current limiting threshold corresponding to a plurality of interfaces in the application service in a storage space, controlling flow of the application service and the interfaces according to the first current limiting threshold and the second current limiting thresholds, periodically detecting performance indexes of the interfaces to obtain a plurality of detection data corresponding to the interfaces respectively, and updating the second current limiting threshold of the interfaces according to the detection data of the interfaces by a dynamic adjustment algorithm for any interface, so that stability of the application service is improved.
Inventors
- WANG JIAZHI
- ZHANG JINFENG
- LIU RUIXIAN
- ZHAO HUAN
- LV ZHUOHENG
- QU LIANG
Assignees
- 曙光信息产业股份有限公司
- 曙光信息产业(北京)有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20260112
Claims (10)
- 1. A method of controlling flow, the method comprising: Acquiring a first current limiting threshold corresponding to an application service and a second current limiting threshold corresponding to a plurality of interfaces in the application service from a storage space; according to the first current limiting threshold value and the second current limiting threshold values, controlling the flow of the application service and the interfaces; Performing periodic detection processing on the performance indexes of the interfaces to obtain a plurality of detection data corresponding to the interfaces respectively; And updating the second current limiting threshold of any interface through a dynamic adjustment algorithm according to the detection data of the interface.
- 2. The method of claim 1, wherein updating the second current limit threshold of the interface by a dynamic adjustment algorithm based on the detection data of the interface comprises: analyzing and processing states of the detection data in a plurality of continuous preset periods to obtain analysis results; Performing degradation processing on the current level of the second current limiting threshold value to obtain a target level when the analysis result is in a performance abnormal state, and performing upgrading processing on the current level of the second current limiting threshold value to obtain the target level when the analysis result is in a performance sufficient state; And updating a second current limiting threshold of the interface according to the target level.
- 3. The method according to claim 2, wherein the detection data includes throughput and performance indexes corresponding to a plurality of consecutive preset periods, the performance indexes include a delay rate and an error rate, and analyzing the state of the detection data in the plurality of consecutive preset periods to obtain an analysis result includes: Determining a flow threshold according to the second flow limiting threshold; Judging whether the throughput corresponding to each preset period in a plurality of continuous preset periods is smaller than a flow threshold value or not, and the value of the performance index corresponding to each preset period is larger than a first threshold value; if yes, determining that the analysis result is the abnormal performance state; if not, in a plurality of continuous preset periods, the value of the performance index corresponding to each preset period is smaller than or equal to a first threshold value, and the analysis result is determined to be in the sufficient performance state.
- 4. The method according to claim 2, wherein the detection data includes throughput and performance indexes corresponding to a plurality of consecutive preset periods, and the analyzing the state of the detection data in the plurality of consecutive preset periods to obtain an analysis result includes: inputting throughput and performance indexes corresponding to a plurality of continuous preset periods into a monitoring model to obtain an analysis result; wherein the analysis result includes the performance anomaly state and the performance sufficiency state, and the performance anomaly state is associated with a target anomaly level, and the performance sufficiency state is associated with a target recovery level.
- 5. The method according to any one of claims 2-4, wherein, in the case that the analysis result is a performance anomaly state, performing degradation processing on the current level of the second current limit threshold to obtain a target level, including: Judging whether the performance abnormal state is associated with a target abnormal grade or not; If yes, carrying out degradation treatment on the current grade of the second current limiting threshold according to the target abnormal grade to obtain a target grade; If not, determining the next grade corresponding to the current grade of the second current limiting threshold, and determining the next grade as a target grade.
- 6. The method of any of claims 1-4, wherein flow controlling the application service and the plurality of interfaces according to the first and second current limit thresholds comprises: According to the first current limiting threshold, configuring a first token bucket corresponding to the application service, wherein the issuing rate of the first token bucket is smaller than or equal to the first current limiting threshold; for any one interface, configuring a second token bucket corresponding to the interface according to a second current limiting threshold corresponding to the interface, wherein the issuing rate of the second token bucket is smaller than or equal to the second current limiting threshold; and controlling the flow of the application service and the interfaces according to the first token bucket and the second token buckets.
- 7. The method according to any of claims 1-4, wherein before obtaining a first current limit threshold corresponding to an application service and a second current limit threshold corresponding to a plurality of interfaces in the application service in a storage space, the method further comprises: determining a first initial threshold corresponding to the application service through a performance test tool; Respectively determining a second initial threshold value corresponding to each interface through a performance testing tool; And configuring initial values of the first current limiting thresholds according to the first initial thresholds in the storage space, and configuring initial values of the second current limiting thresholds corresponding to the interfaces according to the second initial thresholds corresponding to the interfaces.
- 8. A flow control device, the device comprising: the acquisition module is used for acquiring a first current limiting threshold value corresponding to the application service and a second current limiting threshold value corresponding to a plurality of interfaces in the application service in the storage space; The control module is used for controlling the flow of the application service and the interfaces according to the first current limiting threshold value and the second current limiting threshold values; the detection module is used for carrying out periodic detection processing on the performance indexes of the interfaces to obtain a plurality of detection data corresponding to the interfaces respectively; And the updating module is used for updating the second current limiting threshold of any interface through a dynamic adjustment algorithm according to the detection data of the interface.
- 9. An electronic device comprising a processor and a memory communicatively coupled to the processor; The memory stores computer-executable instructions; the processor executes computer-executable instructions stored in the memory to implement the method of any one of claims 1 to 7.
- 10. A computer program product comprising a computer program which, when executed by a processor, implements the method of any of claims 1-7.
Description
Flow control method and device, electronic equipment and program product Technical Field The present application relates to the field of data processing, and in particular, to a method and apparatus for controlling flow, an electronic device, and a program product. Background In modern internet services, a system is typically made up of a plurality of independently deployed application services, each providing functionality externally through an interface. For example, the order processing, payment system, user authentication, etc. services of the e-commerce platform all need to be interacted through the interface. In a high concurrency scenario, the access volume of an interface may momentarily exceed the system processing capacity, resulting in response delays, service unavailability, and even system crashes. In a related flow control scheme, the flow restriction at the interface level may be implemented by configuring a flow restriction threshold via configuration rules. However, when the response delay of the interface increases due to the back-end service failure, the static current limit threshold may not be able to reduce the current limit rate in time, so that the interface collapses due to the burst traffic overload, resulting in lower system stability. Disclosure of Invention The application provides a flow control method, a flow control device, electronic equipment and a program product, which are used for solving the technical problem of lower system stability in the prior art. In a first aspect, the present application provides a method for controlling a flow, including: Acquiring a first current limiting threshold corresponding to an application service and second current limiting thresholds respectively corresponding to a plurality of interfaces in the application service from a storage space; according to the first current limiting threshold value and the plurality of second current limiting threshold values, performing flow control on the application service and the plurality of interfaces; performing periodic detection processing on performance indexes of the interfaces to obtain a plurality of detection data corresponding to the interfaces respectively; and updating the second current limiting threshold of the interface by a dynamic adjustment algorithm according to the detection data of the interface aiming at any one interface. In this way, the stability of the whole operation of the application service is ensured through the layered current limiting of the service level and the interface level, and the periodic detection of the interface performance and the dynamic update of the second current limiting threshold are combined, so that the overload occupation of resources by single throughput is avoided, the real-time performance state of the interface can be adapted to optimize the resource utilization efficiency, and the stability of the application service is improved. Optionally, the method above updates the second current limit threshold of the interface by a dynamic adjustment algorithm according to the detection data of the interface, including: Analyzing and processing states of the detection data in a plurality of continuous preset periods to obtain analysis results; Performing degradation treatment on the current level of the second current limiting threshold value to obtain a target level under the condition that the analysis result is in a performance abnormal state, and performing upgrading treatment on the current level of the second current limiting threshold value to obtain the target level under the condition that the analysis result is in a performance sufficient state; and updating the second current limiting threshold of the interface according to the target level. In this way, misjudgment caused by single-period data fluctuation is avoided through state analysis of continuous multi-period detection data of the interface, gradient degradation/upgrading and updating of the second current limiting threshold level are implemented aiming at abnormal performance/sufficient state, closed-loop control is formed, dynamic adaptation of the second current limiting threshold to the real-time performance state of the interface is achieved, operation stability of the interface is guaranteed, and resource utilization efficiency is improved. Optionally, in the above method, the detecting data includes throughput and performance indexes corresponding to a plurality of continuous preset periods, the performance indexes include a delay rate and an error rate, and the analyzing the state of the detecting data in the plurality of continuous preset periods to obtain an analysis result includes: Determining a flow threshold according to the second flow limiting threshold; Judging whether the throughput corresponding to each preset period in a plurality of continuous preset periods is smaller than a flow threshold value or not, and the value of the performance index corresponding to each pr