Flow control method and device
By acquiring traffic characteristics and gateway health status in the vehicle-to-everything (V2X) system and dynamically adjusting traffic control strategies based on service types, the problem of fixed thresholds being unable to adapt to complex network environments has been solved. This has enabled stable communication and high response speed, provided refined traffic control, and improved system adaptability and user experience.
Patent Information
- Application Number
- CN202511436749.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-09
- Publication Date
- 2025-11-18
AI Technical Summary
In existing vehicle-to-everything (V2X) systems, fixed-threshold traffic control methods cannot flexibly adapt to complex and ever-changing network environments, leading to wasted or strained communication resources and affecting the stability and response speed of communication services.
By acquiring traffic characteristics, gateway health status, and service type, the traffic control strategy is dynamically determined. The sliding window algorithm or token bucket algorithm is used for rate limiting, and fine-tuning is performed based on the gateway health status and service type to achieve fine-grained traffic control.
It improves the adaptability and stability of the vehicle-to-everything (V2X) system, enabling it to maintain high response speed in various environments, promptly detect traffic issues and gateway failure risks, provide customized traffic control solutions, and enhance user experience.
Smart Images

Figure CN120980030A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data processing, in particular to a traffic control method and device. BACKGROUND
[0002] With the rapid development of Internet of Vehicles technology, the communication demand between vehicles and cloud servers is growing. In the Internet of Vehicles system, an effective traffic control mechanism is crucial to prevent the Internet of Vehicles system from being overloaded and to ensure the stability and response speed of communication services.
[0003] In the prior art, the traffic control method of setting a fixed threshold to limit communication traffic is often used in the Internet of Vehicles system. In a complex and changeable network environment, this method cannot be flexibly adapted according to business needs, which may easily lead to waste or shortage of communication resources, and thus affect the stability and response speed of communication services. SUMMARY
[0004] Based on the above problems, the present application provides a traffic control method and device, which can flexibly control traffic according to different business needs to improve the adaptability of the Internet of Vehicles system and maintain stable communication and high response speed in various environments.
[0005] The present application discloses a traffic control method, which comprises:
[0006] In the case of receiving a target request, the traffic characteristics and the gateway health status at the current time are obtained, as well as the business type corresponding to the target request;
[0007] Based on the traffic characteristics, the gateway health status and the business type, a traffic control strategy corresponding to the target request is determined; the traffic control strategy includes using a sliding window algorithm or a token bucket algorithm to limit the flow of requests, and rejecting requests;
[0008] The traffic control strategy is executed for the target request.
[0009] Optionally, the determination of the traffic control strategy corresponding to the target request based on the traffic characteristics, the gateway health status and the business type comprises:
[0010] Based on the traffic characteristics, the number of queries per second and the size of the traffic received within a preset time period are obtained;
[0011] In the case that the number of queries per second is greater than a preset number, or the size of the traffic exceeds a preset traffic threshold, the traffic control strategy is determined to be a sliding window algorithm;
[0012] In a case where the query per second is less than or equal to the preset number and the traffic size does not exceed the preset traffic threshold, determining the traffic control strategy based on the gateway health status and the service type.
[0013] Optionally, before determining that the traffic control strategy is a sliding window algorithm, the method further comprises:
[0014] In a case where the query per second is greater than a global preset number or the traffic size exceeds a global preset traffic threshold, rejecting the target request; the global preset number is greater than the preset number, and the global preset traffic threshold is greater than the preset traffic threshold.
[0015] Optionally, determining the traffic control strategy based on the gateway health status and the service type comprises:
[0016] Obtaining a central processing unit (CPU) usage rate, a memory usage rate, and an average delay time at the current time;
[0017] Determining a health score for representing the gateway health status based on the CPU usage rate, the memory usage rate, and the average delay time;
[0018] In a case where the health score is greater than a preset score, determining the traffic control strategy based on the service type;
[0019] In a case where the health score is less than or equal to the preset score, determining the traffic control strategy according to the health score.
[0020] Optionally, determining the traffic control strategy according to the health score comprises:
[0021] Adjusting the preset number and / or the preset traffic threshold according to the health score to obtain an adjusted preset number and / or preset traffic threshold;
[0022] Determining the traffic control strategy according to the query per second and the traffic size, and the adjusted preset number and / or preset traffic threshold.
[0023] Optionally, determining the traffic control strategy according to the health score comprises:
[0024] Determining a rejection rate of requests according to the health score;
[0025] Rejecting requests according to the rejection rate.
[0026] Optionally, determining the health score for representing the gateway health status based on the CPU usage rate, the memory usage rate, and the average delay time comprises:
[0027] determining that the health score is a value less than or equal to the preset score when the CPU usage is greater than a preset CPU usage, the memory usage is greater than a preset memory usage, or the average delay time is greater than a preset delay time;
[0028] determining that the health score is a value greater than the preset score when the CPU usage is less than or equal to a preset CPU usage, the memory usage is less than or equal to a preset memory usage, and the average delay time is less than or equal to a preset delay time.
[0029] Optionally, the determining the traffic control policy based on the service type comprises:
[0030] obtaining an initial traffic control policy corresponding to the service type;
[0031] fine-tuning the initial traffic control policy by using the health score to obtain the traffic control policy.
[0032] Optionally, before receiving the target request, the method further comprises:
[0033] configuring the traffic control policy;
[0034] configuring a correspondence between the traffic control policy and the traffic feature, the gateway health state, and the service type;
[0035] storing the traffic control policy and the correspondence in a remote configuration;
[0036] loading and updating the traffic control policy and the correspondence in real time locally by monitoring the remote configuration.
[0037] Based on the above traffic control method, the application further discloses a traffic control device, which comprises an obtaining unit, a determining unit, and an executing unit.
[0038] The obtaining unit is configured to, in the case of receiving a target request, obtain a traffic feature and a gateway health state at a current time, and a service type corresponding to the target request.
[0039] The determining unit is configured to determine a traffic control policy corresponding to the target request based on the traffic feature, the gateway health state, and the service type; the traffic control policy comprises throttling requests by using a sliding window algorithm or a token bucket algorithm, and rejecting requests.
[0040] The executing unit is configured to execute the traffic control policy for the target request.
[0041] Optionally, the determining unit comprises:
[0042] a size obtaining subunit configured to obtain a query per second and a size of traffic received in a preset time period based on the traffic feature;
[0043] an algorithm determining subunit configured to determine that the traffic control strategy is a sliding window algorithm in a case where the query per second is greater than a preset number or the size of traffic exceeds a preset traffic threshold;
[0044] a first strategy determining subunit configured to determine the traffic control strategy based on the gateway health status and the service type in a case where the query per second is less than or equal to the preset number and the size of traffic does not exceed the preset traffic threshold.
[0045] Optionally, the apparatus further comprises:
[0046] a first rejecting subunit configured to reject the target request in a case where the query per second is greater than a global preset number or the size of traffic exceeds a global preset traffic threshold; the global preset number is greater than the preset number, and the global preset traffic threshold is greater than the preset traffic threshold.
[0047] Optionally, the first strategy determining subunit comprises:
[0048] a usage rate obtaining subunit configured to obtain a central processing unit (CPU) usage rate, a memory usage rate and an average delay time at the current moment;
[0049] a score determining subunit configured to determine a health score for representing the gateway health status based on the CPU usage rate, the memory usage rate and the average delay time;
[0050] a second strategy determining subunit configured to determine the traffic control strategy based on the service type in a case where the health score is greater than a preset score;
[0051] a third strategy determining subunit configured to determine the traffic control strategy according to the health score in a case where the health score is less than or equal to the preset score.
[0052] Optionally, the third strategy determining subunit comprises:
[0053] an adjusting subunit configured to adjust the preset number and / or the preset traffic threshold according to the health score to obtain an adjusted preset number and / or preset traffic threshold;
[0054] A re-determination sub-unit is configured to determine the traffic control strategy according to the QPS, the traffic size, the adjusted preset quantity and / or preset traffic threshold.
[0055] Optionally, the third strategy determination sub-unit comprises:
[0056] A rejection rate determination sub-unit is configured to determine a rejection rate of requests according to the health score.
[0057] A second rejection sub-unit is configured to reject requests according to the rejection rate.
[0058] Optionally, the score determination sub-unit comprises:
[0059] A low-score determination sub-unit is configured to determine that the health score is a value less than or equal to the preset score when the CPU usage rate is greater than a preset CPU usage rate, the memory usage rate is greater than a preset memory usage rate, or the average delay time is greater than a preset delay time.
[0060] A high-score determination sub-unit is configured to determine that the health score is a value greater than the preset score when the CPU usage rate is less than or equal to a preset CPU usage rate, the memory usage rate is less than or equal to a preset memory usage rate, and the average delay time is less than or equal to a preset delay time.
[0061] Optionally, the second strategy determination sub-unit comprises:
[0062] An initial acquisition sub-unit is configured to acquire an initial traffic control strategy corresponding to the service type.
[0063] A fine-tuning sub-unit is configured to fine-tune the initial traffic control strategy using the health score to obtain the traffic control strategy.
[0064] Optionally, the apparatus further comprises:
[0065] A strategy configuration unit is configured to configure the traffic control strategy.
[0066] A corresponding relationship configuration unit is configured to configure a corresponding relationship between the traffic control strategy and the traffic characteristics, the gateway health status, and the service type.
[0067] A storage unit is configured to store the traffic control strategy and the corresponding relationship in a remote configuration.
[0068] An update unit is configured to load and update the traffic control strategy and the corresponding relationship locally in real time by monitoring the remote configuration.
[0069] The application discloses a method and device for flow control. In the case of receiving a target request, the flow characteristics and gateway health status at the current time are obtained, and the business type corresponding to the target request is obtained. Based on the flow characteristics, gateway health status and business type, the flow control strategy corresponding to the target request is determined. The adaptability of the vehicle networking system is improved, and the flow control strategy can be flexibly selected according to different needs, and stable communication and high response speed can be maintained in various environments. The flow characteristics and gateway health status are comprehensively considered, and potential flow problems and gateway failure risks in the system can be found in time. In combination with the business type, the pertinence and effectiveness of flow control can be improved. For example, the vehicle remote control business and the APP user query business differ in flow mode, real-time requirement and the like. In combination with these factors, a suitable flow limiting algorithm can be selected, and a customized flow control scheme is provided for each target request.
[0070] Through a reasonable flow control strategy, the request demand of a user can be met as much as possible under the premise of ensuring stable operation of the system. For normal user requests, the request is prevented from being rejected or delayed due to excessive flow limiting, and the operation experience of the user is improved. For malicious requests or abnormal flow, the limitation is performed in time, and the experience of normal users is prevented from being affected by these requests. BRIEF DESCRIPTION OF DRAWINGS
[0071] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or prior art description will be briefly introduced. Obviously, the drawings in the following description only belong to the embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of the provided drawings.
[0072] Figure 1a A flowchart of a flow control method disclosed by an embodiment of the present application is shown in the figure.
[0073] Figure 1b A schematic diagram of a flow control architecture disclosed by an embodiment of the present application is shown in the figure.
[0074] Figure 2 A flowchart of another flow control method disclosed by an embodiment of the present application is shown in the figure.
[0075] Figure 3 A structural schematic diagram of a flow control device disclosed by an embodiment of the present application is shown in the figure. DETAILED DESCRIPTION
[0076] With reference to the drawings of the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, all the other embodiments obtained by a person of ordinary skill in the art without creative work are within the scope of protection of the present application.
[0077] Embodiment one: the present application discloses a flow control method.
[0078] Specifically, please refer to Figure 1a The flow control method disclosed in the embodiment comprises the following steps:
[0079] Step 101: in the case of receiving a target request, obtaining the flow characteristics and gateway health status at the current time, and the business type corresponding to the target request.
[0080] In a distributed system or a high-concurrency network service scenario, the flow limiting mechanism is a key means to guarantee the stability and availability of the system. The core of flow limiting is that when the service end receives a request from the client, the calling frequency, the total number of concurrency and other flow parameters of the request can be dynamically regulated according to the preset rules, or even some requests can be directly rejected, so as to prevent the system from collapsing due to overload.
[0081] In the method of the embodiment, the flow limiting not only considers the instant flow characteristics of the request, but also combines the health status of the gateway and the business type to which the request belongs, so as to realize more fine-grained flow management. First, one or more sets of flow control strategies and the corresponding relationship between the flow control strategies and the flow characteristics, the gateway health status and the business type can be pre-configured. Among them, the flow control strategy can include the flow limiting times threshold (such as 2 times), the statistical window time length (such as 60s), the parameter flow limiting configuration (including the parameter name, the parameter value, such as the related parameters of the sliding window algorithm and the related parameters of the token bucket algorithm), the flow limiting path (or name), the request rejection and the flow limiting algorithm, that is, using the sliding window algorithm or the token bucket algorithm to limit the flow of the request. Among them, the sliding window algorithm can divide the time into fixed-length windows, count the number of requests in each window, and trigger flow limiting when the request book exceeds the preset threshold. The token bucket algorithm can maintain a token bucket with a preset number of tokens, and when a request arrives, it needs to obtain tokens from the bucket, and if there is no token in the bucket, the request is rejected. When the service end load is extremely high or under certain conditions, all or part of the requests can be directly rejected to quickly reduce the pressure of the service end.
[0082] As an implementable scheme, such as Figure 1bAs shown, the rate limiting path can be configured in the property configuration file of the service side (such as a microservice), and it is specified which paths or interfaces need to be rate limited. These configurations can be for a single path or a set of paths. Then, the configured traffic control policy and corresponding relationship are stored in a remote configuration center (such as Zookeeper, Consul). The service side loads and updates the traffic control policy and corresponding relationship in real time by listening to the changes of the remote configuration center. This mechanism allows dynamic adjustment of the rate limiting rules without restarting the service, improving the flexibility and response speed of traffic control.
[0083] As another implementable solution, a remote dictionary server (Redis) is used as the backend of the configuration storage, and a specific key value is named for each traffic control policy and its corresponding relationship. The traffic control policy and corresponding relationship are stored in Redis to realize persistent configuration and storage. Then, a message listener of Redis is used to listen to configuration change events. When the traffic control policy and corresponding relationship are modified in Redis, the listener captures these changes and triggers the update of the local cache. This mechanism allows the service side to directly read the traffic control policy and corresponding relationship from the local cache when processing requests, without accessing the remote configuration center or Redis every time, significantly improving business processing efficiency and reducing network delay and server pressure.
[0084] Step 102: determining the traffic control policy corresponding to the target request based on the traffic characteristics, the gateway health status, and the service type.
[0085] In the method of the embodiment, a multi-dimensional and multi-level evaluation system is constructed, so that the traffic control policy dynamically adapts to real-time traffic characteristics, gateway health status, and service type, realizing fine and flexible traffic control.
[0086] As an implementable solution, traffic characteristics are the most superficial evaluation index of traffic control policy, which is used to deal with obviously abnormal traffic. Traffic characteristics include the number of queries per second and the traffic size in a preset time period (i.e. instantaneous burst traffic, such as the total number of requests in 10ms). By collecting these two indexes in real time and comparing them with the preset values, the corresponding traffic control policy under the current situation can be determined. Specifically, in the case where the number of queries per second is greater than the preset number or the traffic size exceeds the preset traffic threshold, the traffic control policy is determined to be the sliding window algorithm. Correspondingly, in the case where the number of queries per second is less than or equal to the preset number and the traffic size does not exceed the preset traffic threshold, the next level is entered, and the traffic control policy is determined based on the gateway health status and the service type.
[0087] As an implementable scheme, a global preset number of queries per second (global preset number) and a global preset traffic threshold can be preset at a global level, where the global preset number is greater than the preset number, and the global preset traffic threshold is greater than the preset traffic threshold. In the case that the number of queries per second is greater than the global preset number, or the traffic size exceeds the global preset traffic threshold, it indicates that the pressure on the server is too large, and the target request can be directly rejected without consuming subsequent computing resources.
[0088] In the method of the embodiment, the gateway health status is a second layer evaluation index, which includes three parts of CPU usage, memory usage, and average delay time. As an implementable scheme, after the CPU usage, memory usage, and average delay time at the current time are obtained, a health score for representing the gateway health status is determined based on the three. The health score can be set as a score value of 0-100, or a percentage value of -100%-100%, and the value range, positive or negative of the health score is not specifically limited herein, as long as the gateway health status can be accurately represented.
[0089] As an implementable scheme, the determination of the health score can be that when the CPU usage is greater than a preset CPU usage, the memory usage is greater than a preset memory usage, or the average delay time is greater than a preset delay time, the health score is determined to be a value less than or equal to a preset score. For example, the preset CPU usage is 80%, the preset memory usage is 80%, the preset delay time is 100 ms, and the preset score is 90. When the CPU usage is 90%, the health score is 60. When the CPU usage is 100%, the health score is 40. When the CPU usage is 90% and the average delay time is 120 ms, the health score is 50.
[0090] Correspondingly, when the CPU usage is less than or equal to the preset CPU usage, the memory usage is less than or equal to the preset memory usage, and the average delay time is less than or equal to the preset delay time, the health score is determined to be a value greater than the preset score. For example, the preset CPU usage, the preset memory usage, the preset delay time, and the preset score are the same as the values in the above example. When the average delay time is 5 ms, the CPU usage is 50%, and the memory usage is 40%, the health score is 100. When the average delay time is 80 ms, the CPU usage is 70%, and the memory usage is 70%, the health score is 92.
[0091] In the method of the embodiment, when the health score is less than or equal to the preset score, it indicates that the server is overloaded, and the flow control strategy is determined again according to the health score. As one of the implementable solutions, the preset quantity and / or the preset flow threshold can be adjusted according to the health score to obtain an adjusted preset quantity and / or an adjusted preset flow threshold. After adjusting the threshold, the current query per second and the flow size are compared with the adjusted preset quantity and / or the adjusted preset flow threshold again, and the flow control strategy is determined again according to the above steps. As another implementable solution, the rejection rate of the request can be determined according to the health score, and the request is rejected according to the rejection rate. Through the above two solutions, the adjustment of the flow limiting rule when the health score is unqualified is realized, that is, the feedback mechanism of "the more unhealthy the gateway is, the more stringent the flow limiting is" is realized.
[0092] For example, when the health score is 60 points, the preset quantity is adjusted to 70% of the original preset quantity, and the preset flow threshold is adjusted to 60% of the original preset flow threshold. The adjustment process can be realized based on the formula "adjusted threshold = original threshold x health score weight". The health score weight can be set according to the preset requirements. For example, when the requirement for the health status of the gateway is high, a larger weight is given to the health score. For example, when the health score is 60 points, the rejection rate is 20%, and 20% of the requests are randomly discarded according to the rejection rate.
[0093] In the method of the embodiment, when the health score is greater than the preset score, the next level is entered, and the flow control strategy is determined based on the service type. As one of the implementable solutions, the initial flow control strategy corresponding to the service type is obtained first, and then the initial flow control strategy is fine-tuned by using the health score to obtain the flow control strategy. The service type can specifically include vehicle status query (high-frequency query type), vehicle historical trajectory (bandwidth consumption type), vehicle remote control (key instruction type), etc. The token bucket algorithm is suitable for high-frequency query type services. This algorithm allows a certain degree of burst, which can handle high-concurrency requests while stabilizing the average rate. The sliding window is suitable for bandwidth consumption type services. This algorithm can balance bandwidth and concurrency when facing a large amount of data pulling.
[0094] For example, the service type of the target request is log uploading, and the initial flow control strategy corresponding to the service type is to use the sliding window algorithm. After obtaining the initial flow control strategy corresponding to the service type from the configuration, the parameters in the sliding window algorithm are adjusted by using the health score. Finally, the flow control strategy that adapts to the current gateway state and the service type is generated.
[0095] Step 103: executing the flow control strategy for the target request.
[0096] In the method of the embodiment, the target request is throttled according to a determined flow control strategy. The sliding window algorithm specifically sets a movable window (subarray or sub-string), and moves the window step by step to cover all request data, while ensuring that the number of requests in the entire window does not exceed the set threshold. The token algorithm is to let the request obtain a token from the bucket, and if the token is successfully obtained, the request is released to the backend service, and if the token is not successfully obtained, the request is rejected.
[0097] The method described in the embodiment can determine the flow control strategy corresponding to the target request based on the flow characteristics, the gateway health status and the service type. The adaptability of the vehicle networking system is improved, and the flow control strategy can be flexibly selected according to different needs, and stable communication and high response speed can be maintained in various environments. Considering the flow characteristics and the gateway health status, potential flow problems and gateway failure risks in the system can be found in time. In combination with the service type, the pertinence and effectiveness of flow control can be improved. A suitable throttling algorithm is selected to provide a customized flow control scheme for each target request. At the same time, through a reasonable flow control strategy, user demands can be met as much as possible on the premise of ensuring stable operation of the system.
[0098] Embodiment two: another flow control method is disclosed in the present application, please refer to Figure 2 The method described in the embodiment introduces the whole process of flow control.
[0099] Step 201: in response to the received target request, the flow characteristics at the current time are obtained.
[0100] Step 202: it is judged whether the number of queries per second is greater than the preset number, or the flow size exceeds the preset flow threshold. If yes, go to step 203. If no, go to step 204.
[0101] Step 203: it is judged whether the number of queries per second is greater than the global preset number, or the flow size exceeds the global preset flow threshold. If yes, go to step 205. If no, go to step 206.
[0102] Step 204: the gateway health status at the current time is obtained, and the health score is determined based on the gateway health status.
[0103] Step 205: reject the target request.
[0104] Step 206: determine the flow control strategy as the sliding window algorithm.
[0105] Step 207: it is judged whether the health score is greater than the preset score. If yes, go to step 208. If no, go to step 209.
[0106] Step 208: the service type corresponding to the target request is obtained.
[0107] Step 209: adjusting the preset quantity and the preset flow threshold according to the health score. Return to step 202.
[0108] Step 210: obtaining an initial flow control strategy corresponding to the service type.
[0109] Step 211: fine-tuning the initial flow control strategy by using the health score to obtain the flow control strategy.
[0110] Based on the flow control method disclosed in the above embodiment, the present embodiment discloses a flow control device. Please refer to Figure 3 , the flow control device comprises an acquisition unit 301, a determination unit 302 and an execution unit 303.
[0111] The acquisition unit 301 is configured to acquire the flow characteristics and the gateway health state at the current time, and the service type corresponding to the target request when the target request is received.
[0112] The determination unit 302 is configured to determine the flow control strategy corresponding to the target request based on the flow characteristics, the gateway health state and the service type. The flow control strategy comprises throttling the request by using a sliding window algorithm or a token bucket algorithm, and rejecting the request.
[0113] The execution unit 303 is configured to execute the flow control strategy for the target request.
[0114] Optionally, the determination unit 302 comprises:
[0115] A size acquisition sub-unit is configured to acquire the query per second and the flow size received within a preset time period based on the flow characteristics.
[0116] An algorithm determination sub-unit is configured to determine the flow control strategy as the sliding window algorithm in a case that the query per second is greater than a preset quantity, or the flow size exceeds a preset flow threshold.
[0117] A first strategy determination sub-unit is configured to determine the flow control strategy based on the gateway health state and the service type in a case that the query per second is less than or equal to the preset quantity, and the flow size does not exceed the preset flow threshold.
[0118] Optionally, the device further comprises:
[0119] The first rejection subunit is configured to reject the target request when the number of queries per second is greater than a global preset number, or the traffic size exceeds a global preset traffic threshold, wherein the global preset number is greater than the preset number, and the global preset traffic threshold is greater than the preset traffic threshold.
[0120] Optionally, the first policy determination subunit comprises:
[0121] The usage rate obtaining subunit is configured to obtain a central processing unit (CPU) usage rate, a memory usage rate, and an average delay time at the current time point.
[0122] The score determination subunit is configured to determine a health score for representing the health status of the gateway based on the CPU usage rate, the memory usage rate, and the average delay time.
[0123] The second policy determination subunit is configured to determine the traffic control policy based on the service type when the health score is greater than a preset score.
[0124] The third policy determination subunit is configured to determine the traffic control policy according to the health score when the health score is less than or equal to the preset score.
[0125] Optionally, the third policy determination subunit comprises:
[0126] The adjustment subunit is configured to adjust the preset number and / or the preset traffic threshold according to the health score to obtain an adjusted preset number and / or preset traffic threshold.
[0127] The re-determination subunit is configured to determine the traffic control policy according to the number of queries per second and the traffic size, and the adjusted preset number and / or preset traffic threshold.
[0128] Optionally, the third policy determination subunit comprises:
[0129] The rejection rate determination subunit is configured to determine a rejection rate of requests according to the health score.
[0130] The second rejection subunit is configured to reject requests according to the rejection rate.
[0131] Optionally, the score determination subunit comprises:
[0132] The low-score determination subunit is configured to determine the health score as a value less than or equal to the preset score when the CPU usage rate is greater than a preset CPU usage rate, the memory usage rate is greater than a preset memory usage rate, or the average delay time is greater than a preset delay time.
[0133] The high score determining subunit is configured to determine that the health score is a value greater than the preset score when the CPU usage is less than or equal to a preset CPU usage, the memory usage is less than or equal to a preset memory usage, and the average delay time is less than or equal to a preset delay time.
[0134] Optionally, the second strategy determining subunit comprises:
[0135] An initial obtaining subunit is configured to obtain an initial traffic control strategy corresponding to the service type.
[0136] A fine tuning subunit is configured to fine tune the initial traffic control strategy by using the health score to obtain the traffic control strategy.
[0137] Optionally, the apparatus further comprises:
[0138] A strategy configuring subunit is configured to configure the traffic control strategy.
[0139] A corresponding relationship configuring subunit is configured to configure a corresponding relationship between the traffic control strategy and the traffic characteristics, the gateway health status, and the service type.
[0140] A storage subunit is configured to store the traffic control strategy and the corresponding relationship in a remote configuration.
[0141] An updating subunit is configured to load and update the traffic control strategy and the corresponding relationship locally in real time by monitoring the remote configuration.
[0142] The embodiments are described progressively in the specification. For the apparatus disclosed in the embodiments, the description is relatively simple because it corresponds to the method disclosed in the embodiments. Please refer to the description of the method part.
[0143] It should also be noted that, in the present document, the terms such as first and second are used only to distinguish one entity or operation from another, and do not necessarily require or imply any actual such relationship or order between the entities or operations. In addition, the terms "comprises", "comprising", or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or apparatus including a list of elements does not only include those elements, but also includes other elements not explicitly listed, or further includes elements inherent in such a process, method, article, or apparatus. Without more limitations, an element defined by the phrase "comprising a" does not exclude the presence of additional identical elements in the process, method, article, or apparatus including the element.
[0144] The steps of a method or algorithm described in connection with the embodiments disclosed herein can be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module can reside in RAM, flash memory, ROM, electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. The exemplary storage media are coupled to the processor such the processor can read information from, and write information to, the storage media. In the alternative, hardwired circuitry can be used in place of, or in combination with, software instructions to implement processes consistent with the principles of the application. Although exemplary embodiments of the present application have been described herein, other and further modifications can be made by those skilled in the art without departing from the spirit and scope of the present application.
[0145] Any feature in the described embodiments that is recited in the specification and / or claims can be replaced by alternative features serving the same, equivalent or similar purpose, unless otherwise stated.
[0146] The foregoing description of the disclosed embodiments enables a person skilled in the art to make or use the application. Modifications of these embodiments will occur to persons of skill in the art, and all such modifications that do not depart from the spirit of the application are intended to be within the scope of the application. The scope of the application is to be interpreted only by document entitled "Claims".
Claims
1. A method for flow control, characterized in that, include: Upon receiving a target request, obtain the current traffic characteristics and gateway health status, as well as the service type corresponding to the target request; Based on the traffic characteristics, the gateway health status, and the service type, determine the traffic control policy corresponding to the target request; The flow control strategy includes rate limiting of requests using a sliding window algorithm or a token bucket algorithm, as well as rejecting requests; The traffic control policy is executed in response to the target request.
2. The method according to claim 1, characterized in that, The step of determining the traffic control policy corresponding to the target request based on the traffic characteristics, the gateway health status, and the service type includes: Based on the traffic characteristics, the number of queries per second and the amount of traffic received within a preset time period are obtained; If the number of queries per second is greater than a preset number, or the traffic volume exceeds a preset traffic threshold, the traffic control strategy is determined to be a sliding window algorithm. If the number of queries per second is less than or equal to the preset number, and the traffic volume does not exceed the preset traffic threshold, the traffic control policy is determined based on the gateway health status and the service type.
3. The method according to claim 2, characterized in that, Before determining that the flow control strategy is a sliding window algorithm, the method further includes: If the number of queries per second is greater than the global preset number, or if the traffic volume exceeds the global preset traffic threshold, the target request is rejected; the global preset number is greater than the preset number, and the global preset traffic threshold is greater than the preset traffic threshold.
4. The method according to claim 2, characterized in that, Determining the traffic control policy based on the gateway health status and the service type includes: Obtain the CPU utilization, memory utilization, and average latency of the central processing unit at the current moment; Based on the CPU utilization, the memory utilization, and the average latency, a health score is determined to characterize the health status of the gateway. If the health score is greater than a preset score, the traffic control strategy is determined based on the service type. If the health score is less than or equal to the preset score, the flow control strategy is determined based on the health score.
5. The method according to claim 4, characterized in that, Determining the traffic control strategy based on the health score includes: Adjust the preset quantity and / or preset flow threshold according to the health score to obtain the adjusted preset quantity and / or preset flow threshold; The traffic control strategy is determined based on the number of queries per second, the traffic volume, and the adjusted preset quantity and / or preset traffic threshold.
6. The method according to claim 4, characterized in that, Determining the traffic control strategy based on the health score includes: The rejection rate for requests is determined based on the health score; The request was rejected based on the rejection rate.
7. The method according to claim 4, characterized in that, The process of determining a health score characterizing the gateway's health status based on the CPU utilization, memory utilization, and average latency includes: When the CPU utilization rate is greater than the preset CPU utilization rate, the memory utilization rate is greater than the preset memory utilization rate, or the average latency time is greater than the preset latency time, the health score is determined to be a value less than or equal to the preset score. When the CPU utilization rate is less than or equal to the preset CPU utilization rate, the memory utilization rate is less than or equal to the preset memory utilization rate, and the average latency time is less than or equal to the preset latency time, the health score is determined to be a value greater than the preset score.
8. The method according to claim 4, characterized in that, Determining the traffic control policy based on the service type includes: Obtain the initial traffic control policy corresponding to the service type; The initial flow control strategy is fine-tuned using the health score to obtain the flow control strategy.
9. The method according to claim 1, characterized in that, Before receiving the target request, the method further includes: Configure the traffic control policy; Configure the correspondence between the traffic control policy and the traffic characteristics, the gateway health status, and the service type; The flow control policy and the corresponding relationship are stored in a remote configuration. By monitoring the remote configuration, the traffic control policy and its corresponding relationship are loaded and updated locally in real time.
10. A flow control device, characterized in that, include: Acquisition unit, determination unit, and execution unit; The acquisition unit is used to acquire the current traffic characteristics and gateway health status, as well as the service type corresponding to the target request, when a target request is received. The determining unit is configured to determine the traffic control policy corresponding to the target request based on the traffic characteristics, the gateway health status, and the service type. The flow control strategy includes rate limiting of requests using a sliding window algorithm or a token bucket algorithm, as well as rejecting requests; The execution unit is used to execute the traffic control policy in response to the target request.
Citation Information
Patent Citations
Multi-dimensional flow control method and system
CN111935030A
Self-adaptive multi-dimensional flow control method, system, equipment and medium
CN119697121A
Intelligent traffic scheduling strategy optimization method and device, electronic equipment and medium
CN120378447A