Request for current limiting control methods, devices, equipment and storage media

By obtaining the time window sequence, status code, and requested party of the target request, the rate limiting integral value is calculated, which solves the problem of poor rate limiting effect in the existing technology and realizes efficient rate limiting control in complex business scenarios.

CN117097672BActive Publication Date: 2026-11-17CHINA MOBILE FINANCIAL TECHNOLOGY CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311120057.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-31
Publication Date
2026-11-17
Estimated Expiration
2043-08-31

AI Technical Summary

Technical Problem

Existing technologies are ineffective at limiting traffic in complex business scenarios and cannot effectively handle complex access traffic, leading to server crashes.

Method used

By obtaining the time window sequence, status code, and requested party of the target request, the rate limiting score of the current time window is calculated and compared with the preset rate limiting threshold. The rate limiting is then determined based on the score, and dynamic adjustments are made in combination with the business scenario type and the type of requester.

Benefits of technology

It enables accurate judgment of request processing capacity in complex business scenarios, avoids unnecessary rate limiting, and ensures the stability and efficiency of the server.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117097672B_ABST
    Figure CN117097672B_ABST
Patent Text Reader

Abstract

This invention belongs to the field of data processing technology and discloses a request rate limiting control method, apparatus, device, and storage medium. The invention obtains the time window sequence, status code, and requested party corresponding to the target request; selects the current time window from the time window sequence; determines the rate limiting integral value corresponding to the current time window based on the status code and requested party; if the rate limiting integral value is greater than a preset rate limiting threshold, the target request is not rate-limited. Because this invention calculates the rate limiting integral value corresponding to the current time window based on data such as the status code and requested party of the target request, and compares the rate limiting integral value, which characterizes the requested party's ability to process the target request in the current time window, with a preset rate limiting threshold, it determines whether to rate limit the target request. This ensures that the rate limiting judgment meets the actual needs of complex business scenarios and guarantees good rate limiting results even in complex business situations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and in particular to a request rate limiting control method, apparatus, device, and storage medium. Background Technology

[0002] Nowadays, fixed traffic thresholds are typically configured to limit the rate of user-initiated business requests in order to prevent excessive traffic from causing server system crashes. However, because the rate limiting method is relatively simple, it cannot effectively cope with complex business scenarios and fails to meet the requirements of efficient rate limiting in complex business scenarios, resulting in poor rate limiting performance.

[0003] The above content is only used to help understand the technical solution of the present invention and does not represent an admission that the above content is prior art. Summary of the Invention

[0004] The main objective of this invention is to provide a request rate limiting control method, apparatus, device, and storage medium, aiming to solve the technical problem that the existing technology is not effective in rate limiting for complex business scenarios.

[0005] To achieve the above objectives, the present invention provides a request rate limiting control method, the method comprising the following steps:

[0006] Obtain the time window sequence, status code, and requested party corresponding to the target request;

[0007] Select the current time window from the time window sequence;

[0008] The rate limiting integral value corresponding to the current time window is determined based on the status code and the requested party.

[0009] If the rate limiting score is greater than the preset rate limiting threshold, then the target request will not be rate-limited.

[0010] Optionally, after the step of determining the integral value corresponding to the current time window based on the status code and the requested party, the method further includes:

[0011] If the rate limiting integral value is less than or equal to the preset rate limiting threshold, then it is detected whether there is an unselected time window in the time window sequence;

[0012] If there are unselected time windows, return to the step of selecting the current time window from the time window sequence;

[0013] If there is no unselected time window, the target request will be rate-limited.

[0014] Optionally, the step of determining the integration value corresponding to the current time window based on the status code and the requested party includes:

[0015] The initial score increase is determined based on the status code and the processing capability value of the requested party.

[0016] Detect whether the current time window is the first sequence element in the time window sequence;

[0017] If it is the first sequence element, then obtain the basic score value corresponding to the target request;

[0018] The current time window's rate limiting integral value is determined based on the base integral value and the degree of increase in the initial integral value.

[0019] Optionally, the step of obtaining the basic score value corresponding to the target request includes:

[0020] Obtain the business scenario type and requester type corresponding to the target request;

[0021] Find the initial score value corresponding to the business scenario type, and find the score coefficient corresponding to the requester type;

[0022] The basic integral value is determined based on the initial integral value and the integral coefficient.

[0023] Optionally, after the step of detecting whether the current time window is the first sequence element in the time window sequence, the method further includes:

[0024] If it is not the first sequence element, then obtain the previous time window corresponding to the current time window;

[0025] The current score increase rate is determined based on the current time window, the processing capacity value of the requested party, and the initial increase rate.

[0026] The current time window's rate limiting integral value is determined based on the rate limiting integral value corresponding to the previous time window and the current rate limiting integral increase.

[0027] Optionally, the step of determining the current score increase level based on the current time window, the processing capability value of the requested party, and the initial score increase level includes:

[0028] Obtain the width of the current time window and find the attenuation coefficient corresponding to the processing capacity value of the requested party;

[0029] The current integral increase is determined based on the time window width, the attenuation coefficient, and the initial integral increase.

[0030] Optionally, the step of obtaining the time window sequence, status code, and requested party corresponding to the target request includes:

[0031] Obtain the business scenario type, status code, and requested party corresponding to the target request;

[0032] Find the number of time windows corresponding to the business scenario type;

[0033] Based on the number of time windows, find the available time windows to obtain multiple time windows;

[0034] The multiple time windows are sorted according to their corresponding time intervals to obtain the time window sequence corresponding to the target request.

[0035] Furthermore, to achieve the above objectives, the present invention also proposes a request-based current limiting control device, which includes the following modules:

[0036] The acquisition module is used to acquire the time window sequence, status code, and requested party corresponding to the target request;

[0037] A selection module is used to select the current time window from the time window sequence;

[0038] The determination module is used to determine the rate limiting integral value corresponding to the current time window based on the status code and the requested party;

[0039] The control module is configured to not limit the rate of the target request if the rate limiting integral value is greater than the preset rate limiting threshold.

[0040] Furthermore, to achieve the above objectives, the present invention also proposes a request rate limiting control device, which includes: a processor, a memory, and a request rate limiting control program stored in the memory and executable on the processor. When the request rate limiting control program is executed by the processor, it implements the steps of the request rate limiting control method as described above.

[0041] Furthermore, to achieve the above objectives, the present invention also proposes a computer-readable storage medium storing a request rate limiting control program, wherein the request rate limiting control program, when executed, implements the steps of the request rate limiting control method as described above.

[0042] This invention obtains the time window sequence, status code, and requested party corresponding to the target request; selects the current time window from the time window sequence; determines the rate limiting score value corresponding to the current time window based on the status code and requested party; and if the rate limiting score value is greater than a preset rate limiting threshold, the target request is not rate-limited. Because this invention calculates the rate limiting score value corresponding to the current time window based on data such as the status code and requested party of the target request, and compares the rate limiting score value, which characterizes the requested party's ability to process the target request within the current time window, with a preset rate limiting threshold, it determines whether to rate limit the target request. This ensures that the rate limiting judgment meets the actual needs of complex business scenarios, guaranteeing good rate limiting performance even in complex business situations. Attached Figure Description

[0043] Figure 1 This is a schematic diagram of the structure of an electronic device in the hardware operating environment involved in the embodiments of the present invention;

[0044] Figure 2 This is a flowchart illustrating the first embodiment of the current limiting control method of the present invention;

[0045] Figure 3 This is a flowchart illustrating the second embodiment of the current limiting control method of the present invention;

[0046] Figure 4 This is a flowchart illustrating the third embodiment of the current limiting control method of the present invention;

[0047] Figure 5 This is a schematic diagram of the interaction between the request rate limiting system modules according to an embodiment of the present invention;

[0048] Figure 6 This is a structural block diagram of the first embodiment of the current limiting control device of the present invention.

[0049] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0050] It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the invention.

[0051] Reference Figure 1 , Figure 1 This is a schematic diagram of the request rate limiting control device structure of the hardware operating environment involved in the embodiments of the present invention.

[0052] like Figure 1As shown, the electronic device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display screen or an input unit such as a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wireless-Fidelity (Wi-Fi) interface). The memory 1005 may be high-speed random access memory (RAM) or stable non-volatile memory (NVM), such as a disk drive. The memory 1005 may also optionally be a storage device independent of the aforementioned processor 1001.

[0053] Those skilled in the art will understand that Figure 1 The structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0054] like Figure 1 As shown, the memory 1005, which serves as a storage medium, may include an operating system, a network communication module, a user interface module, and a request rate limiting control program.

[0055] exist Figure 1 In the electronic device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the electronic device of the present invention can be set in the request rate limiting control device. The electronic device calls the request rate limiting control program stored in the memory 1005 through the processor 1001 and executes the request rate limiting control method provided in the embodiment of the present invention.

[0056] This invention provides a request rate limiting control method, referring to... Figure 2 , Figure 2 This is a flowchart illustrating a first embodiment of a request rate limiting control method according to the present invention.

[0057] In this embodiment, the request rate limiting control method includes the following steps:

[0058] Step S10: Obtain the time window sequence, status code, and requested party corresponding to the target request.

[0059] It should be noted that the execution subject of this embodiment can be the request rate limiting control device. The request rate limiting control device can be a personal computer, server or other electronic device, or other devices that can achieve the same or similar functions. This embodiment does not limit it. In this embodiment and the following embodiments, the request rate limiting control device is used as an example to describe the request rate limiting control method of the present invention.

[0060] It should be noted that the target request can be a service access request sent by other devices to the request rate limiting control device. The time window sequence can include all available time windows for processing the target request. The requested party can be the application service or application service cluster accessed by the target request. The status code can be a parameter used to characterize the probability of the target request being abnormal; the larger the status code value, the lower the probability of the corresponding request being abnormal; the smaller the status code value, the higher the probability of the corresponding request being abnormal.

[0061] In practical use, the status code corresponding to the target request can be obtained by performing error log statistics on the application service interface accessed by the target request.

[0062] For example: Suppose the application service interface accessed by the target request is interface A. At this time, we can obtain the interface log of interface A within a unit time (the length of the unit time can be preset by the administrator of the request rate limiting control device). We can perform statistical analysis on the error codes and other return messages in the interface log, and subtract points from the initial value of the status code (e.g., set the initial value of the status code to 1) based on the percentage of abnormal error return codes, thereby obtaining the status code corresponding to the target request.

[0063] To facilitate buffering of received requests, after a request is received, it can be stored in the corresponding request pool (requests of different business scenarios can be stored in different request pools, and the time windows corresponding to different requests can be different). The target request can then be a request stored in the request pool. For different request pools, the request rate limiting control method of this embodiment can be executed to determine whether rate limiting is necessary.

[0064] Furthermore, since different types of business scenarios have different time requirements, the number of available time windows corresponding to requests of different business scenario types is also different. In order to construct a reasonable time window sequence, step S10 in this embodiment may include:

[0065] Obtain the business scenario type, status code, and requested party corresponding to the target request;

[0066] Find the number of time windows corresponding to the business scenario type;

[0067] Based on the number of time windows, find the available time windows to obtain multiple time windows;

[0068] The multiple time windows are sorted according to their corresponding time intervals to obtain the time window sequence corresponding to the target request.

[0069] It should be noted that the business scenario type can be the type of business scenario corresponding to the target request. The number of time windows corresponding to the business scenario type can be found in the type number mapping table. The type number mapping table can store the mapping relationship between business scenario types and time window numbers. This mapping relationship can be preset by the administrator of the request rate limiting control device.

[0070] Specifically, the higher the time requirement of a business scenario type, the fewer the corresponding time windows; conversely, the lower the time requirement, the more corresponding time windows. For example, a flash sale scenario has a high time requirement, so fewer available windows are set; while a query scenario has a lower time requirement, so more available windows are set.

[0071] In the specific implementation, the available time windows can be found based on the number of time windows. To obtain multiple time windows, the available time windows corresponding to the target request can be found by searching backwards based on the current time and the width of the time window corresponding to the target request.

[0072] In practical use, sorting the multiple time windows according to the corresponding window time intervals to obtain the time window sequence corresponding to the target request can be done by sorting the multiple time windows from early to late according to the time order of the window time intervals corresponding to each time window, thereby obtaining the time window sequence corresponding to the target request.

[0073] Step S20: Select the current time window from the time window sequence.

[0074] It should be noted that selecting the current time window from the time window sequence can be done by traversing the time window sequence based on its sequential order, and using the traversed time window as the current time window.

[0075] Step S30: Determine the rate limiting integral value corresponding to the current time window based on the status code and the requested party.

[0076] It should be noted that the rate limiting score can be a numerical value used to characterize the ability to process the target request using the current time window. The higher the rate limiting score, the stronger the ability to process the target request using the current time window.

[0077] Step S40: If the rate limiting integral value is greater than the preset rate limiting threshold, then the target request will not be rate limited.

[0078] It should be noted that if the rate limiting score value corresponding to the current time window is greater than the preset rate limiting threshold, it means that the requested party has the ability to process the target request using the current time window. In this case, the processing of the target request by the requested party will not cause the server of the requested party to crash, and there is no need to rate limit. Therefore, the target request can be allowed to pass directly without rate limiting.

[0079] In a specific implementation, if the rate limiting integral value is less than or equal to the preset rate limiting threshold, it indicates that the requested party does not have the ability to process the target request using the current time window. In this case, it is necessary to confirm whether there are other available time windows to determine whether further judgment is needed. Therefore, after step S30 in this embodiment, the following may also be included:

[0080] If the rate limiting integral value is less than or equal to the preset rate limiting threshold, then it is detected whether there is an unselected time window in the time window sequence;

[0081] If there are unselected time windows, return to the step of selecting the current time window from the time window sequence;

[0082] If there is no unselected time window, the target request will be rate-limited.

[0083] It should be noted that if the rate limiting integral value is less than or equal to the preset rate limiting threshold, it means that the requested party does not have the ability to process the target request using the current time window. In this case, it is possible to check whether there is an unselected time window in the time window sequence to confirm whether there are other available time windows.

[0084] It is understandable that if there is an unselected time window, then there are other available time windows. At this time, it can be further determined whether the party being processed has the ability to process the target request through other time windows. Therefore, it is possible to return to step S20 above, select other unselected time windows from the time window sequence as the current time window, and make further judgments.

[0085] If there is no unselected time window, it means that there are no other available time windows. In this case, it can be determined that the target request cannot be processed at present, and rate limiting can be applied to the target request.

[0086] In practical implementation, different rate limiting algorithms can be selected based on the magnitude of the rate limiting integral value, which facilitates trade-offs between efficiency and stability. For example, if the rate limiting integral value exceeds the module threshold, the token bucket algorithm is selected, which is more efficient; if the rate limiting integral value is within a certain preset range, the leaky bucket algorithm is selected, which is relatively less efficient but more stable.

[0087] This embodiment obtains the time window sequence, status code, and requested party corresponding to the target request; selects the current time window from the time window sequence; determines the rate limiting score value corresponding to the current time window based on the status code and requested party; if the rate limiting score value is greater than a preset rate limiting threshold, the target request is not rate-limited. Because this invention calculates the rate limiting score value corresponding to the current time window based on data such as the status code and requested party of the target request, and compares the rate limiting score value, which characterizes the requested party's ability to process the target request in the current time window, with a preset rate limiting threshold, it determines whether to rate limit the target request. This ensures that the rate limiting judgment meets the actual needs of complex business scenarios, guaranteeing good rate limiting results even in complex business situations.

[0088] refer to Figure 3 , Figure 3 This is a flowchart illustrating a second embodiment of a request rate limiting control method according to the present invention.

[0089] Based on the first embodiment described above, step S30 of the current limiting control method requested in this embodiment includes:

[0090] Step S301: Determine the initial score increase level based on the status code and the processing capability value of the requested party.

[0091] It should be noted that the processing capability value of the requested party can be a quantitative value used to characterize the business processing capability of the requested party. The larger the corresponding processing capability value, the stronger the business processing capability of the requested party, and the higher the probability that the target request will be processed by the requested party; the smaller the corresponding processing capability value, the weaker the business processing capability of the requested party, and the lower the probability that the target request will be processed by the requested party. Determining the initial increase in points based on the status code and the processing capability value of the requested party can be achieved by calculating the increase in the rate limiting points value based on the status code and the processing capability value of the requested party, thereby obtaining the initial increase in points.

[0092] Step S302: Detect whether the current time window is the first sequence element in the time window sequence.

[0093] It should be noted that since the processing capacity of the requested party changes in different time windows, the rate limiting score for the later available time window can be calculated by referring to the rate limiting score for the previous available time windows. Therefore, the calculation method for the rate limiting score for the first available time window will be different from that for other available windows. Thus, it is necessary to first check whether the current time window is the first sequence element in the time window sequence, that is, to determine whether the current time window is the first available time window corresponding to the target request.

[0094] Step S303: If it is the first sequence element, then obtain the basic integral value corresponding to the target request.

[0095] It is understandable that if the current time window is the first sequence element in the time window sequence, it means that the current time window is the first available time window corresponding to the target request. At this time, the initial algorithm can be used to calculate, and the basic integral value corresponding to the target request can be obtained.

[0096] Furthermore, different types of business scenarios have different time requirements, and requests initiated by more important requesters should be processed with higher priority. Therefore, in order to ensure the reasonableness of the base score value, the step of obtaining the base score value corresponding to the target request in this embodiment may include:

[0097] Obtain the business scenario type and requester type corresponding to the target request;

[0098] Find the initial score value corresponding to the business scenario type, and find the score coefficient corresponding to the requester type;

[0099] The basic integral value is determined based on the initial integral value and the integral coefficient.

[0100] It should be noted that the business scenario type can be the type of business scenario corresponding to the target request, and the requester type can be the type of the requester of the target request, which is used to characterize the importance of the requester.

[0101] In practical use, the initial score value corresponding to the business scenario type can be found in the scenario score mapping table. The scenario score mapping table can store the mapping relationship between business scenario types and initial score values. This mapping relationship can be preset by the administrator of the request flow limiting control device. The higher the time requirement of the current business corresponding to the business scenario type, the higher its corresponding initial score value.

[0102] For example, when the business scenario is a flash sale, which has a high time requirement, it can correspond to an initial score of 10 points; when the business scenario is a query, which has a relatively low time requirement, it can correspond to an initial score of 6 points.

[0103] In practical use, the integral coefficient corresponding to the requester type can be found in the requester type integral mapping table. The requester type integral mapping table can store the mapping relationship between requester types and integral coefficients. This mapping relationship can be preset by the administrator of the request current limiting control device. The higher the importance of the requester corresponding to the requester type, the larger its corresponding integral coefficient.

[0104] For example, requester types can be categorized into Diamond, Gold, and Silver based on their importance from highest to lowest. In this case, when the requester type is Diamond, the integration coefficient can be set to 2; when the requester type is Gold, the integration coefficient can be set to 1.8; and when the requester type is Silver, the integration coefficient can be set to 1.2, and so on.

[0105] In practice, determining the basic integral value based on the initial integral value and the integral coefficient can be achieved by multiplying the initial integral value by the integral coefficient and using the product as the basic integral value.

[0106] Step S304: Determine the flow-limiting integral value corresponding to the current time window based on the basic integral value and the degree of increase of the initial integral.

[0107] It should be noted that determining the current time window's rate limiting integral value based on the base integral value and the initial integral increase can be achieved by multiplying the base integral value by the initial integral increase to obtain the increased integral value, adding the increased integral value to the base integral value, and using the sum as the current time window's rate limiting integral value.

[0108] For example: Assuming the base integral value is 20 and the initial integral increase rate is 0.3, then the current time window corresponding to the flow-limiting integral value is 20 + 20 * 0.3 = 26.

[0109] This embodiment determines the initial score increase based on the status code and the processing capacity value of the requested party; detects whether the current time window is the first sequence element in the time window sequence; if it is the first sequence element, it obtains the base score value corresponding to the target request; and determines the rate limiting score value corresponding to the current time window based on the base score value and the initial score increase. Since the current time window is the first available time window corresponding to the target request, the rate limiting score value, which accurately represents the requested party's ability to process the target request within the current time window, is accurately calculated based on the base score value and the initial score increase.

[0110] refer to Figure 4 , Figure 4 This is a flowchart illustrating a third embodiment of a request rate limiting control method according to the present invention.

[0111] Based on the second embodiment described above, after step S302 of the current limiting control method in this embodiment, the method further includes:

[0112] Step S303': If it is not the first sequence element, then obtain the previous time window corresponding to the current time window.

[0113] It should be noted that if the current time window is not the first element in the time window sequence, it means that the current time window is not the first available time window corresponding to the target request. In this case, the rate limiting integral value corresponding to the current time window is calculated by combining the rate limiting integral value corresponding to the previous available time window. The available time window before the current time window has the strongest correlation with the current time window. Therefore, the available time window that is sorted before the current time window in the time window sequence can be obtained and used as the previous time window corresponding to the current time window.

[0114] Step S304': Determine the current score increase level based on the current time window, the processing capacity value of the requested party, and the initial increase level.

[0115] In practice, determining the current score increase based on the current time window, the processing capacity of the requested party, and the initial score increase can be achieved by adjusting the initial score increase based on the current time window and the processing capacity of the requested party.

[0116] In a specific implementation, in order to reasonably adjust the degree of increase in the integral corresponding to the previous time window, step S304' in this embodiment may include:

[0117] Obtain the width of the current time window and find the attenuation coefficient corresponding to the processing capacity value of the requested party;

[0118] The current integral increase is determined based on the time window width, the attenuation coefficient, and the initial integral increase.

[0119] It should be noted that the width of the current time window can be obtained by taking the length of the current time window and using it as the width. Finding the attenuation coefficient corresponding to the requested processing capacity value can be done by looking up the attenuation coefficient corresponding to the requested processing capacity value in a preset capacity attenuation mapping table.

[0120] The preset capacity attenuation mapping table can store the mapping relationship between processing capacity values ​​and attenuation coefficients. This mapping relationship can be preset by the administrator of the requesting flow limiting control device. The larger the processing capacity score of the requested party, the higher the probability of the requested party being processed, and the higher the corresponding attenuation coefficient. The smaller the processing capacity score of the requested party, the lower the probability of the requested party being processed, and the lower the corresponding attenuation coefficient.

[0121] In a specific implementation, determining the current degree of integral increase based on the time window width, attenuation coefficient, and initial degree of integral increase can be achieved by calculating the attenuation value corresponding to the current time window based on the time window width and attenuation coefficient, multiplying the attenuation value by the initial degree of integral increase, and using the resulting product as the current degree of integral increase.

[0122] The attenuation value corresponding to the increase in the current time window, calculated based on the time window width and the attenuation coefficient, can be calculated using a time attenuation formula, which can be:

[0123] H n =H n-1 ×exp(-l×Δt)

[0124] In the formula, H n The decay value is added to the integral corresponding to the current time window, Hn-1 is the decay value added to the integral corresponding to the previous time window, l is the decay coefficient, and Δt is the width of the current time window. The decay value for the first available time window corresponding to the request can be a default value preset by the administrator of the requesting current limiting control device.

[0125] Step S305': Determine the current time window's rate limiting integral value based on the rate limiting integral value corresponding to the previous time window and the current rate limiting integral increase.

[0126] It should be noted that determining the current time window's rate limiting integral value based on the rate limiting integral value corresponding to the previous time window and the current rate of increase in integral value can be achieved by multiplying the rate limiting integral value corresponding to the previous time window by the current rate of increase in integral value to obtain the increased integral value, adding the increased integral value to the rate limiting integral value corresponding to the previous time window, and using the sum as the current time window's rate limiting integral value.

[0127] For example: Suppose the rate limiting score for the previous time window is 54, the rate reduction for the current time window is 0.4, and the initial rate increase is 0.8. Then the current rate increase is 0.32. If the current time window is entered from the previous time window, the corresponding rate limiting score can be: 54*(1+0.32)=71.28.

[0128] Furthermore, for ease of understanding, we will now combine... Figure 5 This explanation is provided, but it does not limit the scope of this solution. Figure 5 This is a schematic diagram of the interaction between the request rate limiting system module and the module in this embodiment.

[0129] like Figure 5 As shown, the request rate limiting control method described in this embodiment mainly involves a rate limiting controller, a request interceptor, a comprehensive scoring calculation module, and a data storage module during execution.

[0130] The rate limiting controller is responsible for the entry and exit points of requests and the overall logic control. It supports the opening and closing of the comprehensive scoring calculation module; once opened, the entire mechanism takes effect. Different rate limiting algorithms are selected based on the comprehensive score (rate limiting score), allowing for trade-offs between efficiency and stability. For example, the token bucket algorithm is chosen when the score exceeds the module threshold, as it is more efficient; while the score falls within a certain range, the leaky bucket algorithm is chosen, which is less efficient but more stable.

[0131] Request interceptor: Intercepts all incoming requests.

[0132] The comprehensive scoring module is used to comprehensively determine the score corresponding to a request based on the business scenario type, requester type, status code, and processing capability of the requested party, and to limit the request rate based on the score.

[0133] The comprehensive scoring calculation module includes at least the following sub-modules: log collection and analysis sub-module, requester type analysis sub-module, business scenario analysis sub-module, requested application cluster indicator analysis sub-module, and centralized calculation sub-module.

[0134] The log collection and analysis submodule performs statistical analysis on the error codes and other data returned by a specific interface within a unit of time. Based on the analysis results, it determines the corresponding status code for the request. The initial value of the status code is 1. A deduction is made based on the percentage of abnormal error return codes, and the final value is used to determine the status code for the request. This determined status code is then sent to the centralized calculation submodule for aggregation and processing. A higher status code value indicates a lower probability of an abnormal request; conversely, a lower status code value indicates a higher probability of an abnormal request.

[0135] The requester type analysis submodule supports configuring different types for different requesters on a visual page, such as: Diamond, Gold, Silver, Bronze, and Iron. Different types can obtain different scores; in principle, the higher the importance, the higher the score. After obtaining the corresponding type of the requester, the requester type is sent to the centralized calculation submodule for summary calculation.

[0136] The business scenario analysis submodule supports configuring different business scenarios for different requesters through a visual interface, such as flash sale scenarios, order placement scenarios, and query scenarios. Different scenarios can obtain different points; in principle, the higher the importance, the higher the score. After obtaining the type corresponding to the business scenario, the business scenario type is sent to the centralized calculation submodule for summary calculation.

[0137] The requested application cluster metrics analysis submodule obtains the health status of each node in the requested application cluster, such as memory utilization, CPU utilization, I / O utilization, etc. It assigns different scores based on different levels of utilization to characterize the processing capability of the requested application. After obtaining the corresponding scores of the requested application, it sends the scores to the centralized computing submodule for summary calculation.

[0138] The centralized calculation submodule: This submodule acquires requests intercepted by the request interceptor. Then, it receives the request's status code from the log collection and analysis submodule, the requester type from the requester type analysis submodule, the business scenario type from the business scenario analysis submodule, and the processing capability score of the requested application cluster from the requested application cluster metric analysis submodule. It then performs centralized calculations on this received data to determine the score corresponding to the request. After acquiring the request intercepted by the request interceptor and obtaining the corresponding business scenario type, the centralized calculation submodule determines the time window width based on the business scenario type. Once the time window width is determined, the request is placed into the request pool corresponding to that time window width in the data storage module.

[0139] The widths of the time windows corresponding to different request pools can be integer multiples of each other. For example, the time window width of the request pool for the storage flash sale business scenario can be 10 milliseconds, and the time window width of the request pool for the storage query business scenario can be 20 milliseconds.

[0140] Data storage module: This module provides necessary data storage support for the comprehensive scoring calculation module. In this solution, the centralized calculation submodule within the comprehensive scoring calculation module stores the request in the corresponding data storage module when determining the time window width corresponding to the request based on data provided by other submodules. The data storage module includes multiple request pools corresponding to different time window widths. Then, the centralized calculation submodule can determine the initial score and the final score increase for the request based on data provided by other submodules and the data storage module. The centralized calculation submodule then stores the initial score and the final score increase for the request in the data storage module. In each time window, it retrieves the total score data (i.e., the rate-limited score value) from the data storage module and performs rate-limiting checks (for specific rate-limiting options, refer to the embodiments of the above-mentioned request rate-limiting control methods).

[0141] This embodiment obtains the previous time window corresponding to the current time window if it is not the first sequence element; determines the current score increase based on the current time window, the processing capacity value of the requested party, and the initial increase; and determines the rate limiting score corresponding to the current time window based on the rate limiting score corresponding to the previous time window and the current score increase. Since a time decay concept is introduced when the current time window is not the first available time window corresponding to the target request, the initial score increase is adjusted by using the time window width corresponding to the current time window and the decay coefficient corresponding to the processing capacity value of the requested party to obtain the current score increase. Then, the rate limiting score corresponding to the current time window is calculated based on the current score increase and the rate limiting score corresponding to the previous time window, ensuring that the calculated rate limiting score corresponding to the current time window accurately represents the requested party's ability to process the target request within the current time window.

[0142] Furthermore, this embodiment of the invention also proposes a storage medium storing a request rate limiting control program, which, when executed by a processor, implements the steps of the request rate limiting control method described above.

[0143] Reference Figure 6 , Figure 6 This is a structural block diagram of the first embodiment of the current limiting control device of the present invention.

[0144] like Figure 6 As shown, the request rate limiting control device proposed in this embodiment of the invention includes:

[0145] Module 10 is used to obtain the time window sequence, status code and requested party corresponding to the target request;

[0146] Selection module 20 is used to select the current time window from the time window sequence;

[0147] The determining module 30 is used to determine the rate limiting integral value corresponding to the current time window based on the status code and the requested party;

[0148] The control module 40 is configured to not limit the target request if the rate limiting integral value is greater than the preset rate limiting threshold.

[0149] This embodiment obtains the time window sequence, status code, and requested party corresponding to the target request; selects the current time window from the time window sequence; determines the rate limiting score value corresponding to the current time window based on the status code and requested party; if the rate limiting score value is greater than a preset rate limiting threshold, the target request is not rate-limited. Because this invention calculates the rate limiting score value corresponding to the current time window based on data such as the status code and requested party of the target request, and compares the rate limiting score value, which characterizes the requested party's ability to process the target request in the current time window, with a preset rate limiting threshold, it determines whether to rate limit the target request. This ensures that the rate limiting judgment meets the actual needs of complex business scenarios, guaranteeing good rate limiting results even in complex business situations.

[0150] Furthermore, the control module 40 is also configured to detect whether there is an unselected time window in the time window sequence if the rate limiting integral value is less than or equal to a preset rate limiting threshold; if there is an unselected time window, return to the step of selecting the current time window from the time window sequence; if there is no unselected time window, rate limiting is applied to the target request.

[0151] Furthermore, the determining module 30 is also used to determine the initial score increase level based on the status code and the processing capability value of the requested party; detect whether the current time window is the first sequence element in the time window sequence; if it is the first sequence element, obtain the basic score value corresponding to the target request; and determine the rate limiting score value corresponding to the current time window based on the basic score value and the initial score increase level.

[0152] Furthermore, the determining module 30 is also used to obtain the business scenario type and requester type corresponding to the target request; find the initial integral value corresponding to the business scenario type and find the integral coefficient corresponding to the requester type; and determine the basic integral value based on the initial integral value and the integral coefficient.

[0153] Furthermore, the determining module 30 is also used to, if it is not the first sequence element, obtain the previous time window corresponding to the current time window; determine the current score increase level based on the current time window, the processing capability value of the requested party, and the initial increase level; and determine the rate limiting score value corresponding to the current time window based on the rate limiting score value corresponding to the previous time window and the current score increase level.

[0154] Furthermore, the determining module 30 is also used to obtain the time window width corresponding to the current time window, and find the attenuation coefficient corresponding to the processing capability value of the requested party; and determine the current integration increase degree based on the time window width, the attenuation coefficient and the initial integration increase degree.

[0155] Furthermore, the acquisition module 10 is also used to acquire the business scenario type, status code and requested party corresponding to the target request; find the number of time windows corresponding to the business scenario type; find available time windows according to the number of time windows to obtain multiple time windows; sort the multiple time windows according to the corresponding window time interval to obtain the time window sequence corresponding to the target request.

[0156] It should be understood that the above are merely illustrative examples and do not constitute any limitation on the technical solutions of the present invention. In specific applications, those skilled in the art can make settings as needed, and the present invention does not impose any restrictions on this.

[0157] It should be noted that the workflow described above is merely illustrative and does not limit the scope of protection of this invention. In practical applications, those skilled in the art can select some or all of the workflow to achieve the purpose of this embodiment according to actual needs, and no restrictions are imposed here.

[0158] In addition, for technical details not described in detail in this embodiment, please refer to the request rate limiting control method provided in any embodiment of the present invention, which will not be repeated here.

[0159] Furthermore, it should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.

[0160] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0161] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as read-only memory (ROM) / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0162] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.

Claims

1. A request rate limiting control method, characterized in that, The request rate limiting control method includes the following steps: Obtain the time window sequence, status code, and requested party corresponding to the target request; Select the current time window from the time window sequence; The rate limiting integral value corresponding to the current time window is determined based on the status code and the requested party. If the rate limiting score is greater than the preset rate limiting threshold, then the target request will not be rate-limited; The step of determining the rate limiting integral value corresponding to the current time window based on the status code and the requested party includes: The initial score increase is determined based on the status code and the processing capability value of the requested party. Detect whether the current time window is the first sequence element in the time window sequence; If it is the first sequence element, then obtain the basic score value corresponding to the target request; The current time window's rate limiting integral value is determined based on the base integral value and the degree of increase in the initial integral value. After detecting whether the current time window is the first sequence element in the time window sequence, the method further includes: If it is not the first sequence element, then obtain the previous time window corresponding to the current time window; The current score increase rate is determined based on the current time window, the processing capacity value of the requested party, and the initial score increase rate. The current time window's rate limiting integral value is determined based on the rate limiting integral value corresponding to the previous time window and the current degree of integral increase. After the step of determining the rate limiting integral value corresponding to the current time window based on the status code and the requested party, the method further includes: If the rate limiting integral value is less than or equal to the preset rate limiting threshold, then it is detected whether there is an unselected time window in the time window sequence; If there are unselected time windows, return to the step of selecting the current time window from the time window sequence; If there is no unselected time window, the target request will be rate-limited.

2. The request rate limiting control method as described in claim 1, characterized in that, The step of obtaining the basic score value corresponding to the target request includes: Obtain the business scenario type and requester type corresponding to the target request; Find the initial score value corresponding to the business scenario type, and find the score coefficient corresponding to the requester type; The basic integral value is determined based on the initial integral value and the integral coefficient.

3. The request rate limiting control method as described in claim 1, characterized in that, The step of determining the current score increase level based on the current time window, the processing capacity value of the requested party, and the initial score increase level includes: Obtain the width of the current time window and find the attenuation coefficient corresponding to the processing capacity value of the requested party; The current integral increase is determined based on the time window width, the attenuation coefficient, and the initial integral increase.

4. The request rate limiting control method as described in any one of claims 1-3, characterized in that, The steps of obtaining the time window sequence, status code, and requested party corresponding to the target request include: Obtain the business scenario type, status code, and requested party corresponding to the target request; Find the number of time windows corresponding to the business scenario type; Based on the number of time windows, find the available time windows to obtain multiple time windows; The multiple time windows are sorted according to their corresponding time intervals to obtain the time window sequence corresponding to the target request.

5. A request current limiting control device, characterized in that, The request rate limiting control device includes the following modules: The acquisition module is used to acquire the time window sequence, status code, and requested party corresponding to the target request; A selection module is used to select the current time window from the time window sequence; The determination module is used to determine the rate limiting integral value corresponding to the current time window based on the status code and the requested party; The control module is configured to not rate-limit the target request if the rate-limiting integral value is greater than a preset rate-limiting threshold. The determining module is further configured to determine the initial score increase based on the status code and the processing capability value of the requested party; Detect whether the current time window is the first sequence element in the time window sequence; If it is the first sequence element, then obtain the basic score value corresponding to the target request; determine the rate limiting score value corresponding to the current time window based on the basic score value and the degree of increase of the initial score; The determining module is further configured to, if not the first sequence element, obtain the previous time window corresponding to the current time window; determine the current score increase level based on the current time window, the processing capability value of the requested party, and the initial score increase level; and determine the rate limiting score value corresponding to the current time window based on the rate limiting score value corresponding to the previous time window and the current score increase level. The determining module is further configured to: if the rate limiting integral value is less than or equal to a preset rate limiting threshold, detect whether there is an unselected time window in the time window sequence; if there is an unselected time window, return to the step of selecting the current time window from the time window sequence; if there is no unselected time window, rate limiting is applied to the target request.

6. A request current limiting control device, characterized in that, The request rate limiting control device includes: a processor, a memory, and a request rate limiting control program stored in the memory and executable on the processor. When the request rate limiting control program is executed by the processor, it implements the steps of the request rate limiting control method as described in any one of claims 1-4.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a request rate limiting control program, which, when executed, implements the steps of the request rate limiting control method as described in any one of claims 1-4.

Citation Information

Patent Citations

  • Distributed current limiting implementation method and system based on sliding window algorithm

    CN114189478A

  • Anomaly detection current limiting algorithm and device and storage medium

    CN116633819A