A network traffic control method and system

By calculating the load characteristic index of the cluster and scheduling token buckets, the problem of unsmooth network traffic caused by unbalanced node requests in distributed clusters is solved, and balanced scheduling and smoothness of traffic are achieved.

CN118200244BActive Publication Date: 2024-08-30ZHUHAI ELECTAC HIGH TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202410339313.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-25
Publication Date
2024-08-30
Estimated Expiration
2044-03-25

AI Technical Summary

Technical Problem

In a distributed cluster, unbalanced node requests lead to blocked network traffic, and it is difficult for existing technologies to effectively solve this problem.

Method used

By obtaining the monitoring indicator data of each interface of the cluster, the load characteristic index is calculated. If the index is greater than the threshold, token scheduling is performed on the token bucket of each interface to match the token consumption and achieve balanced scheduling of traffic.

Benefits of technology

It ensures the smooth flow of network traffic in the cluster, and improves the balance and efficiency of network traffic by finely controlling the token bucket capacity of each node.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118200244B
    Figure CN118200244B
Patent Text Reader

Abstract

The present invention relates to the technical field of network data processing, and in particular to a method and system for controlling network traffic, the method comprising: obtaining monitoring index data of each interface in a cluster in a recent monitoring time period; wherein the monitoring index data includes the traffic, bandwidth usage and response time of a request of the interface; determining a load characteristic index of the cluster based on the monitoring index data of each interface in the cluster; wherein the load characteristic index is used to characterize the maximum difference degree of load between each interface in the cluster; if it is determined that the load characteristic index is greater than a characteristic threshold, token scheduling is performed on the token bucket of each interface based on the token bucket capacity of each interface and the token consumption in the most recent multiple time windows to match the token consumption of each interface; the present invention can ensure the smooth flow of network traffic in the cluster by performing token scheduling on the token bucket of each node in the cluster.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of network data processing, and in particular to a method and system for controlling network traffic. Background Art

[0002] For a distributed cluster, when the requests of each node in the cluster are unbalanced, even if the request volume of the entire cluster is small, there may be a single node with too many requests, resulting in poor message sending in the cluster.

[0003] Therefore, it is necessary to provide a solution that can ensure smooth network traffic in the cluster. Summary of the invention

[0004] The present invention aims to provide a method and system for controlling network traffic, aiming to perform token scheduling on the token buckets of each node in a cluster, thereby ensuring smooth network traffic in the cluster.

[0005] In order to achieve the above object, the present invention provides the following technical solutions:

[0006] In a first aspect, an embodiment of the present invention provides a method for controlling network traffic, the method comprising the following steps:

[0007] S100, obtaining monitoring indicator data of each interface in the cluster in the most recent monitoring time period; wherein the monitoring indicator data includes the flow rate, bandwidth usage and response time of the request of the interface;

[0008] S200, determining a load characteristic index of the cluster based on monitoring indicator data of each interface in the cluster; wherein the load characteristic index is used to characterize the maximum difference degree of load between each interface in the cluster;

[0009] S300, if it is determined that the load characteristic index is greater than the characteristic threshold, token scheduling is performed on the token buckets of each interface based on the token bucket capacity of each interface and the token consumption in the most recent multiple time windows to match the token consumption of each interface.

[0010] Optionally, in S200, determining the load characteristic index of the cluster based on the monitoring indicator data of each interface in the cluster includes:

[0011] S210, for each interface in the cluster, extract the total traffic value, the peak value of bandwidth usage, and the maximum response time from the monitoring indicator data of the most recent monitoring time period;

[0012] S220, determining traffic characteristic data based on the total traffic value, determining bandwidth characteristic data based on the peak bandwidth usage, and determining time characteristic data based on the maximum response time; wherein the traffic characteristic data characterizes the degree of traffic difference of each interface in the cluster, the bandwidth characteristic data characterizes the degree of bandwidth utilization difference of each interface in the cluster, and the time characteristic data characterizes the degree of maximum response time difference of each interface in the cluster;

[0013] S230: Determine a load characteristic index of the cluster based on the traffic characteristic data, the bandwidth characteristic data, and the time characteristic data.

[0014] Optionally, in S220, determining the flow characteristic data based on the total flow value includes:

[0015] Determine the maximum flow value, the minimum flow value and the average flow value among the total flow values ​​of all interfaces;

[0016] The ratio of the difference between the maximum flow value and the minimum flow value to the average flow value is taken as the flow ratio Rf;

[0017] The traffic characteristic data of the cluster is calculated using the formula ln(1+exp(Rf)).

[0018] Optionally, in S220, determining bandwidth characteristic data based on the peak value of bandwidth usage includes:

[0019] For each interface in the cluster, obtain the maximum allowed bandwidth corresponding to the interface, and use the ratio of the peak bandwidth used by the interface to the maximum allowed bandwidth as the bandwidth ratio of the interface;

[0020] The number of times the bandwidth ratio of each interface exceeds the bandwidth ratio threshold is recorded as Ni, the number of times the bandwidth ratio of all interfaces exceeds the bandwidth ratio threshold is recorded as N, and the standard deviation of the bandwidth ratio of all interfaces is recorded as σb;

[0021] The bandwidth characteristic data of the cluster is calculated using the formula ln(1+σb*exp(max(Ni) / N)).

[0022] Optionally, in S220, determining time characteristic data based on the maximum response time includes:

[0023] Determine the maximum time value Tmax and the minimum time value Tmin of the maximum response time of all interfaces;

[0024] The number of times the maximum response time of each interface exceeds the response time threshold is recorded as Ti, the number of times the bandwidth ratio of all interfaces exceeds the bandwidth ratio threshold is recorded as T, and the standard deviation of the maximum response time of all interfaces is recorded as σt;

[0025] The time characteristic data of the cluster is calculated using the formula ln(1+σt*exp(max(Ti) / T)*exp(Tmax / Tmin)).

[0026] Optionally, in S230, determining the load characteristic index of the cluster based on the traffic characteristic data, the bandwidth characteristic data, and the time characteristic data includes:

[0027] The load characteristic index of the cluster is calculated using the formula max(λ1*Ff+λ2*Bf+λ3*Tf); wherein λ1+λ2+λ3=1, Ff represents traffic characteristic data, λ1 represents the weight of traffic characteristic data, Bf represents bandwidth characteristic data, λ2 represents the weight of bandwidth characteristic data, Tf represents time characteristic data, and λ3 represents the weight of time characteristic data.

[0028] Optionally, in S300, the token buckets of the interfaces are scheduled based on the token bucket capacities of the interfaces and the token consumption in the past M time windows to match the token consumption of the interfaces, including:

[0029] S301, for each interface in the cluster, obtain the token consumption of each interface in the past M time windows, calculate the capacity ratio of the token consumption in the most recent M time windows to the token bucket capacity, classify the interfaces whose M capacity ratios all exceed a first ratio threshold as the incoming cluster, and classify the interfaces whose M capacity ratios all are lower than a second ratio threshold as the lending cluster; wherein the first ratio threshold is greater than the second ratio threshold;

[0030] S302, initialize the counter to 1, normalize the borrowing coefficient of each interface in the incoming cluster to 1 / n, multiply the token bucket capacity of each interface in the lending cluster by the corresponding first ratio threshold, and sum them as the total capacity that can be transferred in; wherein n is the total number of interfaces in the incoming cluster;

[0031] S303, allocating the total transferable capacity to each interface in the transfer-in cluster according to the transfer coefficient of each interface in the transfer-in cluster;

[0032] S304, forming a first quantity sequence with the number of tokens of each interface in the transferred-in cluster in the most recent transferred-in token, respectively calculating the quantity differences between all the number of tokens in the first quantity sequence, and forming a second quantity sequence with each non-zero quantity difference; wherein each number of tokens in the first quantity sequence corresponds one-to-one to each interface in the transferred-in cluster;

[0033] S305, determining whether the ratio of the maximum value to the average value of each quantity difference in the second quantity sequence exceeds a third ratio threshold, if so, executing S306, otherwise keeping the number of the counter unchanged and executing S302;

[0034] S306, adding 1 to the number of the counter to determine whether the number of the counter exceeds M, if so, executing S301, otherwise executing S307;

[0035] S307, forming a first time series with the time intervals between the two most recent tokens of each interface in the cluster, respectively calculating the time differences between all time intervals in the first time series, and forming a second time series with each non-zero time difference;

[0036] S308, recording the difference between the maximum value and the minimum value in the second time series as T1, recording the standard deviation of each time difference in the second time series as T2, and taking the ratio of T1 to T2 as the time adjustment coefficient Kt;

[0037] S309, for each interface in the transferred cluster, the number of tokens corresponding to the interface is recorded as S1, the difference between the number of tokens corresponding to the interface and the average value of each quantity difference in the second quantity sequence is recorded as S2, and the ratio of S2 to S1 is used as the quantity adjustment coefficient Ks of the interface;

[0038] S310, taking the product of the time adjustment coefficient Kt and the quantity adjustment coefficient Ks of the interface as the comprehensive adjustment coefficient of the interface, normalizing the comprehensive adjustment coefficients of each interface in the transferred-in cluster and adding 1 / n to obtain the adjustment coefficients of each interface in the transferred-in cluster, and then executing S303.

[0039] In a second aspect, an embodiment of the present invention provides a network traffic control system, the system comprising:

[0040] at least one processor;

[0041] at least one memory for storing at least one program;

[0042] When the at least one program is executed by the at least one processor, the at least one processor implements the network traffic control method as described in any one of the first aspects.

[0043] The beneficial effects of the present invention are as follows: the present invention discloses a method and system for controlling network traffic, which obtains monitoring index data of each interface in a cluster in a recent monitoring time period, thereby understanding the load characteristics of each interface in the cluster, facilitating subsequent analysis of traffic distribution; based on the monitoring index data of each interface in the cluster, the load characteristic index of the cluster is determined to reflect the overall load balance of the cluster, which is used as a basis for judging the subsequent token bucket capacity adjustment; if it is determined that the load characteristic index is greater than the characteristic threshold, the token bucket of each interface is token-scheduled based on the token bucket capacity of each interface and the token consumption of the most recent multiple time windows to match the token consumption of each interface. By token-scheduling the token buckets of each node in the cluster, the smooth flow of network traffic in the cluster is guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0045] Figure 1 is a flow chart of a method for controlling network traffic in an embodiment of the present invention;

[0046] Figure 2 It is a schematic diagram of the structure of a control system for network traffic in an embodiment of the present invention. DETAILED DESCRIPTION

[0047] The following will be combined with the embodiments and drawings to clearly and completely describe the concept, specific structure and technical effects of the present invention, so as to fully understand the purpose, scheme and effect of the present invention. It should be noted that the embodiments of the present invention and the features in the embodiments can be combined with each other without conflict.

[0048] See also Figure 1 , Figure 1 The present invention provides a flow chart of a method for controlling network traffic, wherein the method comprises the following steps:

[0049] S100, obtaining monitoring indicator data of each interface in the cluster in the most recent monitoring time period; wherein the monitoring indicator data includes the flow rate, bandwidth usage and response time of the request of the interface;

[0050] Specifically, the traffic data of each interface in the cluster is monitored, and monitoring tools are used to collect traffic-related indicators to obtain monitoring indicator data of each interface, understand the load characteristics of each interface in the cluster, and facilitate subsequent analysis of traffic distribution.

[0051] S200, determining a load characteristic index of the cluster based on monitoring indicator data of each interface in the cluster; wherein the load characteristic index is used to characterize the maximum difference degree of load between each interface in the cluster;

[0052] Specifically, it provides differentiated identification of the monitoring indicator data of each interface in the cluster, and comprehensively calculates the load characteristic index, which can reflect the maximum difference in load between each interface, thereby reflecting the overall load balance of the cluster, which can serve as a basis for judging the subsequent token bucket capacity adjustment.

[0053] S300, if it is determined that the load characteristic index is greater than the characteristic threshold, token scheduling is performed on the token buckets of each interface based on the token bucket capacity of each interface and the token consumption in the most recent multiple time windows to match the token consumption of each interface.

[0054] Specifically, when the load characteristic index is greater than the characteristic threshold, the token bucket capacity of each interface in the cluster is adjusted to match the token consumption of each interface. By finely controlling the network traffic of each node in the cluster, the smooth flow of network traffic in the cluster is guaranteed.

[0055] It should be noted that the traffic of an interface refers to the amount of data transmitted through the interface, which is used to describe the amount of information transmitted through the interface within a certain period of time.

[0056] The used bandwidth of an interface refers to the amount of bandwidth used when transmitting data through the interface. Bandwidth refers to the amount of data that can be transmitted in a specific period of time, usually measured in bits per second (bps) or bytes per second (Bps). For example, if the bandwidth of an interface is 100Mbps, it can transmit 100 megabits of data in one second. The used bandwidth refers to the portion of bandwidth consumed when actually transmitting data. The size of the used bandwidth is affected by many factors, such as the amount of data transmitted, the speed of data transmission, and the degree of network congestion. When the used bandwidth of an interface is high, it may mean that a large amount of data is being transmitted through the interface, which may affect network performance, such as increasing latency or data loss. By monitoring the used bandwidth of an interface, you can understand the distribution and bottlenecks of network traffic, and help evaluate the performance and capacity requirements of the network.

[0057] Response time is an important indicator for evaluating interface performance and user experience. Shorter response time usually means better performance and faster interaction. If the response time is too long, it may increase user waiting time, reduce system efficiency, and even affect the normal operation of the business.

[0058] In some embodiments, in S200, determining the load characteristic index of the cluster based on the monitoring indicator data of each interface in the cluster includes:

[0059] S210, for each interface in the cluster, extract the total traffic value, the peak value of bandwidth usage, and the maximum response time from the monitoring indicator data of the most recent monitoring time period;

[0060] S220, determining traffic characteristic data based on the total traffic value, determining bandwidth characteristic data based on the peak bandwidth usage, and determining time characteristic data based on the maximum response time; wherein the traffic characteristic data characterizes the degree of traffic difference of each interface in the cluster, the bandwidth characteristic data characterizes the degree of bandwidth utilization difference of each interface in the cluster, and the time characteristic data characterizes the degree of maximum response time difference of each interface in the cluster;

[0061] S230: Determine a load characteristic index of the cluster based on the traffic characteristic data, the bandwidth characteristic data, and the time characteristic data.

[0062] Through comprehensive evaluation from three aspects: traffic characteristic data, bandwidth characteristic data and time characteristic data, the load characteristic index obtained can fully reflect the traffic differences of the cluster.

[0063] In some embodiments, in S220, determining the flow characteristic data based on the total flow value includes:

[0064] Determine the maximum flow value, the minimum flow value and the average flow value among the total flow values ​​of all interfaces;

[0065] The ratio of the difference between the maximum flow value and the minimum flow value to the average flow value is taken as the flow ratio Rf;

[0066] The traffic characteristic data of the cluster is calculated using the formula ln(1+exp(Rf)).

[0067] It should be noted that ln() represents a logarithmic function with a natural constant as the base, and exp() represents an exponential function. The traffic characteristic data calculated based on the traffic ratio can reflect the traffic differences of each interface.

[0068] In some embodiments, in S220, determining bandwidth characteristic data based on the peak bandwidth usage includes:

[0069] For each interface in the cluster, obtain the maximum allowed bandwidth corresponding to the interface, and use the ratio of the peak bandwidth used by the interface to the maximum allowed bandwidth as the bandwidth ratio of the interface;

[0070] The number of times the bandwidth ratio of each interface exceeds the bandwidth ratio threshold is recorded as Ni, the number of times the bandwidth ratio of all interfaces exceeds the bandwidth ratio threshold is recorded as N, and the standard deviation of the bandwidth ratio of all interfaces is recorded as σ b ;

[0071] Using the formula ln(1+σ b *exp(max(Ni) / N)) calculates the bandwidth characteristic data of the cluster.

[0072] It should be noted that max() indicates the maximum value, and the bandwidth ratio threshold is preset in the range of [0.8, 0.95]. For interfaces that exceed the bandwidth ratio threshold by too many, it is easy to cause traffic imbalance on a single interface. Combining the standard deviation reflecting the overall imbalance and the standard deviation reflecting the individual imbalance can fully reflect the bandwidth ratio differences of the cluster.

[0073] The maximum allowed bandwidth of an interface refers to the maximum data transmission rate that the interface can support or accommodate. Specifically, the maximum allowed bandwidth indicates the maximum amount of data that can be transmitted per unit time on a specific interface. It limits the speed of data traffic through the interface. It should be noted that the actual bandwidth usage may be affected by many factors, such as network congestion, other traffic competition, transmission distance, etc. Therefore, even if the interface has the maximum allowed bandwidth, the actual available bandwidth may be lower than this value.

[0074] In some embodiments, in S220, determining time characteristic data based on the maximum response time includes:

[0075] Determine the maximum time value Tmax and the minimum time value Tmin of the maximum response time of all interfaces;

[0076] The number of times the maximum response time of each interface exceeds the response time threshold is recorded as Ti, the number of times the bandwidth ratio of all interfaces exceeds the bandwidth ratio threshold is recorded as T, and the standard deviation of the maximum response time of all interfaces is recorded as σ t ;

[0077] Using the formula ln(1+σ t *exp(max(Ti) / T)*exp(Tmax / Tmin)) calculates the time characteristic data of the cluster.

[0078] The time characteristic data calculated by this embodiment combines various factors reflecting time differences and can reflect the overall difference in cluster response time.

[0079] In some embodiments, in S230, determining the load characteristic index of the cluster based on the traffic characteristic data, the bandwidth characteristic data, and the time characteristic data includes:

[0080] The load characteristic index of the cluster is calculated using the formula max(λ1*Ff+λ2*Bf+λ3*Tf); wherein λ1+λ2+λ3=1, Ff represents traffic characteristic data, λ1 represents the weight of traffic characteristic data, Bf represents bandwidth characteristic data, λ2 represents the weight of bandwidth characteristic data, Tf represents time characteristic data, and λ3 represents the weight of time characteristic data.

[0081] The traffic characteristic data, bandwidth characteristic data and time characteristic data are weighted respectively to determine an index that can represent the maximum load difference between the interfaces in the cluster. This index, which serves as the load characteristic index of the cluster, can reflect the correlation between various characteristic data in various business scenarios and improve the adaptability of the scenarios.

[0082] In some embodiments, in S300, the token buckets of each interface are scheduled based on the token bucket capacity of each interface and the token consumption of the past M time windows to match the token consumption of each interface, including:

[0083] S301, for each interface in the cluster, obtain the token consumption of each interface in the past M time windows, calculate the capacity ratio of the token consumption in the most recent M time windows to the token bucket capacity, classify the interfaces whose M capacity ratios all exceed a first ratio threshold as the incoming cluster, and classify the interfaces whose M capacity ratios all are lower than a second ratio threshold as the lending cluster; wherein the first ratio threshold is greater than the second ratio threshold;

[0084] In some embodiments, the first ratio threshold value ranges from 0.8 to 1, the second ratio threshold value ranges from 0 to 0.2, and 2≤M≤30.

[0085] S302, initialize the counter to 1, normalize the borrowing coefficient of each interface in the incoming cluster to 1 / n, multiply the token bucket capacity of each interface in the lending cluster by the corresponding first ratio threshold, and sum them as the total capacity that can be transferred in; wherein n is the total number of interfaces in the incoming cluster;

[0086] S303, allocating the total transferable capacity to each interface in the transfer-in cluster according to the transfer coefficient of each interface in the transfer-in cluster;

[0087] Specifically, for each interface in the transfer cluster, the number of tokens allocated to the interface is obtained by multiplying the transfer coefficient of the interface in the transfer cluster by the total transferable capacity.

[0088] S304, forming a first quantity sequence with the number of tokens of each interface in the transferred-in cluster in the most recent transferred-in token, respectively calculating the quantity differences between all the number of tokens in the first quantity sequence, and forming a second quantity sequence with each non-zero quantity difference; wherein each number of tokens in the first quantity sequence corresponds one-to-one to each interface in the transferred-in cluster;

[0089] S305, determining whether the ratio of the maximum value to the average value of each quantity difference in the second quantity sequence exceeds a third ratio threshold, if so, executing S306, otherwise keeping the number of the counter unchanged and executing S302;

[0090] In some embodiments, the value range of the third ratio threshold is 0.8 to 1. If the quantity difference of a certain interface is too large, it means that the traffic of the interface is too large compared with other interfaces and needs to be smoothed.

[0091] S306, adding 1 to the number of the counter to determine whether the number of the counter exceeds M, if so, executing S301, otherwise executing S307;

[0092] Specifically, when the number in the counter exceeds M, the cluster needs to be re-divided. The updated incoming cluster and outgoing cluster based on the capacity ratio can reflect the token consumption of each interface in real time, and token scheduling has stronger accuracy and pertinence.

[0093] S307, forming a first time series with the time intervals between the two most recent tokens of each interface in the cluster, respectively calculating the time differences between all time intervals in the first time series, and forming a second time series with each non-zero time difference;

[0094] Specifically, the time interval for calling in tokens for each interface in the cluster is initialized to 0. When the counter is 1, the time interval of the first time series is the time interval for calling in tokens for each interface in the cluster this time. By excluding interfaces with consistent time intervals and consistent numbers of called-in tokens, traffic fluctuations caused by calling in and borrowing are reduced.

[0095] S308, recording the difference between the maximum value and the minimum value in the second time series as T1, recording the standard deviation of each time difference in the second time series as T2, and taking the ratio of T1 to T2 as the time adjustment coefficient Kt;

[0096] S309, for each interface in the transferred cluster, the number of tokens corresponding to the interface is recorded as S1, the difference between the number of tokens corresponding to the interface and the average value of each quantity difference in the second quantity sequence is recorded as S2, and the ratio of S2 to S1 is used as the quantity adjustment coefficient Ks of the interface;

[0097] S310, taking the product of the time adjustment coefficient Kt and the quantity adjustment coefficient Ks of the interface as the comprehensive adjustment coefficient of the interface, normalizing the comprehensive adjustment coefficients of each interface in the transferred-in cluster and adding 1 / n to obtain the adjustment coefficients of each interface in the transferred-in cluster, and then executing S303.

[0098] In this embodiment, according to the difference in the size of the time interval and the difference in the number of tokens called in, the greater the difference in the number of tokens called in, the greater the difference in the request rate caused by the traffic impact on each interface. By adjusting the number of tokens called in by the interface, the time interval of the interface can be adjusted; the smaller the difference in the time interval, the closer the frequency of the traffic impact on each interface is, and the greater the difference in the time interval, the greater the difference in the frequency distribution of the traffic impact on each interface. By adjusting the time interval of the interface, the benefit of disrupting the time interval is higher, and the balance benefit generated by adjusting the number of tokens is higher; by taking the ratio of the difference in the number of tokens called in and the difference in the time interval as the adjustment coefficient, the number of tokens called in is adjusted in the opposite direction, which can smooth the number of tokens called in and expand the difference in the time interval, thereby balancing the traffic demands of each interface.

[0099] It should be noted that packets sent to the token bucket consume tokens. Packets of different sizes consume different numbers of tokens. The token bucket is a control mechanism that indicates when traffic can be sent based on whether there are tokens in the token bucket. Each token in the token bucket represents a byte. If there are tokens in the token bucket, traffic is allowed to be sent; if there are no tokens in the token bucket, traffic is not allowed to be sent. Therefore, if there are enough tokens in the token bucket, traffic can be sent at the peak rate.

[0100] The present invention divides the cluster into a call-in cluster and a lending cluster. The lending interface can forcibly reduce the number of tokens in the current token bucket until the ratio of the token bucket capacity to the maximum throughput is lower than the ratio threshold; the call-in interface can forcibly increase the token bucket capacity, thereby increasing the number of tokens in the current token bucket, preventing the token bucket from being full frequently and causing request flow limiting, and fully matching the load requirements of each interface. The consumption of the call-in interface is transmitted to the lending interface through a synchronization mechanism, and tokens are transferred from the lending interface to achieve the effect of distributed global flow control.

[0101] In addition, refer to Figure 2 An embodiment of the present invention further provides a network traffic control system, the system comprising:

[0102] at least one processor;

[0103] at least one memory for storing at least one program;

[0104] When the at least one program is executed by the at least one processor, the at least one processor implements the above method.

[0105] It can be seen that the contents of the above method embodiments are all applicable to the present system embodiments, the functions specifically implemented by the present system embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0106] In addition, an embodiment of the present invention also provides a computer-readable storage medium, which stores computer-executable instructions, and the computer-executable instructions are executed by a processor or controller, for example, by a processor in the above-mentioned electronic device embodiment, so that the above-mentioned processor can execute the network traffic control method in the above-mentioned embodiment.

[0107] Similarly, the contents of the above method embodiments are all applicable to the present storage medium embodiments. The functions specifically implemented by the present storage medium embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0108] It will be appreciated by those skilled in the art that all or some of the steps and systems in the disclosed method above may be implemented as software, firmware, hardware and appropriate combinations thereof. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or may be implemented as hardware, or may be implemented as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or a non-transitory medium) and a communication medium (or a temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that may be used to store desired information and may be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0109] The above is a specific description of the preferred implementation of the present disclosure, but the present disclosure is not limited to the above-mentioned implementation mode. Technical personnel familiar with the field can also make various equivalent deformations or substitutions without violating the spirit of the present disclosure. These equivalent deformations or substitutions are all included in the scope defined by the claims of the present disclosure.

Claims

1. A method for controlling network traffic, characterized in that: The method comprises the following steps: S100, obtaining monitoring indicator data of each interface in the cluster in the most recent monitoring time period; wherein the monitoring indicator data includes the flow rate, bandwidth usage and response time of the request of the interface; S200, determining a load characteristic index of the cluster based on monitoring indicator data of each interface in the cluster; wherein the load characteristic index is used to characterize the maximum difference degree of load between each interface in the cluster; S300, if it is determined that the load characteristic index is greater than the characteristic threshold, token scheduling is performed on the token buckets of each interface based on the token bucket capacity of each interface and the token consumption in the most recent multiple time windows to match the token consumption of each interface; In S200, determining the load characteristic index of the cluster based on the monitoring indicator data of each interface in the cluster includes: S210, for each interface in the cluster, extract the total traffic value, the peak value of bandwidth usage, and the maximum response time from the monitoring indicator data of the most recent monitoring time period; S220, determining traffic characteristic data based on the total traffic value, determining bandwidth characteristic data based on the peak bandwidth usage, and determining time characteristic data based on the maximum response time; wherein the traffic characteristic data characterizes the degree of traffic difference of each interface in the cluster, the bandwidth characteristic data characterizes the degree of bandwidth utilization difference of each interface in the cluster, and the time characteristic data characterizes the degree of maximum response time difference of each interface in the cluster; S230, determining a load characteristic index of the cluster based on the traffic characteristic data, the bandwidth characteristic data, and the time characteristic data; In S220, determining flow characteristic data based on the total flow value includes: Determine the maximum flow value, the minimum flow value and the average flow value among the total flow values ​​of all interfaces; The ratio of the difference between the maximum flow value and the minimum flow value to the average flow value is taken as the flow ratio Rf; The cluster traffic characteristic data is calculated using the formula ln(1+exp(Rf)); In S220, determining bandwidth characteristic data based on the peak bandwidth usage includes: For each interface in the cluster, obtain the maximum allowed bandwidth corresponding to the interface, and use the ratio of the peak bandwidth used by the interface to the maximum allowed bandwidth as the bandwidth ratio of the interface; The number of times the bandwidth ratio of each interface exceeds the bandwidth ratio threshold is recorded as Ni, the number of times the bandwidth ratio of all interfaces exceeds the bandwidth ratio threshold is recorded as N, and the standard deviation of the bandwidth ratio of all interfaces is recorded as σ b ; Using the formula ln(1+σ b *exp(max(Ni) / N)) calculates the bandwidth characteristic data of the cluster; In S220, determining time characteristic data based on the maximum response time includes: Determine the maximum time value Tmax and the minimum time value Tmin of the maximum response time of all interfaces; The number of times the maximum response time of each interface exceeds the response time threshold is recorded as Ti, the number of times the maximum response time of all interfaces exceeds the response time threshold is recorded as T, and the standard deviation of the maximum response time of all interfaces is recorded as σ t ; Using the formula ln(1+σ t *exp(max(Ti) / T)*exp(Tmax / Tmin)) calculates the time characteristic data of the cluster; In S230, determining the load characteristic index of the cluster based on the traffic characteristic data, the bandwidth characteristic data, and the time characteristic data includes: The load characteristic index of the cluster is calculated using the formula max(λ1*Ff+λ2*Bf+λ3*Tf); where λ1+λ2+λ3=1, Ff represents traffic characteristic data, λ1 represents the weight of traffic characteristic data, Bf represents bandwidth characteristic data, λ2 represents the weight of bandwidth characteristic data, Tf represents time characteristic data, and λ3 represents the weight of time characteristic data; In S300, the token bucket of each interface is scheduled based on the token bucket capacity of each interface and the token consumption in the most recent multiple time windows to match the token consumption of each interface, including: S301, for each interface in the cluster, the token consumption of each interface in the most recent M time windows is obtained, and the capacity ratio of the token consumption in the most recent M time windows and the token bucket capacity is calculated, and the interfaces whose M capacity ratios all exceed the first ratio threshold are classified as the incoming cluster, and the interfaces whose M capacity ratios all are lower than the second ratio threshold are classified as the lending cluster; wherein the first ratio threshold is greater than the second ratio threshold; S302, initializing the counter to 1, normalizing the borrowing coefficients of each interface in the incoming cluster to 1 / n, multiplying the token bucket capacity of each interface in the lending cluster by the first ratio threshold and summing them as the total capacity that can be transferred in; wherein n is the total number of interfaces in the incoming cluster; S303, allocating the total transferable capacity to each interface in the transfer-in cluster according to the transfer coefficient of each interface in the transfer-in cluster; S304, forming a first quantity sequence with the number of tokens of each interface in the transferred-in cluster in the most recent transferred-in token, respectively calculating the quantity differences between all the number of tokens in the first quantity sequence, and forming a second quantity sequence with each non-zero quantity difference; wherein each number of tokens in the first quantity sequence corresponds one-to-one to each interface in the transferred-in cluster; S305, determining whether the ratio of the maximum value to the average value of each quantity difference in the second quantity sequence exceeds a third ratio threshold, if so, executing S306, otherwise keeping the number of the counter unchanged and executing S302; S306, adding 1 to the number of the counter to determine whether the number of the counter exceeds M, if so, executing S301, otherwise executing S307; S307, forming a first time series with the time intervals between the two most recent tokens of each interface in the cluster, respectively calculating the time differences between all time intervals in the first time series, and forming a second time series with each non-zero time difference; S308, recording the difference between the maximum value and the minimum value in the second time series as T1, recording the standard deviation of each time difference in the second time series as T2, and taking the ratio of T1 to T2 as the time adjustment coefficient Kt; S309, for each interface in the transferred cluster, the number of tokens corresponding to the interface is recorded as S1, the difference between the number of tokens corresponding to the interface and the average value of each quantity difference in the second quantity sequence is recorded as S2, and the ratio of S2 to S1 is used as the quantity adjustment coefficient Ks of the interface; S310, taking the product of the time adjustment coefficient Kt and the quantity adjustment coefficient Ks of the interface as the comprehensive adjustment coefficient of the interface, normalizing the comprehensive adjustment coefficients of each interface in the transferred-in cluster and adding 1 / n to obtain the adjustment coefficients of each interface in the transferred-in cluster, and then executing S303.

2. A network traffic control system, characterized in that: The system comprises: at least one processor; at least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements the network traffic control method as claimed in claim 1.

Citation Information

Patent Citations

  • Flow control method, device, equipment and medium

    CN112104567A

  • Dynamic load balancing method based on software defined network

    CN113067863A

  • Distributed cluster current limiting system and method and distributed cluster node

    CN113923216A

  • Traffic control method and device based on token bucket algorithm, equipment and storage medium

    CN117278484A

  • Burst mode control

    WO2014210221A1