Data flow limiting method and device for network communication, electronic equipment and storage medium

By employing multi-dimensional hierarchical control and adaptive rate limiting algorithms, the problem of the token bucket algorithm's inability to adapt to complex traffic patterns is solved, enabling refined management of network requests and improving system stability and resource utilization.

CN121239637APending Publication Date: 2025-12-30中国移动通信有限公司销售分公司 +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510216272.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-26
Publication Date
2025-12-30

AI Technical Summary

Technical Problem

Existing token bucket algorithms cannot control network requests at different business levels with fine granularity, resulting in insufficient response to complex and dynamically changing traffic patterns, and an inability to distinguish traffic priorities and adapt to different business scenarios.

Method used

An adaptive rate limiting method based on multi-dimensional hierarchical control is adopted. By labeling network requests with multi-dimensional information (such as user dimension, business type, time dimension, and region dimension), priority is distinguished. The rate limiting strategy is dynamically adjusted according to the historical maximum query volume per second of the business system, ensuring that high-priority requests are directly accessed, while low-priority requests are processed under the adaptive rate limiting algorithm.

Benefits of technology

It enables fine-grained management of network requests, ensuring system stability under high load and resource utilization under low load, thus ensuring rapid processing of critical business operations and improved user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121239637A_ABST
    Figure CN121239637A_ABST
Patent Text Reader

Abstract

The invention provides a data flow limiting method and device for network communication, electronic equipment and a storage medium, and belongs to the technical field of communication, and the method comprises the steps: marking the priority level of a network request based on the multi-dimensional information of the network request; when the network request is marked as the high priority, allowing the network request to access the service system; otherwise, according to the maximum query quantity per second of the historical same period in the current time window, when it is determined that the actual concurrency number of the service system in the next time window is smaller than the maximum concurrency number, the service system is allowed to access the service system in the next time window. According to the self-adaptive flow limiting method based on multi-dimensional hierarchical control, network requests are divided into high-priority requests and low-priority requests by using multi-dimensional information, and resources are directly accessed to the high-priority requests. The self-adaptive current limiting algorithm is used for current limiting of the low-priority requests, current limiting of key services can be avoided, it is ensured that the system is effectively protected by a high load, and the resource utilization rate is improved by a low load.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of communication technology, and in particular to a data flow limiting method, apparatus, electronic device, and storage medium for network communication. Background Technology

[0002] In the field of internet communication, many scenarios require limiting the rate of network requests to prevent backend servers from malfunctioning due to large traffic surges.

[0003] In the field of telecommunications, the token bucket algorithm is commonly used to control the data transmission and reception rate of network communication. Similarly, in the internet domain, the token bucket algorithm is also used to control the access frequency of network requests. Specifically, the server generates tokens at a set rate. If the token bucket is not full, a token is added; if the token bucket is full, newly generated tokens are discarded. The token bucket has a set upper limit. For each network request accessing an interface, the number of tokens consumed from the token bucket is used to allow access to the interface. If a token is successfully acquired, the access to the interface is completed; if token acquisition fails, the network request is discarded or queued for re-access.

[0004] However, since the token bucket algorithm's rate limiting usually applies to overall traffic, it imposes uniform restrictions on all network requests entering the business system, making it impossible to control at a fine-grained level at different business layers and unable to cope with complex scenarios. Summary of the Invention

[0005] This invention provides a data flow limiting method, apparatus, electronic device, and storage medium for network communication, which solves the problem that the existing technology imposes uniform restrictions on all network requests entering the business system, which cannot cope with complex scenarios and results in insufficient response to complex and dynamically changing traffic patterns.

[0006] This invention provides a data rate limiting method for network communication, comprising the following steps: Based on multi-dimensional information about network requests, the priority level of the network requests is marked; If the priority level of the network request meets the preset conditions, the network request is allowed to access the business system; Otherwise, based on the maximum number of queries per second in the same historical period within the current time window, determine the maximum number of concurrent requests allowed for the business system in the next time window; If the actual number of concurrent requests within the next time window is determined to be less than the maximum number of concurrent requests, the network request is allowed to access the business system within the next time window.

[0007] According to a data rate limiting method for network communication provided by the present invention, the step of marking the priority level of the network request based on multi-dimensional information of the network request includes: If at least one dimension of the multi-dimensional information satisfies a preset judgment condition, the priority level of the network request is marked as high priority. The multi-dimensional information includes at least user-dimensional information, business type information, time-dimensional information, and geographic-dimensional information.

[0008] According to a data flow limiting method for network communication provided by the present invention, the user dimension information includes at least user identity category information, user activity information, and user login device information; Determining whether the user dimension information meets preset judgment conditions includes: The user's level is determined to be higher than a preset identity level threshold based on the user identity category information, or the user's activity level is determined to exceed a preset duration based on the user activity information, or the user's login device is determined to be a mobile device based on the user login device information.

[0009] According to a data flow limiting method for network communication provided by the present invention, the service type information includes at least service operation level and service operation type information; The conditions under which the business type information meets preset judgment criteria include: The service operation level is determined to be higher than a preset service level threshold, or the operation corresponding to the network request is determined to be a sensitive operation based on the service operation type information.

[0010] According to a data rate limiting method for network communication provided by the present invention, the time dimension information includes at least the timestamp information of the network request; Determining whether the time dimension information meets preset judgment conditions includes: Based on the timestamp information, it is determined that the current period is not a peak business period.

[0011] According to the present invention, a data flow limiting method for network communication is provided, wherein the geographical dimension information includes at least regional level information and hotspot division information; The conditions under which the geographic dimension information meets preset judgment criteria include: Based on the regional level information, it is determined that the regional level of the user's region is higher than the preset regional level threshold, or based on the hotspot classification information, it is determined that the user's region is a hotspot area.

[0012] According to a data rate limiting method for network communication provided by the present invention, determining the maximum allowed concurrency of the business system in the next time window based on the maximum number of queries per second in the historical period within the current time window includes: If the sampling start time of the next time window is determined to be less than the time span of the current time window, then the maximum number of queries per second is adjusted using a preset attenuation coefficient, and then the maximum number of concurrent requests is obtained by unit synchronization. Otherwise, after adjusting the maximum number of queries per second using the maximum growth factor of the same historical period, the maximum concurrency is obtained by unit synchronization.

[0013] According to the data rate limiting method for network communication provided by the present invention, the maximum growth factor within any time window is determined based on the following method: Determine the growth factor after each network request is received within any given time window; The maximum value of all growth factors determined within any given time window is taken as the maximum growth factor within that given time window.

[0014] According to a data rate limiting method for network communication provided by the present invention, the calculation function expression of the growth factor determined after each network request is received is as follows: ; in, The largest growth factor for QPS; The minimum growth factor for QPS; Queries per second; This represents the highest number of queries per second in the same historical period. This represents the average response time difference. No load delay; k Adjust the preset growth factor range.

[0015] According to a data rate limiting method for network communication provided by the present invention, the calculation function expression for determining the maximum allowed concurrency of the business system in the next time window is as follows, based on the maximum query volume per second of the business system in the historical same period within the current time window: ; in, Maximum concurrency; The timestamp for the next sampling start; This is the timestamp of the current sample.

[0016] The present invention also provides a data flow limiting device for network communication, including a level calibration unit and a communication control unit; The priority labeling unit is used to label the priority level of the network request based on the multi-dimensional information of the network request; The communication control unit is used to perform the following operations: If the priority level of the network request meets the preset conditions, the network request is allowed to access the business system; Otherwise, based on the maximum number of queries per second in the same historical period within the current time window, determine the maximum number of concurrent requests allowed for the business system in the next time window; If the actual number of concurrent requests within the next time window is determined to be less than the maximum number of concurrent requests, the network request is allowed to access the business system within the next time window.

[0017] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the data flow limiting method for network communication as described above.

[0018] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the data flow limiting method for network communication as described above.

[0019] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements a data flow limiting method for network communication as described above.

[0020] The network communication data rate limiting method, apparatus, electronic device, and storage medium provided by this invention classify network requests into high-priority and low-priority requests using multi-dimensional information. High-priority requests directly access resources, while low-priority requests are rate-limited using an adaptive rate limiting algorithm. This avoids rate limiting for critical services, ensures effective system protection under high load, and improves resource utilization under low load. Attached Figure Description

[0021] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0022] Figure 1 This is a flowchart illustrating existing methods for data rate limiting in network communication. Figure 2 This is a flowchart illustrating the data flow limiting method for network communication provided by the present invention; Figure 3 This is a schematic diagram of the overall business process framework of the data rate limiting method for network communication provided by the present invention; Figure 4 This is a schematic diagram of the sliding window provided by the present invention; Figure 5 This is a schematic diagram of the data flow limiting device for network communication provided by the present invention; Figure 6 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation

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

[0024] It should be noted that in the description of this invention, the terms "comprising," "including," or any other variations thereof are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus 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 apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element. The terms "upper," "lower," etc., indicating orientation or positional relationships based on the orientation or positional relationships shown in the accompanying drawings, are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the invention. Unless otherwise expressly specified and limited, the terms "installed," "connected," and "linked" should be interpreted broadly, for example, as a fixed connection, a detachable connection, or an integral connection; a mechanical connection or an electrical connection; a direct connection or an indirect connection through an intermediate medium; or a connection within two elements. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.

[0025] The terms "first," "second," etc., used in this invention are used to distinguish similar objects, not to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class, without limiting the number of objects; for example, a first object can be one or more. Furthermore, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0026] The following is combined with Figures 1-6 The present invention describes a data flow limiting method, apparatus, electronic device, and storage medium for network communication, which aims to intelligently adjust the traffic processing capacity of a business system to ensure the stability and high availability of the business system, while maximizing resource utilization.

[0027] Figure 1 This is a flowchart illustrating existing methods for data rate limiting in network communication, such as... Figure 1 As shown, the token bucket algorithm is commonly used in the internet field to control the access frequency of network requests. The server continuously generates tokens according to a set token generation rate. The token bucket has a set upper limit; if the token bucket is not full, a token is added; if the token bucket is full, newly generated tokens are discarded.

[0028] For each network request to access an interface, the corresponding number of tokens are consumed from the token bucket, allowing the network request to access the interface. That is, if the network request successfully acquires a token, the access to the interface is completed. However, if a network request fails to acquire a token, the network request will be discarded or placed in a queue to wait for a second attempt.

[0029] In practice, when using the token bucket to implement traffic limiting, the token bucket algorithm generates a fixed number of tokens into the token bucket at a fixed period, and the token generation algorithm is usually based on the request rate, which leads to the following drawbacks: First, the server cannot distinguish traffic priorities. The token bucket algorithm treats all network requests equally, without differentiating between request types or priorities. If high-priority and low-priority network requests arrive simultaneously, the token bucket algorithm cannot guarantee that the high-priority request will be given priority.

[0030] Secondly, the token bucket algorithm's rate limiting typically applies to overall traffic and cannot be finely controlled at different business levels. It imposes uniform restrictions on all network requests entering the business system, making it unable to cope with complex scenarios.

[0031] In summary, the token bucket algorithm has the drawback of being insufficient in dealing with complex and dynamically changing traffic patterns. For example, when there are network requests from different sources and with different business types in the traffic, the token bucket algorithm may not be able to effectively adapt to the characteristics of each network request.

[0032] In view of this, the present invention provides an adaptive current limiting method based on multi-dimensional hierarchical control. Figure 2 This is one of the flowcharts illustrating the data rate limiting method for network communication provided by the present invention, such as... Figure 2 As shown, including but not limited to the following steps: S1, Based on the multi-dimensional information of the network request, mark the priority level of the network request.

[0033] S2 determines whether the priority level of the network request meets the preset conditions.

[0034] S31, if the priority level of the network request meets the preset conditions, the network request is allowed to access the business system.

[0035] S32, based on the maximum number of queries per second in the same historical period of the business system within the current time window, determine the maximum number of concurrent requests allowed for the business system in the next time window.

[0036] S4, determine whether the actual number of concurrent users in the next time window is less than the maximum number of concurrent users.

[0037] S51, if it is determined that the actual number of concurrent requests in the next time window is less than the maximum number of concurrent requests, the network request is allowed to access the business system in the next time window.

[0038] S52, if it is determined that the actual number of concurrent requests in the next time window is not less than the maximum number of concurrent requests, then it is necessary to control the network request to continue waiting for the next time window to determine whether to limit the flow.

[0039] Among these, the aforementioned preset conditions can determine whether the priority level of a network request meets expectations, such as marking a network request as high priority.

[0040] This invention provides an adaptive rate limiting method based on multi-dimensional hierarchical control, aiming to solve the problem that existing rate limiting schemes cannot cope with complex and dynamically changing traffic patterns. By introducing multi-dimensional hierarchical control and an adaptive rate limiting algorithm, this invention can achieve fine-grained management of network requests, while ensuring system stability under high load and resource utilization under low load.

[0041] Figure 3 This is a schematic diagram of the overall business process framework of the network communication data rate limiting method provided by the present invention, as shown below. Figure 3As shown, when any network request enters the business system, the network request will access the rate limiting system to determine whether the network request should be rate-limited or allowed to access.

[0042] The rate limiting system can be designed according to actual needs. For example, it includes six modules, which determine the priority of the current network request based on information such as user dimension, business type, time dimension, request content, request history and region dimension. That is, when performing graded rate limiting and adaptive rate limiting, the above six modules will be used to perform relevant calculations.

[0043] Specifically, the priority of network requests is determined comprehensively based on multi-dimensional information. These dimensions include, but are not limited to, user, business type, time, and geographic dimensions. Each dimension has corresponding judgment criteria. As long as a request meets the preset judgment criteria in at least one dimension, the request will be marked as high priority. After receiving a network request, the rate limiting system will process the network request in a streaming manner and classify it into high-priority and low-priority network requests based on user, business type, time, and geographic dimensions.

[0044] When a network request is marked as high priority, the business system will directly allow the request to access the business system to ensure that critical business and high-priority requests can be processed quickly, avoiding delays or denial of service caused by rate limiting.

[0045] However, for requests marked as low priority, the business system will enter an adaptive rate limiting phase. Specifically, the system will dynamically calculate the maximum allowed concurrency in the next time window based on the highest queries per second (QPS) during the same historical period within the current time window. This calculation process takes into account the actual load of the system and historical data to ensure that the rate limiting strategy can adapt to dynamically changing traffic patterns.

[0046] In this way, once it is determined that the actual concurrency in the next time window is less than the calculated maximum concurrency, low-priority requests will be allowed to access the business system. This process, by dynamically adjusting the concurrency, ensures that the business system can effectively protect itself under high load, while making full use of resources under low load, thereby improving resource utilization.

[0047] Figure 4 This is a schematic diagram of the sliding window provided by the present invention, such as... Figure 4 As shown, the time is divided into multiple consecutive time windows, each with a specific rate limiting value. The following are the specific steps for dynamically adjusting the time window rate limiting value based on the adaptive rate limiting algorithm: Step 1: Initialize the time window and rate limit. For example, at 0:00, the system initializes the first time window and sets the rate limit to 100, meaning that the system can process a maximum of 100 requests within the first time window.

[0048] Step 2 involves real-time monitoring and computation. For example, during the first time window, the system monitors traffic and processes requests in real time. The system collects key performance indicators, including request arrival rate, average response time, and system load.

[0049] Step 3: Calculate the flow limit value for the next time window. For example, before the first time window ends (e.g., at 0:59), the system calculates the flow limit value for the next time window (1:00-2:00) based on the collected data and a preset adaptive algorithm. Assume the algorithm calculates that the flow limit value for the next time window should be 200 to accommodate the predicted traffic growth.

[0050] Step 4: Apply the new rate limit value. For example, at 1:00, the system automatically adjusts the rate limit value from 100 to 200 and begins applying the new rate limiting strategy. This allows the system to handle more requests within the second time window while avoiding overload.

[0051] Step 5: Continuous monitoring and adjustment. For example, during the second time window, the system continues to monitor traffic and performance metrics, and repeats steps 3 and 4 before the window ends to calculate and set new flow limit values ​​for the next time window.

[0052] The network communication rate limiting method provided by this invention prioritizes network requests based on multi-dimensional information, enabling more accurate identification of critical services and high-priority requests, thus avoiding rate limiting for important requests. By dynamically adjusting the rate limiting strategy based on a sliding time window and historical data, it can respond to dynamic changes in traffic in real time, ensuring stable system operation under high load while fully utilizing resources under low load. Through priority division and dynamic adjustment, this invention protects critical services while reducing restrictions on low-priority requests, improving the overall user experience of the system.

[0053] Based on the above embodiments, as an optional embodiment, marking the priority level of the network request based on the multi-dimensional information of the network request includes: when it is determined that at least one dimension of the multi-dimensional information meets the preset judgment condition, the priority level of the network request is marked as high priority. By integrating information from different dimensions, the priority of the request can be judged more accurately, thereby achieving differentiated processing.

[0054] Specifically, the multi-dimensional information mainly includes, but is not limited to, user-level information, business type information, time-level information, and geographic-level information. In practice, the business system checks the multi-dimensional information of each network request one by one to determine if it meets preset criteria. If at least one dimension of the multi-dimensional information meets the preset criteria, the network request is marked as high priority. This mechanism ensures that the system can flexibly identify important requests without requiring all dimensions to meet the criteria simultaneously. For example: Setting user-level information, including at least user identity category, activity level, or login device type, can be used to determine request priority. Requests from high-value users (such as VIP users) or active users may be marked as high priority. Setting the type or level of business operations can also be used to determine request priority. For example, requests involving payments or sensitive operations may be considered high priority.

[0055] By using this multi-dimensional priority labeling method, the present invention can flexibly configure the judgment conditions according to actual business needs, thereby realizing differentiated processing of different requests, which not only improves the flexibility of the system, but also better adapts to complex business scenarios.

[0056] The following section details how to prioritize network requests based on user-level information, business type information, time-level information, and geographic-level information.

[0057] As an optional embodiment, the user dimension information mainly includes, but is not limited to, user identity category information, user activity information, and user login device information; determining that the user dimension information meets preset judgment conditions includes: determining that the user level is higher than a preset identity level threshold based on the user identity category information, or determining that the user's activity exceeds a preset duration based on the user activity information, or determining that the login device used by the user is a mobile device based on the user login device information.

[0058] Specifically, the data structure of user dimension information is shown in Table 1 below: Table 1 Data Structure of User Dimension Information

[0059] Assuming that `highLevel` is the high-priority identity level threshold, `oneMonth` represents one month of user activity, and `mobile` refers to the mobile device, the logic for determining whether a network request is high-priority is as follows: userLevel>highLevel||userActivityDays>oneMonth||userDevice==mobile.

[0060] The specific analysis is as follows: (1) If the user level (userLevel) is determined to be higher than the set high priority threshold (highLevel) based on the user identity category information, the corresponding network request is considered high priority. By introducing user identity category information, different user levels (such as ordinary users, VIP users, internal employees, etc.) can be distinguished. When the user level is higher than the preset threshold, the request is marked as high priority. This mechanism ensures that completed requests from high-value users (such as VIP users or internal employees) can be processed first, thereby improving the experience and service quality of key users.

[0061] (2) If user activity information determines that a user's activity level (userActivityDays) exceeds one month (oneMonth), then the corresponding network request is also given high priority. The introduction of user activity information allows the system to identify long-term active users. Users whose activity level exceeds a preset duration are usually more familiar with the system and contribute more. Marking the requests of these users as high priority ensures that system resources are allocated to these high-frequency users first, further improving user stickiness and the overall user experience of the system.

[0062] (3) If the user's login device information indicates that they are using a mobile device (i.e., userDevice=mobile), then the corresponding network request is also considered high priority. In the mobile internet era, mobile devices are used far more frequently than desktop devices. By determining whether a user is using a mobile device to prioritize requests, the system can better adapt to mobile-first business scenarios. For example, in scenarios such as mobile payment and mobile office, mobile requests typically require faster response times. This mechanism ensures that mobile requests are processed first under the same conditions, improving the system's adaptability and flexibility.

[0063] This invention subdivides user information into identity categories, activity levels, and login devices, and sets preset thresholds for each condition. The system can flexibly configure rate-limiting strategies based on actual business needs. This configurability allows the system to adapt to different business scenarios and user groups, further enhancing the intelligence of rate-limiting strategies. It ensures that the system does not treat all users equally when limiting rates, but rather differentiates its approach based on the user's actual value and behavioral characteristics. This mechanism not only improves the fairness of the system but also significantly enhances the user experience, especially in high-concurrency scenarios.

[0064] As another optional embodiment, the service type information includes at least service operation level and service operation type information; determining whether the service type information meets the preset judgment conditions includes: determining that the service operation level is higher than the preset service level threshold, or determining that the operation corresponding to the network request is a sensitive operation based on the service operation type information.

[0065] Specifically, the data structure for business type information is shown in Table 2 below: Table 2 Data Structure of Business Type Information

[0066] Assuming that servicehighLevel is a preset service level threshold, the logic for determining whether a network request is of high priority based on whether the service type information meets the preset judgment conditions is as follows: serviceLevel>servicehighLevel&&!isSensitiveOperation.

[0067] The specific analysis is as follows: If the service level is higher than the pre-set high priority service level threshold (servicehighLevel), and the corresponding service operation information determines that it is not a sensitive operation (!isSensitiveOperation), then the corresponding network request is determined to be of high priority.

[0068] As another optional embodiment, the time dimension information includes at least the timestamp information of the network request; determining that the time dimension information meets the preset judgment conditions includes: determining that the current period is a non-peak business period based on the timestamp information.

[0069] Specifically, the data structure for the time dimension information is shown in Table 3 below: Table 3 Data Structure of Time Dimension Information

[0070] The logic for calculating high priority in the time dimension module is as follows: If the current time stamp information determines that it is not a peak business period (i.e., the system load is relatively low), then the corresponding network request is considered high priority.

[0071] As another optional embodiment, the geographic dimension information includes at least regional level information and hotspot classification information; determining that the geographic dimension information meets preset judgment conditions includes: determining that the regional level of the user's region is higher than a preset regional level threshold based on the regional level information, or determining that the user's region is a hotspot area based on the hotspot classification information.

[0072] Specifically, the data structure for the geographic dimension information is shown in Table 4 below: Table 4 Data Structure of Geographic Dimension Information

[0073] Assuming areaHighLevel is a preset threshold for the region level, the logic for determining a network request as high priority based on whether the geographic dimension information meets the preset judgment conditions is as follows: areaLevel>=areaHighLevel||isHotArea.

[0074] The specific analysis is as follows: (1) If the area level of the current area is greater than or equal to the preset area level threshold (areaHighLevel) for high priority, the corresponding network request is considered to be of high priority.

[0075] (2) If the current area is a hotspot (isHotArea), the network request is also considered to be of high priority.

[0076] The data rate limiting method for network communication provided by this invention, through this multi-dimensional priority labeling method, allows the system to flexibly configure judgment conditions according to actual business needs, thereby achieving differentiated processing of different requests. This method not only improves the system's flexibility but also better adapts to complex business scenarios.

[0077] In the data rate limiting method for network communication provided by the present invention, when the priority of the current network request is determined to be low, an adaptive rate limiting algorithm is triggered to determine the maximum number of concurrent requests allowed for the business system in the next time window based on the maximum number of queries per second in the same historical period within the current time window. Thus, if the actual number of concurrent requests in the next time window is determined to be less than the maximum number of concurrent requests, the network request is allowed to access the business system in the next time window.

[0078] As an optional embodiment, determining the maximum allowed concurrency of the business system in the next time window based on the historical maximum query volume per second of the business system in the current time window includes: If the sampling start time of the next time window is determined to be less than the time span of the current time window, then the maximum number of queries per second is adjusted using a preset attenuation coefficient, and then the maximum number of concurrent requests is obtained by unit synchronization. Otherwise, after adjusting the maximum number of queries per second using the maximum growth factor of the same historical period, the maximum concurrency is obtained by unit synchronization.

[0079] Before introducing the adaptive rate limiting algorithm, we can first briefly explain some basic situations, as follows: (1) When the service is in a stable state, the number of requests that the business system is processing within the same time window (concurrency) = the time difference between the request being sent and the response being received (Latency) * the number of requests that the business system can process per second (QPS). This is the theoretical basis of the adaptive rate limiting algorithm.

[0080] (2) When network requests do not cause the weapon to overload, the latency is basically stable, that is, QPS and concurrency are in a linear relationship.

[0081] (3) When the number of requests is too high in a short period of time, causing the server to be overloaded, the concurrency will increase along with the latency, while the QPS will tend to stabilize.

[0082] (4) The data structures of some parameters involved in the adaptive current limiting algorithm are shown in Table 5 below: Table 5 Data Structure of Adaptive Rate Limiting Algorithm

[0083] The following section details how to implement reasonable rate limiting based on an adaptive rate limiting algorithm when a network request is identified as having a low priority.

[0084] First, initialize growthFactor to maxgrowthFactor. The change of growthFactor depends on the latency of the business system and the system's QPS. That is, the purpose of calculating growthFactor is to dynamically adjust the system's growth factor, thereby optimizing the system's performance and resource utilization under different load conditions.

[0085] As an optional embodiment, determining the maximum allowed concurrency of the business system in the next time window based on the historical maximum query volume per second of the business system in the current time window includes: If the sampling start time of the next time window is determined to be less than the time span of the current time window, then the maximum number of queries per second is adjusted using a preset attenuation coefficient, and then the maximum number of concurrent requests is obtained by unit synchronization. Otherwise, after adjusting the maximum number of queries per second using the maximum growth factor of the same historical period, the maximum concurrency is obtained by unit synchronization.

[0086] In this embodiment of the invention, the maximum allowed concurrency of the business system in the next time window is determined based on the historical maximum queries per second (QPS) within the current time window. This process takes into account the continuity of the time window and the dynamic changes in traffic to ensure that the rate limiting strategy can adapt to different traffic patterns.

[0087] The system will use different strategies to adjust the maximum number of queries per second based on the relationship between the sampling start time of the next time window and the time span of the current time window, and finally determine the maximum concurrency.

[0088] When the next time window overlaps with the current time window, system traffic may remain relatively stable for a short period. In this case, the system uses a preset attenuation coefficient to adjust the maximum queries per second. The attenuation coefficient is a positive number less than 1, used to smooth short-term traffic fluctuations. The adjusted maximum queries per second is then multiplied by the time window length to obtain the maximum concurrency.

[0089] When the next time window does not overlap with the current time window, system traffic may fluctuate significantly. In this case, the system will adjust the maximum queries per second using the maximum growth factor from the same historical period. The maximum growth factor is calculated based on historical data and reflects the maximum growth trend of traffic over similar time periods. The adjusted maximum queries per second is then synchronized to obtain the maximum concurrency.

[0090] The dynamic adjustment mechanism based on time window relationships described above can more accurately predict the traffic in the next time window and determine the maximum concurrency accordingly. This method not only improves the adaptability of the rate limiting strategy but also better balances the utilization and protection of system resources.

[0091] As an optional embodiment, the maximum growth factor within any time window is determined based on the following method: Determine the growth factor after each network request is received within any given time window; The maximum value of all growth factors determined within any given time window is taken as the maximum growth factor within that given time window.

[0092] Within any given time window, whenever a network request is received, the system calculates a growth factor based on the current traffic volume and system load. The formula for calculating the growth factor can be simply expressed as: growthFactor= f (avgLatency,QPS,noLoadLatency,maxQPS); Where avgLatency is the current average response time; noLoadLatency is the response time under no load; and maxQPS is the maximum QPS for the same period in history. f It is a function that dynamically adjusts based on system load and performance metrics. For example, when the business system load is low (i.e., low avgLatency or high QPS), the growth factor increases; conversely, when the system load is high, the growth factor decreases.

[0093] Within a time window, the system records the growth factor calculated for each request. At the end of the time window, the system selects the maximum value from these growth factors as the maximum growth factor for that time window. This maximum growth factor is used to adjust the maximum concurrency for the next time window, thereby achieving dynamic control of the system load.

[0094] As an optional embodiment, the calculation function expression for the growth factor determined after each network request is received is: ; in, The largest growth factor for QPS; This is the minimum growth factor for QPS; QPS is the number of queries per second. This represents the highest number of queries per second in the same historical period. This represents the average response time difference. No load delay; k Adjust the preset growth factor range.

[0095] The calculation function expression for the above growth factor is explained as follows: (1) Case 1: If the average latency (avgLatency) is less than or equal to the no-load latency (noLoadLatency) multiplied by (1.0 + maxgrowthFactor), or the QPS is greater than or equal to the maximum QPS (maxQPS) multiplied by (1.0 + maxgrowthFactor), then the growthFactor will be increased by 0.01, but not exceeding the maxgrowthFactor.

[0096] The purpose of such an operation is: when the system latency is low or the QPS is close to the upper limit, moderately increase the growthFactor to allow the system to handle more requests and optimize resource utilization.

[0097] (2)Case 2: If the above conditions are not met (i.e., the average latency is high and the QPS is low), then take the larger value in (equivalent to reducing the growthFactor by 0.01, but not less than the mingrowthFactor).

[0098] The purpose of such an operation is: when the system latency is high or the QPS is low, moderately reduce the growthFactor to lower the system load and avoid overload.

[0099] (3)Illustrative example Suppose a web server has a no-load latency (noLoadLatency) of 100 milliseconds, a maximum QPS (maxQPS) of 1000, a maxgrowthFactor value of 0.4, and a mingrowthFactor of 0.01 under normal load.

[0100] For the above Case 1: If the average latency (avgLatency) is 120 milliseconds and the QPS is 800, which satisfies avgLatency > noLoadLatency * (1.0 + maxgrowthFactor), or QPS < maxQPS * (1.0 + mingrowthFactor), therefore, the growthFactor will be reduced by 0.01 to lower the system load.

[0101] For the above Case 2: If the average latency (avgLatency) is 80 milliseconds and the QPS is 1200, which satisfies avgLatency <= noLoadLatency * (1.0 + maxGrowthFactor), or QPS >= maxQPS * (1.0 + minGrowthFactor), therefore, the growthFactor will be increased by 0.01 to allow the system to handle more requests.

[0102] The mechanism for dynamically adjusting the growthFactor provided by the present invention can, according to the actual load conditions of the business system, optimize the processing capacity of the system in real time, ensure system stability under high load and high resource utilization under low load. This adaptive strategy is very effective for handling complex and dynamically changing traffic patterns.

[0103] After calculating the maximum growth factor of historical sampling windows within the same period corresponding to the current sampling window (e.g., the same sampling period a year ago), sampling begins. After sampling concludes, the QPS of the current sampling window is calculated, and the specific calculation formula can be expressed as: ; Where totalReqCount is the sum of all requests within the sampling window; samplingTimeMs is the timestamp of the current sampling in milliseconds; startSampleTimeMs is the timestamp of the start of sampling in milliseconds.

[0104] maxQPS is calculated by comparing the QPS of the same period and time (e.g., the same period a year ago) and taking the maximum value. It is calculated based on historical experience data, which has been explained in detail in the above embodiments and will not be repeated here.

[0105] The maximum concurrency value for the next time window is calculated using the current window method. This maximum concurrency value is used to dynamically determine the maximum number of concurrent requests allowed in the next time window within a high-concurrency system, thereby achieving load control and optimized resource allocation. The specific formula can be expressed as follows: ; in, Maximum concurrency; The timestamp for the next sampling start; This is the timestamp of the current sample.

[0106] In summary, the network communication data rate limiting method provided by this invention is based on an adaptive rate limiting algorithm with multi-dimensional hierarchical control. It divides network requests into high-priority and low-priority requests using multi-dimensional information, allowing high-priority requests to directly access resources. The adaptive rate limiting algorithm is used to limit the rate of low-priority requests, thus avoiding rate limiting of critical services and ensuring effective system protection under high load while improving resource utilization under low load.

[0107] Specifically, this invention proposes a data rate limiting method for network communication based on an adaptive rate limiting algorithm with multi-dimensional hierarchical control. Compared with existing rate limiting technologies, its main improvements are reflected in the following aspects: 1) Introduction of Multi-Dimensional Hierarchical Control Strategy: Traditional rate limiting schemes typically control traffic based on a single dimension, such as user ID or IP address, making it difficult to provide flexible and precise control for different scenarios. This invention introduces a multi-dimensional control mechanism (including user identity, business type, time period, region, etc.) to more finely classify request types and achieve differentiated rate limiting for requests of different priorities. This multi-dimensional hierarchical control method greatly improves the system's ability to cope with complex business scenarios, ensuring that high-priority requests can pass smoothly at critical moments, while low-priority requests are dynamically adjusted according to the actual load of system resources, thereby achieving reasonable resource allocation.

[0108] 2) Advantages of the Adaptive Rate Limiting Algorithm: Compared to traditional rate limiting techniques that use fixed thresholds or simple rules, this invention uses an adaptive rate limiting algorithm to monitor system resource usage in real time and dynamically adjust the processing frequency of requests. Existing technologies often struggle to react quickly to changes in resource load, but this invention solves this problem through its adaptive algorithm. This adaptive algorithm can intelligently determine the system's load status, proactively slowing down the processing speed of low-priority requests under high load to ensure system stability; and automatically resuming processing of these requests when the load decreases to ensure maximum resource utilization.

[0109] 3) Balancing Resource Protection and User Experience: Traditional rate limiting mechanisms tend to over-restrict all requests under high load, leading to decreased system response speed and even impacting the normal operation of critical services. This invention, through priority allocation and adaptive adjustment, better balances resource protection and user experience. High-priority service requests are not affected by low-priority requests, ensuring that important services can still be processed normally under high load. Low-priority requests, on the other hand, have their rate limiting adjusted flexibly according to system load, allowing the system to operate efficiently while minimizing negative impacts on user experience.

[0110] 4) Adaptability to dynamic environments: Existing technologies often struggle to adapt to complex dynamic environments, especially under resource constraints, where system responses are frequently delayed. However, the rate limiting system of this invention, through multi-dimensional analysis and the introduction of adaptive algorithms, possesses rapid response and adjustment capabilities, enabling real-time identification and handling of resource bottlenecks. Even under conditions of surging traffic, the system can quickly adjust its rate limiting strategy to ensure stable system operation and prevent resource overload.

[0111] As an exception, it should be noted that although the main improvement of this invention focuses on achieving adaptive flow limiting through multi-dimensional hierarchical control and dynamically allocating system resources with different priorities, other methods besides those provided in the above embodiments can also be used for priority determination and resource access control. For example, a dynamic priority adjustment mechanism can be introduced so that the priority is no longer fixed, but is adjusted according to real-time traffic characteristics and historical data.

[0112] In addition, by combining business context, the system can automatically increase the priority of critical task traffic patterns in real time, so that while ensuring critical business operations, the system can flexibly allocate remaining resources to low-priority requests to maximize resource utilization.

[0113] At the algorithm implementation level, a combination of adaptive rate limiting algorithms and machine learning prediction models can be considered. For example, a sliding window algorithm based on traffic statistics can be used to dynamically detect the load, and a prediction model can be used to predict traffic peaks, so that the system can trigger rate limiting strategies in advance when the load is too high, thereby avoiding system resource exhaustion.

[0114] Distributed token bucket or leaky bucket algorithms can also be introduced to smoothly limit the rate of low-priority requests, automatically reducing their access frequency under high load. By adaptively adjusting the rate limiting strategy based on multi-dimensional request information, the system can remain stable under high load and fully release resources to improve processing efficiency under low load. This design, through the combination of automatic priority adjustment and predictive rate limiting, provides a more flexible solution for traffic control in complex scenarios.

[0115] Figure 5 This is a schematic diagram of the network communication data flow limiting device provided by the present invention, as shown in Figure 5, which mainly includes a level calibration unit 51 and a communication control unit 52. The level labeling unit 51 is mainly used to label the priority level of the network request based on the multi-dimensional information of the network request; The communication control unit 52 is mainly used to perform the following operations: If the priority level of the network request meets the preset conditions, the network request is allowed to access the business system; Otherwise, based on the maximum number of queries per second in the same historical period within the current time window, determine the maximum number of concurrent requests allowed for the business system in the next time window; If the actual number of concurrent requests within the next time window is determined to be less than the maximum number of concurrent requests, the network request is allowed to access the business system within the next time window.

[0116] It should be noted that the network communication data limiting device provided by the present invention can execute the network communication data limiting method provided in any of the above embodiments during specific operation, and will not be described in detail here.

[0117] The network communication data rate limiting device provided by this invention classifies network requests into high-priority and low-priority requests using multi-dimensional information. High-priority requests directly access resources, while low-priority requests are rate-limited using an adaptive rate limiting algorithm. This avoids rate limiting for critical services, ensures effective system protection under high load, and improves resource utilization under low load.

[0118] Figure 6 This is a schematic diagram of the structure of the electronic device provided by the present invention, such as... Figure 6 As shown, the electronic device may include a processor 610, a communications interface 620, a memory 630, and a communication bus 640, wherein the processor 610, communications interface 620, and memory 630 communicate with each other via the communication bus 640. The processor 610 can invoke logical instructions in the memory 630 to execute a data rate limiting method for network communication. This method includes: marking the priority level of the network request based on multi-dimensional information of the network request; allowing the network request to access the business system if the priority level of the network request meets preset conditions; otherwise, determining the maximum allowed concurrency of the business system in the next time window based on the maximum query volume per second of the business system in the historical same period within the current time window; and allowing the network request to access the business system in the next time window if the actual concurrency in the next time window is determined to be less than the maximum concurrency.

[0119] Furthermore, the logical instructions in the aforementioned memory 630 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0120] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, wherein when the program instructions are executed by a computer, the computer is able to execute the data flow limiting method for network communication provided in the above embodiments, the method comprising: marking the priority level of the network request based on multi-dimensional information of the network request; allowing the network request to access the business system if the priority level of the network request meets preset conditions; otherwise, determining the maximum allowed concurrency of the business system in the next time window based on the maximum query volume per second of the business system in the historical same period within the current time window; and allowing the network request to access the business system in the next time window if it is determined that the actual concurrency in the next time window is less than the maximum concurrency.

[0121] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements the data rate limiting method for network communication provided in the above embodiments. The method includes: marking the priority level of the network request based on multi-dimensional information of the network request; allowing the network request to access the business system if the priority level of the network request meets preset conditions; otherwise, determining the maximum allowed concurrency of the business system in the next time window based on the maximum query volume per second of the business system in the historical same period within the current time window; and allowing the network request to access the business system in the next time window if it is determined that the actual concurrency in the next time window is less than the maximum concurrency.

[0122] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0123] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0124] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A data flow control method for network communication, characterized by, The method comprises the following steps: annotating a priority level of a network request based on multi-dimensional information of the network request; allowing the network request to access a business system if the priority level of the network request meets a preset condition; otherwise, determining a maximum concurrency allowed for the business system in a next time window according to a maximum query per second of the business system in a historical same period within a current time window; allowing the network request to access the business system in the next time window if an actual concurrency in the next time window is determined to be less than the maximum concurrency.

2. The method of claim 1, wherein, The method of annotating the priority level of the network request based on the multi-dimensional information of the network request comprises the following steps: annotating the priority level of the network request as a high priority if at least one piece of dimension information in the multi-dimensional information meets a preset determination condition. The multi-dimensional information at least comprises user dimension information, business type information, time dimension information and regional dimension information.

3. The method of claim 2, wherein, The user dimension information at least comprises user identity category information, user activity information and user login device information. The method of determining that the user dimension information meets the preset determination condition comprises the following steps: determining that a user level is higher than a preset identity level threshold according to the user identity category information, or determining that a user activity exceeds a preset time length according to the user activity information, or determining that a login device used by the user is a mobile terminal device according to the user login device information.

4. The method of claim 2, wherein, The business type information at least comprises business operation level and business operation type information. The method of determining that the business type information meets the preset determination condition comprises the following steps: determining that the business operation level is higher than a preset business level threshold, or determining that an operation corresponding to the network request is a sensitive operation according to the business operation type information.

5. The method of claim 2, wherein, The time dimension information at least comprises timestamp information of the network request. The method of determining that the time dimension information meets the preset determination condition comprises the following steps: determining that a current time is a non-business peak period according to the timestamp information.

6. The method of claim 2, wherein, The regional dimension information at least comprises regional level information and hot spot division information. The method of determining that the regional dimension information meets the preset determination condition comprises the following steps: determining that a regional level of a region where the user is located is higher than a preset regional level threshold according to the regional level information, or determining that the region where the user is located is a hot spot region according to the hot spot division information.

7. The method of claim 1, wherein, The method of determining the maximum concurrency allowed for the business system in the next time window according to the maximum query per second of the business system in the historical same period within the current time window comprises the following steps: if a sampling start time point of the next time window is determined to be less than a time span of the current time window, then adjusting the maximum query per second by using a preset attenuation coefficient, and performing unit synchronization to obtain the maximum concurrency; otherwise, adjusting the maximum query per second by using a maximum growth factor of the historical same period, and performing unit synchronization to obtain the maximum concurrency.

8. The method of claim 7, wherein, The maximum growth factor in any time window is determined based on the following method: determining a growth factor determined after receiving each network request in the any time window; Determine the maximum value of all the growth factors determined in the any time window as the maximum growth factor in the any time window.

9. The method of claim 8, wherein, The calculation function expression of the growth factor determined after receiving the network request each time is: ; wherein, is a maximum growth factor for QPS; is a minimum growth factor for QPS; is a query per second; is a maximum query per second for a historical same period; is an average response time difference; is a no-load delay; k is a preset growth factor adjustment range.

10. The method of claim 9, wherein, The calculation function expression of the maximum concurrent number allowed by the business system in the next time window is determined according to the maximum query per second of the business system in the historical same period in the current time window. ; wherein, is the maximum number of concurrent; is the timestamp of the next start of sampling; is the timestamp of the current sampling.

11. A data flow control apparatus for network communication, characterized by comprising: The level calibration unit and the communication control unit are included. The level calibration unit is configured to label the priority level of the network request based on the multi-dimensional information of the network request. The communication control unit is configured to perform the following operations: If the priority level of the network request meets a preset condition, the network request is allowed to access the business system. Otherwise, the maximum concurrent number allowed by the business system in the next time window is determined according to the maximum query per second of the business system in the historical same period in the current time window. If the actual concurrent number in the next time window is less than the maximum concurrent number, the network request is allowed to access the business system in the next time window.

12. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the data flow limiting method of network communication according to any one of claims 1-10.

13. A non-transitory computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the data flow limiting method of network communication according to any one of claims 1-10.

14. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the data flow limiting method of network communication according to any one of claims 1-10.