A rate limiter supporting priority bulk traffic requests

By using rate limiter splitting and priority mechanisms, the problem of low throughput for batch traffic requests was solved, achieving more efficient traffic management and resource utilization.

CN119788606BActive Publication Date: 2025-10-24ANXINWANGDUN TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411851913.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-16
Publication Date
2025-10-24
Estimated Expiration
2044-12-16

AI Technical Summary

Technical Problem

Current rate limiters have a low pass rate when dealing with batch traffic requests, especially when traffic quota resources are tight. Batch traffic requests are frequently rate-limited, causing difficulties in business processing.

Method used

It employs a rate limiter parameter configuration module, a traffic splitting module, a token management module, and a rate limiting judgment and execution module. It splits batch traffic requests into multiple fragments and performs rate limiting judgment based on rate limiter parameters and token quotas, supporting priority batch traffic requests.

Benefits of technology

It improved the pass rate of batch traffic requests, avoided the waste of quota resources, ensured the orderly passage of batch traffic requests, and met business needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119788606B_ABST
    Figure CN119788606B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of service end software resource allocation, in particular to a flow limiter supporting priority batch flow requests, which comprises a flow splitting module, a token management module and a flow limiting judgment and execution module; the flow splitting module is used for splitting the batch flow requests into multiple batch fragments; the token management module is used for recording and managing the current token quota accumulated in the token bucket; the flow limiting judgment and execution module is used for judging the batch flow requests according to the flow limiter parameters and the current token quota, and executing the actions of releasing or splitting the batch flow requests according to the judgment results and the flow splitting module. The application avoids the frequent limitation of the batch flow requests when the quota cannot reach the expected quota of the batch flow requests, avoids the permanent limitation of the batch flow requests when the expected quota of the batch flow requests exceeds the maximum quota of the flow limiter, splits the batch flow into sub-batch flows with appropriate sizes, can more fully utilize the quota resources of the flow limiter, and improves the passing rate of the batch flow requests.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of service software resource allocation, and particularly relates to a flow limiter supporting priority batch flow requests. BACKGROUND

[0002] A service software provides services to the outside through an interface API. Since the upstream calling party request volume cannot be controlled, when the instantaneous request volume suddenly increases, the service end will occupy too many resources, resulting in reduced response speed, timeout, even system crash, and even cause an avalanche to make the entire system unavailable.

[0003] The flow limiter controls the API request passing volume, quickly rejects, fails or discards the requests exceeding the limit, prevents the system from collapsing due to overload, and ensures the stability of the service and the downstream resource system.

[0004] The implementation of the flow limiter can be based on different algorithms and strategies. The industry basic algorithms include fixed window algorithm, sliding window algorithm, token bucket algorithm, leaky bucket algorithm, etc. However, in some application scenarios, there are still some deficiencies in the aspects of flow limiting effect, functional expectation, business development complexity, etc. For example, in order to improve the interaction efficiency between services, the service end provides a batch read-write interface. Through a batch call request, multiple call requests are replaced, the network call overhead is saved, and the performance of the service end and the database for batch processing is usually better. However, the existing algorithm has a low batch flow request passing rate, and when the traffic quota resource is tight, the batch flow request limiting situation will occur frequently, the passing rate is low, and in the extreme case, the batch flow request will be rejected all the time, and it is difficult to process the business through the flow limiter.

[0005] Therefore, a flow limiter capable of improving the batch flow request passing rate is needed. SUMMARY

[0006] (I) Invention purpose

[0007] The purpose of the present application is to provide a flow limiter supporting priority batch flow requests capable of improving the batch flow request passing rate.

[0008] (II) Technical solutions

[0009] To solve the above problems, the present application provides a flow limiter supporting priority batch flow requests, comprising:

[0010] A flow limiter parameter configuration module, a flow splitting module, a token management module and a flow limiting judgment and execution module;

[0011] The flow limiter parameter configuration module is used for setting the parameters of the flow limiter;

[0012] The traffic splitting module is configured to split the batch traffic request into a plurality of batch fragments.

[0013] The token management module is configured to record and manage the current token quota accumulated in the token bucket.

[0014] The traffic splitting module is configured to split the batch traffic request into a plurality of batch fragments.

[0015] In another aspect of the present application, preferably,

[0016] The parameters of the traffic limiter include: a maximum traffic quota of the bucket, a time length of a traffic limiting period, a number of intervals per period, a maximum burst traffic allowed, a maximum compensation number per interval, an average quota amount per interval, and a time length per interval.

[0017] The average quota amount per interval is obtained by dividing the maximum traffic quota of the bucket by the number of intervals per period.

[0018] The time length per interval is obtained by dividing the time length of the traffic limiting period by the number of intervals per period.

[0019] In another aspect of the present application, preferably,

[0020] The traffic limiting judgment on the batch traffic request includes: performing traffic limiting judgment according to a first rule.

[0021] The first rule includes:

[0022] When the batch traffic request is 1;

[0023] If the number of batch traffic requests is less than or equal to the average quota amount per interval of the traffic limiter, the traffic limiter directly releases;

[0024] If the number of batch traffic requests is greater than the average quota amount per interval of the traffic limiter, the traffic limiter splits the batch traffic request into a plurality of batch fragments according to a first formula through the traffic splitting module, and the traffic limiter releases in turn.

[0025] The first formula is expressed as:

[0026]

[0027] Wherein, S represents the number of batch fragments of the first formula, qps_batch_req represents the number of batch traffic requests, and qps_per_interval represents the average quota amount per interval.

[0028] In another aspect of the present application, preferably,

[0029] The first rule further comprises:

[0030] When the batch flow request is 1, burst instantaneous flow is allowed;

[0031] If the number of the batch flow request is greater than the average quota per gap and less than or equal to the allowed maximum burst flow, the flow limiter directly releases;

[0032] If the number of the batch flow request is greater than the allowed maximum burst flow, the flow limiter splits the batch flow request into multiple batch fragments according to a second formula through the flow splitting module, and the flow limiter releases in turn;

[0033] The second formula is represented as:

[0034]

[0035] Wherein, U represents the number of batch fragments of the second formula, qps_batch_req represents the number of batch flow requests, and max_bust represents the allowed maximum burst flow.

[0036] In another aspect of the present application, preferably,

[0037] When the number of the batch flow request is greater than the allowed maximum burst flow, the current token quota in the token bucket is used;

[0038] If the current token quota is less than the allowed maximum burst flow, the token quota in the subsequent time slot is used for compensation, and the maximum compensation number is the maximum compensation number per gap in the flow limiter parameters.

[0039] In another aspect of the present application, preferably,

[0040] The flow limiting judgment on the batch flow request further comprises: performing flow limiting judgment according to a second rule;

[0041] The second rule comprises:

[0042] When the batch flow request is greater than 1, the batch flow request comprises a first batch flow request and a second batch flow request;

[0043] If the second batch flow request obtains the token quota of the gap, the first batch flow request is split according to the remaining token quota of the gap to obtain a first batch fragment and a second batch fragment;

[0044] The first batch fragment is processed by the remaining token quota of the gap;

[0045] The second batch fragment is processed according to the first rule.

[0046] Another aspect of the present application, preferably,

[0047] The second rule further comprises:

[0048] When the batch flow request is greater than 1, the burst instantaneous flow is allowed;

[0049] When the second batch flow request obtains the gap token quota;

[0050] If the value of the allowed maximum burst flow minus the number of the second batch flow request is greater than or equal to the number of the first batch flow request, the flow restrictor is directly released;

[0051] If the value of the allowed maximum burst flow minus the number of the second batch flow request is less than the number of the first batch flow request, it is processed according to the first rule.

[0052] Another aspect of the present application, preferably,

[0053] Further comprising a priority module;

[0054] The priority module prioritizes the batch flow requests according to a preset first priority rule or a preset second priority rule.

[0055] Another aspect of the present application, preferably,

[0056] The preset first priority rule comprises:

[0057] When the high-priority batch flow needs to be split, the token quota of each time slot is preferentially allocated to the batch fragments of the high-priority batch flow after splitting, until all are satisfied.

[0058] Another aspect of the present application, preferably,

[0059] The preset second priority rule comprises:

[0060] When the high-priority batch flow needs to be split, the flow quota of each time slot is preferentially allocated to the batch fragments of the high-priority batch flow after splitting, and the remaining quota is competed by the batch fragments of the high-priority batch flow after splitting and other batch flows.

[0061] (Three) beneficial effects

[0062] The above technical solutions of the present application have the following beneficial technical effects:

[0063] The application splits the batch flow request into multiple batch fragments through the flow splitting module, avoids that the batch flow request is limited frequently when the quota cannot reach the expected quota of the batch flow request, avoids that the batch flow request is always limited when the expected quota of the batch flow request exceeds the maximum quota of the flow limiter, splits the batch flow into sub-batch flows of appropriate size, can more fully utilize the quota resources of the flow limiter, avoids that the quota resources are wasted when the quota resources cannot meet the overall batch flow, and improves the pass rate of the batch flow request. BRIEF DESCRIPTION OF DRAWINGS

[0064] Figure 1 is a schematic diagram of the overall structure of an embodiment of the application;

[0065] Figure 2 is a schematic diagram of a batch flow request of 1 entering a flow limiter;

[0066] Figure 3 is a schematic diagram of a batch flow request of 1 entering a flow limiter;

[0067] Figure 4 is a schematic diagram of a batch flow request of 1 entering a flow limiter;

[0068] Figure 5 is a schematic diagram of a batch flow request of 1 entering a flow limiter;

[0069] Figure 6 is a schematic diagram of a batch flow request of 1 entering a flow limiter;

[0070] Figure 7 is a schematic diagram of a batch flow request of 1 entering a flow limiter;

[0071] Figure 8 is a schematic diagram of a batch flow request of 1 entering a flow limiter. DETAILED DESCRIPTION

[0072] To make the objects, technical solutions and advantages of the present application clearer, further detailed description will be given below in conjunction with specific embodiments and reference to the drawings. It should be understood that these descriptions are only exemplary and are not intended to limit the scope of the present application. In addition, in the following description, the description of known structures and technologies is omitted to avoid unnecessary confusion of the concept of the present application.

[0073] Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.

[0074] In addition, the technical features involved in different embodiments of the application described below can be combined with each other as long as there is no conflict between them.

[0075] The present application will be described in more detail below with reference to the accompanying drawings. In each of the drawings, the same elements are denoted by like reference numerals. For the sake of clarity, each part in the drawings is not drawn to scale.

[0076] Embodiment one

[0077] A flow limiter supporting priority batch flow requests, Figure 1 The overall structure of one embodiment of the present application is shown in the schematic diagram as shown in Figure 1 including:

[0078] The flow limiter parameter configuration module, the flow splitting module, the token management module and the flow limiting judgment and execution module;

[0079] The flow limiter parameter configuration module is used to set the parameters of the flow limiter; in the present embodiment, the parameters of the flow limiter include: bucket maximum flow quota, flow limiting period time length, number of intervals per period, maximum burst flow allowed, maximum compensation number per interval, average quota amount per interval and interval time length; the average quota amount per interval is obtained by dividing the bucket maximum flow quota by the number of intervals per period; the interval time length is obtained by dividing the flow limiting period time length by the number of intervals per period.

[0080] The parameters of the flow limiter are represented by the following codes respectively:

[0081] bucket_capacity: bucket maximum flow quota;

[0082] bucket_unit_time: flow limiting period time length;

[0083] interval_unit_count: number of intervals per period;

[0084] max_bust: maximum burst flow allowed, satisfying qps_per_interval<=max_bust;

[0085] interval_compensate_max_count: maximum compensation number per interval;

[0086] interval_compensate_max_count <= qps_per_interval;

[0087] qps_per_interval: average quota per interval;

[0088] qps_per_interval = bucket_capacity / interval_unit_count;

[0089] interval_unit_time: interval length;

[0090] interval_unit_time = bucket_unit_time / interval_unit_count;

[0091] The following code defines the relevant content of the batch flow request:

[0092] qps_batch_req: number of batch flow requests;

[0093] qps_batch_req_0...b: split batch flow fragments, numbered as integers from 0 to b;

[0094] split_fun: split function, which can split qps_batch_req_x flow according to the expected flow number;

[0095] merge_fun: merge function, which can merge b+1 return values of qps_batch_req_0...b into one return value;

[0096] token_num: to cope with instantaneous burst flow, use token bucket to accumulate unused quota, token_num represents the current token quota;

[0097] The flow splitting module is used to split the batch flow request into multiple batch fragments;

[0098] The token management module is used to record and manage the accumulated current token quota in the token bucket;

[0099] The flow limiting judgment and execution module is used to perform flow limiting judgment on the batch flow request according to the flow limiter parameters and the current token quota, and to perform the action of releasing or splitting the batch flow request according to the judgment result, and the action of splitting the batch flow request is realized through the flow splitting module.

[0100] Further, in the embodiment, the flow limiting judgment on the batch flow request comprises: performing flow limiting judgment according to a first rule; the batch flow request can be one or a plurality of;

[0101] The first rule comprises:

[0102] When the batch flow request is one, the batch flow request is one in a time interval;

[0103] If the number of the batch flow request is less than or equal to the average quota of the flow limiter per interval, the flow limiter directly releases; Figure 2 A schematic diagram of a batch flow request entering a flow limiter according to an embodiment of the application is shown in FIG. 1. Figure 2 As shown in FIG. 1, the abscissa represents time axis, indicating each time interval; the ordinate represents flow quantity, and the dotted line represents the average quota per interval, as shown in FIG. 1, the average quota per interval is 5, if the number of the batch flow request is less than or equal to 5, the flow limiter directly releases. Figure 2

[0104] If the number of the batch flow request is greater than the average quota per interval of the flow limiter, the flow limiter splits the batch flow request into a plurality of batch fragments according to a first formula through a flow splitting module, and the flow limiter releases in sequence;

[0105] The first formula is shown in the following formula (1):

[0106]

[0107] In the formula (1), S represents the number of batch fragments of the first formula, qps_batch_req represents the number of the batch flow request, and qps_per_interval represents the average quota per interval.

[0108] Figure 3 A schematic diagram of the batch flow request after splitting passing through the flow limiter according to an embodiment of the application is shown in FIG. 2. Figure 3 As shown in FIG. 2, the number of the batch flow request is 12, 5 quotas are provided in time interval 1, the split function split_fun is used to split the batch flow into 5 qps_batch_req_0, and the remaining batch flow is 12-5=7. 5 quotas can be provided in time interval 2, the batch flow is split into 5 qps_batch_req_1, and the remaining batch flow is 7-5=2. 5 quotas can be provided in time interval 3, and the remaining 2 directly constitute qps_batch_req_2. The overall batch flow request passes through the flow limiter in sequence.

[0109] Further, in the embodiment, the first rule further comprises:

[0110] ​When the batch flow request is 1, burst instantaneous flow is allowed; the condition for allowing burst instantaneous flow is that there is no token quota to be compensated;

[0111] If the number of the batch flow requests is greater than the average quota per interval and less than or equal to the allowed maximum burst flow, the flow restrictor directly releases;

[0112] If the number of the batch flow requests is greater than the allowed maximum burst flow, the flow restrictor splits the batch flow requests into multiple batch fragments according to a second formula through the flow splitting module, and the flow restrictor releases in sequence;

[0113] The second formula is expressed as:

[0114]

[0115] Wherein, U represents the number of batch fragments of the second formula, qps_batch_req represents the number of batch flow requests, and max_bust represents the allowed maximum burst flow.

[0116] Further, in the embodiment,

[0117] When the number of the batch flow requests is greater than the allowed maximum burst flow, the current token quota in the token bucket is used;

[0118] If the number of tokens in the bucket token_num >= max_bust, qps_batch_req_0 of the batch flow size of max_bust is split out, and the flow restrictor is released. Because the cumulative quota is used, subsequent time slots do not need to be compensated.

[0119] If the current token quota is less than the allowed maximum burst flow, the token quota in the subsequent time slot is used for compensation, and the maximum compensation number is the maximum compensation number per interval in the flow restrictor parameter. If the number of tokens in the bucket token_num < max_bust, the flow restrictor parameter max_bust-token_num-qps_per_interval used additionally in this time slot is compensated averagely in the subsequent time slot quota, and the maximum compensation interval_compensate_max_count is compensated in each time slot. The flow quota used by the burst instantaneous flow is used first, and if the current token quota is not enough, the excess quota is used for prepayment in the subsequent time slot. Before the additional used flow quota is completely compensated, no new burst flow exceeding the normal time slot quota is allowed to pass through. Figure 4 A schematic diagram of a batch flow request of 1, allowing burst instantaneous flow to pass through the flow restrictor, is shown in the embodiment of the application, as shown in Figure 4As shown, time slot 1 allows 10 burst instantaneous flows to pass, the batch flow request is 10, which can directly pass without splitting, but 10-0-5=5 (pieces) of the quota are additionally used. Each subsequent time slot compensates for a maximum of 1 quota, so 5 quotas need to be compensated for in the next 5 time slots, and the number of quotas of these 5 consecutive time slots changes from 5 to 4. After compensation, the number of time slot quotas changes from 4 to 5.

[0120] Further, in the embodiment, the flow limiting judgment on the batch flow request further comprises: performing flow limiting judgment according to a second rule;

[0121] The second rule comprises:

[0122] When the batch flow request is greater than 1, the batch flow request comprises a first batch flow request and a second batch flow request; the batch flow request is not a single time in a certain time slot;

[0123] If the second batch flow request obtains the token quota of the gap, the first batch flow request is split according to the remaining token quota of the gap to obtain a first batch fragment and a second batch fragment;

[0124] The first batch fragment is processed by the remaining token quota of the gap;

[0125] The second batch fragment is processed according to the first rule.

[0126] Figure 5 A flow limiter diagram when the batch flow request is greater than 1 is shown, as shown in FIG. 1. Figure 5 As shown, the second batch flow request occupies 2 quotas of time slot 1, so the first batch flow request can be split into 3 flow qps_batch_req_0, 5 flow qps_batch_req_1, and 4 flow qps_batch_req_3 in sequence, which use time slot 1, time slot 2, and time slot 3 respectively. The overall batch flow passes through the flow limiter.

[0127] Further, in the embodiment,

[0128] The second rule further comprises:

[0129] When the batch flow request is greater than 1, the burst instantaneous flow is allowed;

[0130] When the second batch flow request obtains the gap token quota;

[0131] If the value of the allowed maximum burst flow minus the number of the second batch flow request is greater than or equal to the number of the first batch flow request, the flow limiter directly releases;

[0132] If the value of the allowed maximum burst traffic minus the number of the second batch of traffic requests is less than the number of the first batch of traffic requests, processing according to the first rule.

[0133] Figure 6 A schematic diagram of a batch traffic request greater than 1 and burst instantaneous traffic passing through a flow limiter is shown in one embodiment of the application, as shown in Figure 6 After the second batch of traffic occupies 2 quotas in time slot 1, the burst traffic quota is max_bust-2 = 10-2 = 8 (units). When the first batch of traffic is 8 units, 8+2-5 = 5 (units) of quota is additionally used to pass through the flow limiter, and each subsequent time slot can compensate for a maximum of 1 quota, so 5 quotas need to be compensated for in the next 5 time slots, and the number of quotas in these 5 consecutive time slots changes from 5 to 4. After the compensation is completed, the number of time slot quotas changes from 4 to 5.

[0134] Further, the embodiment also includes a priority module;

[0135] The priority module prioritizes the batch traffic request according to a preset first priority rule or a preset second priority rule.

[0136] The preset first priority rule includes:

[0137] When high-priority batch traffic needs to be split, all token quotas per time slot are preferentially allocated to the split batch fragments of the high-priority batch traffic until all are satisfied.

[0138] High priority is absolutely prioritized. When high-priority batch traffic does not need to be split, it normally occupies flow quotas. When it needs to be split, if the first high-priority batch traffic obtains a flow quota, then all flow quotas per time slot are preferentially allocated to the high-priority split traffic, and after the high-priority split traffic is satisfied, the remaining flow quotas are allocated to other traffic. In this process, if higher-priority batch traffic enters, flow quotas are preferentially supplied to the higher-priority batch traffic. The disadvantage of this strategy is that high-priority traffic occupies flow quotas, which prolongs the overall call return time of low-priority batch split traffic; in an extreme scenario, if high-priority traffic always enters, low-priority traffic will always be in a starvation state. In practice, batch traffic that has not obtained a flow quota within a certain time can return an error message to the calling party to avoid calling timeout due to the calling not being returned.

[0139] The preset second priority rule includes:

[0140] When the high-priority batch flow needs to be split, the traffic quota of each time slot is preferentially allocated to the split batch flow of the high-priority batch flow, and the remaining quota is competed by the split batch flow of the high-priority batch flow and other batch flows.

[0141] The high-priority batch flow has a relative priority. When the high-priority batch flow does not need to be split, the high-priority batch flow normally occupies the traffic quota. When the high-priority batch flow needs to be split, if the first high-priority batch flow obtains the traffic quota, then the traffic quota of each time slot is preferentially allocated to the split batch flow of the high-priority batch flow. In each time slot, the remaining quota is competed by the split batch flow of the high-priority batch flow and other batch flows. The disadvantage of this strategy is that the overall call return time of the high-priority batch flow is lengthened under the competition of other batch flows. The advantage of this strategy is that the low-priority batch flow can be prevented from being in a starvation state.

[0142] When other flows compete for the quota, if there is no priority, all the flows compete for the quota; if there is a priority, the high-priority flow has a priority in the gap 1, and the quota competition in the subsequent time slots is determined according to the priority scheduling strategy. Figure 7 A preset second priority rule of one embodiment of the application is shown by a traffic shaper, as shown in FIG. 4. Figure 7 As shown in FIG. 5, when the high-priority relative priority is used, other flows can compete for the traffic quota. Other flows occupy 2 quotas of the time slot 2, and then the batch flow of 12 can be split into 5 flows of qps_batch_req_0, 3 flows of qps_batch_req_1, and 4 flows of qps_batch_req_3, which are used in the time slot 1, the time slot 2, and the time slot 3, respectively. The overall batch flow passes through the traffic shaper.

[0143] Figure 8 A schematic diagram of a batch flow request greater than 1 and a burst instantaneous flow degradation passing through a traffic shaper is shown, as shown in FIG. 6. Figure 8 As shown in FIG. 7, after other flows occupy 2 quotas of the time slot 1, the burst traffic quota is max_bust-2=10-2=8. When the batch flow is 10, the batch flow cannot directly pass through the traffic shaper. Therefore, the batch flow is degraded to a normal split mode to pass through the traffic shaper. The batch flow is split into 3 flows of qps_batch_req_0, 5 flows of qps_batch_req_1, and 2 flows of qps_batch_req_2, which pass through the traffic shaper.

[0144] The embodiment splits the batch traffic request into multiple batch fragments through a traffic splitting module, avoids that the batch traffic request is frequently limited when the quota does not reach the expected quota of the batch traffic request, avoids that the batch traffic request is always limited when the expected quota of the batch traffic request exceeds the maximum quota of the flow limiter, splits the batch traffic into sub-batch traffics of appropriate size, can more fully utilize the quota resources of the flow limiter, avoids that the quota resources cannot meet the overall batch traffic, and improves the pass rate of the batch traffic request.

[0145] The batch traffic request is controlled to pass through the flow limiter in an orderly manner. In the prior art, if the traffic exceeds the time slot quota, the passing is rejected; if the batch traffic request exceeds the period quota, the batch traffic request can never pass. The embodiment can split the batch traffic into batch fragments of appropriate size for passing through the flow limiter.

[0146] At the level of the flow limiter, a traffic splitting module is introduced, so that the batch traffic can be adjusted in a more fine-grained manner. The batch traffic is split into multiple batch traffics by using a splitting function, and the return values of the batches are merged by using a merging function and then returned to the calling party.

[0147] The priority mechanism is provided, the high-priority traffic has a greater probability of competing for the quota of the flow limiter, the flexible and customizable priority scheduling strategy is used, and the needs of the actual business scenarios for the competition of the quota by the priority traffic are met. At present, in the industry, one idea is to construct multiple flow limiters, and different flow limiters have different priorities; one idea is that in one flow limiter, the priority of the business traffic source and the predetermined quota are pre-configured, and the priority is compared and the specified quota is allocated by identifying the traffic source. The present application does not need pre-configuration, only uses the priority attribute of the traffic itself, uses the customizable priority scheduling strategy to allocate the quota of each time slot, and can more fully utilize the resources. The situation that even if there is still quota in the time slot, the traffic quota cannot be used due to reaching the upper limit of the predetermined traffic quota of the business, and the resources cannot be fully utilized, is avoided. The native priority mechanism makes the high-priority traffic more likely to pass through the flow limiter, improves the interface response speed, and meets the needs of the business scenarios.

[0148] The instant burst traffic scenario is supported, and a quota compensation mechanism is introduced, which has the characteristics of the token bucket for responding to the burst traffic and the uniform characteristics of the leaky bucket algorithm. The instant burst traffic introduces the quota compensation mechanism, avoids that the burst traffic exhausts the quota in the period instantaneously, and no traffic passes in the subsequent time slots, thereby reducing the instant pressure on the system. The quota compensation mechanism reduces the traffic quota in the time slots in a certain time in the future, and provides time for the system to relieve the pressure.

[0149] It is to be understood that the above specific embodiments of the present application are merely illustrative of the principles of the present application and are not intended to limit the scope of the present application. Any modification, equivalent substitution, improvement, etc. made without departing from the spirit and scope of the present application should be included in the scope of protection of the present application. In addition, the appended claims of the present application are intended to cover all changes and modifications falling within the scope and boundary of the appended claims or the equivalent forms of such scope and boundary.

[0150] The present application has been described above with reference to the embodiments of the present application. However, these embodiments are merely for illustrative purposes and are not intended to limit the scope of the present application. The scope of the present application is defined by the appended claims and their equivalents. Those skilled in the art can make various substitutions and modifications without departing from the scope of the present application, and such substitutions and modifications should fall within the scope of the present application.

[0151] Although the embodiments of the present application have been described in detail, it should be understood that various changes, substitutions and alterations can be made to the embodiments of the present application without departing from the spirit and scope of the present application.

[0152] Obviously, the above-described embodiments are merely for illustrative purposes and are not intended to limit the embodiments. Based on the above description, other different forms of changes or modifications can be made by those of ordinary skill in the art. Here, it is not necessary or possible to exhaust all the embodiments. The obvious changes or modifications derived therefrom are still within the scope of protection of the present application.

Claims

1. A policer that supports priority bulk flow requests, the policer comprising: Comprise: The flow limiter parameter configuration module, the flow splitting module, the token management module and the flow limiting judgment and execution module; The flow limiter parameter configuration module is used to set the parameters of the flow limiter; The flow splitting module is used to split the batch flow request into multiple batch fragments; The token management module is used to record and manage the current token quota accumulated in the token bucket; The flow limiting judgment and execution module is used to make flow limiting judgment on the batch flow request according to the flow limiter parameters and the current token quota, and execute the action of releasing or splitting the batch flow request according to the judgment result, and the action of splitting the batch flow request is realized through the flow splitting module; Wherein, the flow limiting judgment on the batch flow request comprises: making flow limiting judgment according to the first rule; The first rule comprises: When the batch flow request is 1; If the number of batch flow requests is less than or equal to the average quota per interval of the flow limiter, the flow limiter releases directly; If the number of batch flow requests is greater than the average quota per interval of the flow limiter, the flow limiter splits the batch flow request into multiple batch fragments according to the first formula through the flow splitting module, and the flow limiter releases in turn; The flow limiting judgment on the batch flow request also comprises: making flow limiting judgment according to the second rule; The second rule comprises: When the batch flow request is greater than 1, the batch flow request comprises a first batch flow request and a second batch flow request; If the second batch flow request obtains the token quota of the interval, then the first batch flow request is split according to the remaining token quota of the interval to obtain a first batch fragment and a second batch fragment; The first batch fragment is processed by the remaining token quota of the interval; The second batch fragment is processed according to the first rule.

2. The flow limiter of claim 1, wherein The parameters of the flow limiter comprise: bucket maximum flow quota, flow limiting period time length, number of intervals per cycle, maximum allowed burst flow, maximum compensation number per interval, average quota per interval, and interval time length per interval; The average quota per interval is obtained by dividing the bucket maximum flow quota by the number of intervals per cycle; The interval time length per interval is obtained by dividing the flow limiting period time length by the number of intervals per cycle.

3. The flow limiter of claim 1, wherein The first formula is represented as: Wherein, S represents the number of batch fragments of the first formula, qps_batch_req represents the number of batch flow requests, and qps_per_interval represents the average quota per interval.

4. The flow restrictor of claim 3, wherein The first rule further comprises: When the batch flow request is 1, the burst instantaneous flow is allowed; If the number of batch flow requests is greater than the average quota per interval and less than or equal to the maximum allowed burst flow, the flow limiter releases directly; If the number of batch flow requests is greater than the maximum allowed burst flow, the flow limiter splits the batch flow request into multiple batch fragments according to the second formula through the flow splitting module, and the flow limiter releases in turn; The second formula is represented as: Wherein, U represents the number of batch shards of the second formula, qps_batch_req represents the number of batch traffic requests, and max_burst represents the allowed maximum burst traffic.

5. The flow restrictor of claim 4, wherein, When the number of batch traffic requests is greater than the allowed maximum burst traffic, the current token quota in the token bucket is used; If the current token quota is less than the allowed maximum burst traffic, the token quota in the subsequent time slot is used for compensation, and the maximum compensation amount is the maximum compensation amount per interval in the flow restrictor parameters.

6. The flow restrictor of claim 1, wherein The second rule further comprises: When the number of batch traffic requests is greater than 1, the burst instantaneous traffic is allowed; When the second batch traffic request obtains the interval token quota; If the value of the allowed maximum burst traffic minus the number of the second batch traffic request is greater than or equal to the number of the first batch traffic request, the flow restrictor is directly released; If the value of the allowed maximum burst traffic minus the number of the second batch traffic request is less than the number of the first batch traffic request, it is processed according to the first rule.

7. The flow restrictor of claim 1, wherein Further comprising a priority module; The priority module prioritizes the batch traffic requests according to a preset first priority rule or a preset second priority rule.

8. The flow restrictor of claim 7, wherein, The preset first priority rule comprises: When the high-priority batch traffic needs to be split, the token quota of each time slot is preferentially allocated to the batch shards split from the high-priority batch traffic until all requirements are met.

9. The flow restrictor of claim 7, wherein, The preset second priority rule comprises: When the high-priority batch traffic needs to be split, the traffic quota of each time slot is partially preferentially allocated to the batch shards split from the high-priority batch traffic, and the remaining quota is competed for by the batch shards split from the high-priority batch traffic and other batch traffics.

Citation Information

Patent Citations

  • A method and device for limiting traffic

    CN110275780A

  • Traffic management method and device and nonvolatile computer readable storage medium

    CN115842857A