CN113973342A - Flow control method and device, electronic equipment and storage medium - Google Patents

Flow control method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN113973342A
CN113973342A CN202111270970.XA CN202111270970A CN113973342A CN 113973342 A CN113973342 A CN 113973342A CN 202111270970 A CN202111270970 A CN 202111270970A CN 113973342 A CN113973342 A CN 113973342A
Authority
CN
China
Prior art keywords
node
forwarded
tokens
forwarding
current
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111270970.XA
Other languages
Chinese (zh)
Inventor
张赟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Topsec Technology Co Ltd
Beijing Topsec Network Security Technology Co Ltd
Beijing Topsec Software Co Ltd
Original Assignee
Beijing Topsec Technology Co Ltd
Beijing Topsec Network Security Technology Co Ltd
Beijing Topsec Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Topsec Technology Co Ltd, Beijing Topsec Network Security Technology Co Ltd, Beijing Topsec Software Co Ltd filed Critical Beijing Topsec Technology Co Ltd
Priority to CN202111270970.XA priority Critical patent/CN113973342A/en
Publication of CN113973342A publication Critical patent/CN113973342A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W28/00Network traffic management; Network resource management
    • H04W28/16Central resource management; Negotiation of resources or communication parameters, e.g. negotiating bandwidth or QoS [Quality of Service]
    • H04W28/24Negotiating SLA [Service Level Agreement]; Negotiating QoS [Quality of Service]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/215Flow control; Congestion control using token-bucket
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/24Traffic characterised by specific attributes, e.g. priority or QoS
    • H04L47/2491Mapping quality of service [QoS] requirements between different networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/32Flow control; Congestion control by discarding or delaying data units, e.g. packets or frames

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Quality & Reliability (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application provides a flow control method, a flow control device, an electronic device and a storage medium, wherein the method comprises the following steps: determining a target node corresponding to the current traffic to be forwarded; judging whether the current traffic to be forwarded meets preset forwarding conditions in the target node and each superior node of the target node; if yes, forwarding the current traffic to be forwarded; otherwise, discarding the current traffic to be forwarded; wherein: the forwarding conditions of the target node and the superior nodes except the superior node include: the current residual token number in the node does not meet the requirement of forwarding the current flow to be forwarded, but the current residual token number meets the requirement of forwarding the current flow to be forwarded, and the currently used token number of the node in the period is smaller than the limit value corresponding to the node; and the limit value corresponding to the node is more than or equal to the total number of the guarantee tokens of the node and less than or equal to the total number of the limit tokens of the node. This scheme provides a QoS software solution that can be used on network egress devices.

Description

Flow control method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of network communications, and in particular, to a flow control method, an apparatus, an electronic device, and a storage medium.
Background
The purpose of QoS (Quality of Service) is to better provide traffic forwarding Service to users by controlling traffic under limited bandwidth resources.
Currently mainstream QoS solutions are classified into hardware solutions and software solutions.
Among hardware solutions are QoS-specific FPGAs (Field-Programmable Gate arrays) or QoS coprocessors integrated inside network processors, such as ezchip network processors. The hardware solution provides good service performance but is too costly for the equipment vendor.
The software solution represents a QoS module provided by a DPDK (data plane development kit), and the QoS module of the DPDK is optimized by codes, so that the performance can be equivalent to that of a hardware solution. However, the DPDK QoS module has strict deployment requirements, and a Core (Processor Core) must be separately allocated to the QoS module for use, which is equivalent to using a Core of a general-purpose CPU (Central Processing Unit) to complete the functions of an FPGA or a QoS coprocessor. Compared with a hardware scheme, the cost of the DPDK scheme is lower, but for some scenes which need to be deployed flexibly and have low QoS requirements, the DPDK scheme is still limited too much.
Besides the software solution of the QoS module of the DPDK, the QoS module can also be implemented by providing some QoS related algorithms in the Linux kernel, for example, by using an HTB (Hierarchical Token Bucket) queuing mechanism. However, the HTB queuing mechanism needs to cache traffic data in the memory, and the pressure on the memory is large, so that the performance of the algorithm is not high, and the HTB queuing mechanism cannot be used on a dedicated network egress device.
Disclosure of Invention
An object of the embodiments of the present application is to provide a method and an apparatus for controlling flow, an electronic device, and a storage medium, so as to provide a QoS software solution that can be used on a network egress device.
The embodiment of the application provides a flow control method, which is applied to network outlet equipment and comprises the following steps:
determining a target node corresponding to the current traffic to be forwarded; the target node is a node which is mapped in the network outlet equipment by the equipment which sends the current traffic to be forwarded;
judging whether the current traffic to be forwarded meets preset forwarding conditions in the target node and each superior node of the target node;
if the current traffic to be forwarded meets preset forwarding conditions in the target node and each superior node of the target node, forwarding the current traffic to be forwarded; otherwise, discarding the current traffic to be forwarded; wherein:
the forwarding conditions of the target node and each upper node except the highest node comprise: in a node, the number of the current residual guarantee tokens does not meet the requirement of forwarding the current flow to be forwarded, the number of the current residual limit tokens meets the requirement of forwarding the current flow to be forwarded, and the number of the limit tokens currently used by the node in the period is smaller than the limit value corresponding to the node; and the limit value corresponding to the node is more than or equal to the total number of the guarantee tokens of the node and less than or equal to the total number of the limit tokens of the node.
In the implementation process, the token bucket is adopted to realize the flow limitation of each node in the network outlet equipment, so that the flow control effect is achieved, the flow queuing is not needed in the process, the flow data does not need to be cached in the memory, the pressure on the memory is small, the algorithm performance is high, the token bucket can be used on the network outlet equipment, the flow control is realized, and the flow forwarding service is provided for a user. In addition, according to the scheme of the application, the limiting values corresponding to the nodes except the highest node are set, so that when the number of the used limiting tokens reaches the limiting value in a period, the current flow to be forwarded is discarded, and the limiting tokens of the higher node are not contended upwards, so that the flow of the lower node is limited in advance, individual lower nodes are prevented from seizing too many resources of the higher node, the situation that bandwidth resources are not distributed publicly is relieved, and the flow forwarding service experience perceived by a user is guaranteed.
Further, the method further comprises: if the limit token of the superior node of the node in the previous period is used up, reducing the limit value of the node; and if the limit token of the upper node of the node is not used completely in the previous period, increasing the limit value of the node.
In the implementation process, the limit value of the lower node is dynamically adjusted according to the use condition of the limit token of the upper node in the last period. When the use of the limit token of the superior node in the previous period is finished, that is, the token of the superior node is tense, the flow limit of the subordinate node can be performed more ahead of time by reducing the limit value of the subordinate node, so that the individual subordinate node is further prevented from preempting too many resources of the superior node, and the unfair bandwidth resource allocation condition is relieved. On the contrary, when the upper node does not use the restriction token in the previous period, that is, the upper node indicates that the upper node token is free, the bandwidth use condition corresponding to the upper node is not tense, so that the restriction value of the lower node can be increased, the time for submitting the flow restriction of the lower node is delayed, and the resource of the upper node can be more fully utilized.
Further, after determining a target node corresponding to the current traffic to be forwarded, the method further includes: determining the traffic priority of the current traffic to be forwarded; determining a priority coefficient based on the traffic priority; the higher the traffic priority is, the smaller the priority coefficient is, and the priority coefficient is greater than 0 and smaller than 1; and multiplying the set standard limit value and the priority coefficient to obtain the limit value of the target node.
In the implementation process, the limit value is dynamically adjusted according to the traffic priority of the current traffic to be forwarded, so that the limit value corresponding to the traffic to be forwarded with higher traffic priority is smaller, the traffic to be forwarded with higher traffic priority can have more chances of acquiring the limit token, that is, the traffic to be forwarded with higher traffic priority can have more forwarding chances, and thus more refined difference services for different traffic can be implemented.
Further, the forwarding conditions of the target node and each upper node except the highest node further include: in a node, the number of the current residual guarantee tokens meets the requirement of forwarding the current traffic to be forwarded, and the current traffic to be forwarded has a first mark; the first mark represents the number of the remaining guarantee tokens at the last node of the node to meet the requirement of forwarding the current traffic to be forwarded; wherein the target node defaults that the current traffic to be forwarded has the first label.
Further, the forwarding condition of the highest node includes: in the node, the current residual quantity of the guarantee tokens does not meet the requirement of forwarding the current flow to be forwarded, and the current residual quantity of the limit tokens meets the requirement of forwarding the current flow to be forwarded.
Further, in the same cycle: the total number of the guarantee tokens of the superior node is more than or equal to the sum of the total number of the guarantee tokens of all the subordinate nodes of the superior node; the total number of the restriction tokens of the upper node is greater than or equal to the total number of the restriction tokens of any lower node of the upper node.
In the implementation process, by setting the total number of the guarantee tokens of the upper node to be greater than or equal to the sum of the total numbers of the guarantee tokens of all the subordinate nodes of the upper node, and setting the total number of the limit tokens of the upper node to be greater than or equal to the total number of the limit tokens of any subordinate node of the upper node, it can be ensured that the traffic forwarded by using the guarantee tokens can be forwarded inevitably and the traffic forwarded by limiting the total number of the tokens can compete fully.
Further, the method further comprises: when the fact that the number of currently used limiting tokens of any node is larger than a preset packet loss threshold value in the period is monitored, randomly discarding the received traffic to be forwarded corresponding to the node; and the packet loss threshold is greater than the total number of the guarantee tokens of the node and less than the limit value of the node.
In the implementation process, the packet loss threshold is adopted for limiting, so that the flow to be forwarded can be randomly discarded in advance, and the packet loss can trigger an end-to-end flow control mechanism, so that a sending end of the flow actively reduces a sending window, the sending flow is reduced, and the purpose of controlling the flow in advance is achieved.
The embodiment of the present application further provides a flow control device, which is disposed on a network outlet device, and includes: a determining module and a processing module;
the determining module is used for determining a target node corresponding to the current flow to be forwarded; the target node is a node which is mapped in the network outlet equipment by the equipment which sends the current traffic to be forwarded;
the processing module is configured to determine whether the current traffic to be forwarded satisfies a preset forwarding condition in the target node and each higher-level node of the target node;
if the current traffic to be forwarded meets preset forwarding conditions in the target node and each superior node of the target node, forwarding the current traffic to be forwarded; otherwise, discarding the current traffic to be forwarded; wherein:
the forwarding conditions of the target node and each upper node except the highest node comprise: in a node, the number of the current residual guarantee tokens does not meet the requirement of forwarding the current flow to be forwarded, the number of the current residual limit tokens meets the requirement of forwarding the current flow to be forwarded, and the number of the limit tokens currently used by the node in the period is smaller than the limit value corresponding to the node; and the limit value corresponding to the node is more than or equal to the total number of the guarantee tokens of the node and less than or equal to the total number of the limit tokens of the node.
The embodiment of the application also provides electronic equipment, which comprises a processor, a memory and a communication bus; the communication bus is used for realizing connection communication between the processor and the memory; the processor is configured to execute one or more programs stored in the memory to implement any of the above-described flow control methods.
Also provided in an embodiment of the present application is a readable storage medium storing one or more programs, which are executable by one or more processors to implement any of the above-described flow control methods.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
Fig. 1 is a schematic flow chart of a flow control method according to an embodiment of the present application;
fig. 2 is an exemplary node relationship diagram provided in an embodiment of the present application;
fig. 3 is another exemplary node relationship diagram provided by an embodiment of the present application;
fig. 4 is a schematic structural diagram of a flow control device according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of a network egress device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
The first embodiment is as follows:
in order to implement a lightweight QoS software solution on a network egress device, an embodiment of the present application provides a flow control method applied to a network egress device. As shown in fig. 1, fig. 1 is a schematic flow chart of a flow control method provided in this embodiment, and includes:
s101: and determining a target node corresponding to the current traffic to be forwarded.
It should be noted that the network egress device is a device that is provided at a network egress location and is used to determine whether traffic in the network is outgoing.
In the embodiment of the present application, a network architecture is maintained on the network egress device in the form of a node.
Illustratively, referring to fig. 2, fig. 2 is a node relationship diagram illustrated in an embodiment of the present application. Wherein, each level of nodes are formed by a tree structure. The lowest level node in the graph may correspond to a specific traffic routing entity in the network, while the higher level node characterizes the group of the lower level nodes.
For example, it is assumed that in practical applications, device 1 and device 2 belong to an item group a. Assuming that device 1 and device 2 correspond to node 1 and node 2 in fig. 2, then project group a corresponds to node 9 in fig. 2.
Assuming that, in practical applications, the item group a and the item group B belong to the same item department C, and assuming that the item group B corresponds to the node 10 in fig. 2, the item department C corresponds to the node 13 in fig. 2.
Further, assuming that in practical applications, the item department C and the item department D belong to the company E, and assuming that the item department D corresponds to the node 14 in fig. 2, the company E corresponds to the node 15 in fig. 2.
In the above example, shown in fig. 2 is a system of company E, where the node 15 characterizes company E, the bandwidth of the node 15 is the bandwidth of the whole company, and the number of guaranteed tokens and the number of limit tokens of the node 15 are the total number of guaranteed tokens and the number of limit tokens of all devices of the whole company. And the lowest level nodes 1 to 8 correspond to the respective physical devices.
It should be understood that, for each branch in the node relationship diagram, the length of each branch may be different according to the actual division condition of each branch in the actual application process.
In this embodiment, the target node is a node mapped in the network egress device by the device that sends the current traffic to be forwarded.
For example, in the above example, it is assumed that the device sending the current traffic to be forwarded is device 1, and then the target node is node 1. In the embodiment of the present application, device identification information corresponding to each node, such as a source IP address of a device, may be recorded in advance, so that a target node may be determined accordingly.
S102: and judging whether the current traffic to be forwarded meets preset forwarding conditions in the target node and each superior node of the target node. If the current traffic to be forwarded meets the preset forwarding condition in the target node and each superior node of the target node, the step is switched to step S103; otherwise, go to step S104.
In the embodiment of the present application, the forwarding conditions (hereinafter, referred to as first forwarding conditions for convenience of description) for the target node and each upper node except the highest node may include:
in the node, the current residual quantity of the guarantee tokens does not meet the requirement of forwarding the current traffic to be forwarded, the current residual quantity of the limit tokens meets the requirement of forwarding the current traffic to be forwarded, and the quantity of the limit tokens currently used by the node in the period is smaller than the limit value corresponding to the node.
In an embodiment of the present application, the first spring may further include: in the node, the current quantity of the remaining guarantee tokens meets the requirement of forwarding the current traffic to be forwarded, and the current traffic to be forwarded has a first mark.
In the embodiment of the application, the target node defaults that the current traffic to be forwarded has a first mark. And the first mark represents that the number of the remaining guarantee tokens of the previous node of the node meets the requirement of forwarding the current traffic to be forwarded.
It should be noted that, in the embodiment of the present application, each node has two token buckets, namely, a guarantee token bucket and a limit token bucket. The token in the token bucket is set according to the guaranteed bandwidth corresponding to the node, and the token bucket is used for guaranteeing the minimum available bandwidth of the node; and the limiting token bucket is set according to the limiting bandwidth corresponding to the node so as to limit the maximum bandwidth which can be used by the node.
In use, egress control is exercised over the guaranteed tokens in the guaranteed token bucket for traffic having a first label (e.g., labeled green). And for traffic with a second label (such as the label yellow), outgoing control is exercised by restricting tokens in the token bucket.
In this embodiment of the present application, when traffic to be forwarded is received by default, the traffic to be forwarded has a first flag. Therefore, whether the current residual quantity of the guarantee tokens in the node meets the requirement of forwarding the current flow to be forwarded is judged at first.
If yes, continuing to enable the traffic to be forwarded to carry the first mark, and continuing to judge the upper-layer node.
If not, continuously judging whether the number of the current residual limit tokens in the node meets the requirement of forwarding the current traffic to be forwarded.
And if the number of the remaining limited tokens does not meet the requirement of forwarding the current traffic to be forwarded, indicating that the tokens in the node are not enough for forwarding the traffic to be forwarded. At this time, there are two processing methods in the embodiment of the present application:
one is that: the traffic to be forwarded can be directly discarded, so that the judgment of the superior node is not continued.
The second method is as follows: the mark of the traffic to be forwarded may be changed to a third mark (for example, the mark is red), and when determining the higher-level node, the mark identification is performed first, and when determining the third mark, the mark is not changed directly, and the higher-level determination is continued until the highest-level node is reached. At this time, no substantial judgment is made in the whole flow, and the final mark is still the third mark, so that the traffic to be forwarded is discarded.
If the number of the remaining limiting tokens meets the requirement of forwarding the current traffic to be forwarded, it indicates that although it is guaranteed that the token cannot support forwarding the traffic to be forwarded in the node, the limiting tokens are sufficiently supported, and further determination can be performed in the upper-level node.
In the embodiment of the present application, in order to ensure that the target node can adopt the guarantee token to forward the current traffic to be forwarded, the target node may also determine that the traffic passes through each upper node. The total number of the guaranteed tokens of the upper node may be set to be equal to or greater than the sum of the total number of the guaranteed tokens of all the lower nodes of the upper node. For example, if the total number of the guarantee tokens of the upper node 13 in fig. 2 is 100, the sum of the total number of the guarantee tokens of the lower nodes 9 and 10 should not exceed 100.
In addition, in order to enable each lower node to compete sufficiently, in the embodiment of the present application, the total number of the restriction tokens of the upper node should be greater than or equal to the total number of the restriction tokens of any one lower node of the upper node.
It should be noted that, for the same node, since the number of tokens in the guaranteed token bucket is set according to the guaranteed bandwidth corresponding to the node, and the number of tokens in the restricted token bucket is set according to the restricted bandwidth corresponding to the node, the total number of restricted tokens should be greater than the total number of guaranteed tokens.
It should be understood that the mere setting of the guarantee token bucket and the limit token bucket for flow control can cause unfair resource allocation and resource waste.
As shown in fig. 3, it is assumed that flow control (hereinafter, simply referred to as flow control) of an upper node a is set to 10M to 20M (the minimum guaranteed bandwidth is 10M, and the maximum limited bandwidth is 20M), and flow control settings of lower nodes are all 2M to 20M.
At this time, if the traffic to be forwarded in the period of the node B is far beyond 20M, the node B immediately preempts the updated token in the token-limited bucket, and the node C, the node D, and the node E cannot fairly use the maximum limited bandwidth, which results in unfair resource allocation.
If the flow rates to be forwarded by the lower nodes in the period all exceed 20M, the tokens will be exhausted by the lower nodes in a short time after the tokens are updated, and the messages cannot pass through in the subsequent time period in the period, so that the user experience is not good. In addition, in the second half of the token update period, the token of the node a is exhausted, but all the subordinate nodes still try to apply for the token continuously, which also results in resource waste.
In this embodiment, by setting a corresponding limit value in each node except the highest node, when determining the forwarding condition, in addition to determining whether the current remaining number of guaranteed tokens (i.e., the remaining number of tokens in the guaranteed token bucket of the node) in the node meets the requirement for forwarding the current traffic to be forwarded, or determining whether the current remaining number of limited tokens (i.e., the remaining number of tokens in the limited token bucket of the node) meets the requirement for forwarding the current traffic to be forwarded, it is further determined whether the number of limited tokens currently used by the node in the cycle is smaller than the limit value corresponding to the node. If the number of the currently used restriction tokens of the node in the period is greater than or equal to the restriction value corresponding to the node, the current traffic to be forwarded may be discarded, or the flag may be updated to the third flag.
It should be understood that if the remaining number of the restriction tokens satisfies the requirement for forwarding the current traffic to be forwarded, but the number of the restriction tokens currently used by the node in the period is greater than or equal to the limit value corresponding to the node, it indicates that although no traffic congestion occurs on the node, the traffic congestion may occur at the node higher than the node. In the embodiment of the application, the flow of the subordinate nodes is limited in advance by setting the limit value, so that individual subordinate nodes are prevented from preempting too many resources of the superior nodes, the condition of unfair bandwidth resource allocation is relieved, and the flow forwarding service experience perceived by a user is guaranteed.
It should be noted that, in the embodiment of the present application, the limit value corresponding to each node should be greater than or equal to the total number of guaranteed tokens of the node (i.e., the capacity of the guaranteed token bucket of the node), and less than or equal to the total number of limited tokens of the node (i.e., the capacity of the limited token bucket of the node).
It should be further noted that, in order to enable the limit value of each node to better achieve the regulation effect, in the embodiment of the present application, the limit value of each node in the period may also be dynamically adjusted according to the use condition of the limit token of the previous period of the superior node of each node.
For example, if the limit token of the upper node of the node is used up in the previous period, the limit value of the node is decreased; and if the limit token of the upper node of the node is not used completely in the previous period, increasing the limit value of the node.
It should be understood that when the upper node finishes using the restriction token in the previous period, that is, the token of the upper node is tense, the flow restriction of the lower node can be performed more early by reducing the restriction value of the lower node, so as to further prevent a single lower node from preempting too many resources of the upper node, and alleviate the unfair bandwidth resource allocation. On the contrary, when the upper node does not use the restriction token in the previous period, that is, the upper node indicates that the upper node token is free, the bandwidth use condition corresponding to the upper node is not tense, so that the restriction value of the lower node can be increased, the time for submitting the flow restriction of the lower node is delayed, and the resource of the upper node can be more fully utilized.
It should be noted that, for the token bucket, the number of tokens therein is periodically supplemented. The period described in the embodiments of the present application refers to a supplement period of the token bucket, or a usage period of tokens in the token bucket in some documents.
It should be noted that, in the actual application process, there are two general ways of controlling the tokens in the token bucket.
The first method is as follows: as long as the tokens in the token bucket are not 0 or negative values, the tokens can be allocated for the traffic to be forwarded, the number of tokens in the token bucket is recorded as a negative value when the tokens are insufficient, and the number of tokens represented by the negative value is deducted when the tokens are replenished in the next period.
At this time, whether the current number of remaining guaranteed tokens meets the requirement for forwarding the current traffic to be forwarded and whether the current number of remaining limited tokens meets the requirement for forwarding the current traffic to be forwarded may be judged, and whether the current number of remaining guaranteed tokens and the current number of remaining limited tokens are less than or equal to 0.
Whether the use of the restriction tokens is finished or not can be judged, and whether the number of the restriction tokens is less than or equal to 0 or not is judged.
The second method is as follows: when the number of tokens in the token bucket is larger than or equal to the number of tokens required for forwarding the traffic to be forwarded, the tokens can be allocated for the traffic to be forwarded.
At this time, it may be determined whether the current remaining number of guarantee tokens meets a requirement for forwarding the current traffic to be forwarded and whether the current remaining number of limit tokens meets a requirement for forwarding the current traffic to be forwarded.
The determination of whether the restriction token is used up may be: and judging whether the number of the remaining limiting tokens is more than or equal to the number of tokens required for forwarding the traffic to be forwarded in the last judging process when the last period is finished. If so, determining that the use is not finished; if the ratio is less than the preset value, the use is determined to be finished.
Alternatively, the determination of whether the restriction token is used up may be: and judging whether the number of the remaining limit tokens in the limit token bucket is less than or equal to a set threshold (the threshold is a constant greater than or equal to 0 and can be set by an engineer according to actual needs) when the previous period is finished. And if so, determining that the restriction token is used up. Otherwise, determining that the restriction token is not used completely.
It should also be noted that in practical applications, different traffic often has different priorities. Therefore, in the embodiment of the present application, after the target node corresponding to the current traffic to be forwarded is determined, the traffic priority of the current traffic to be forwarded may also be determined, and then a priority coefficient is determined based on the traffic priority, and then a set standard limit value and the priority coefficient are subjected to multiplication to obtain the limit value of the target node.
In the embodiment of the present application, the higher the priority of the traffic, the smaller the priority coefficient is, and the priority coefficient is greater than 0 and smaller than 1.
In this embodiment of the present application, the traffic priority may be represented according to a DSCP (Differentiated Services Code Point) field in a message of a current traffic to be forwarded or a prior field in 80211. p. The priority coefficient is then determined based on the value of the DSCP field in the message or the prior field in 80211. p.
For example, priority coefficient values corresponding to values of different DSCP fields or prior fields may be recorded in advance, so that the priority coefficient of the current traffic to be forwarded is obtained in a table lookup manner.
In addition, for each upper node, the above method can also be adopted to calculate the limit value of the current traffic to be forwarded, so as to realize more refined difference service for different traffic.
It should be understood that in practical applications, different nodes may also have different priorities. Therefore, in the embodiment of the present application, before determining, each upper node may determine a priority coefficient according to a node priority of a lower node of its own in a current determination path (for example, the node 1 is a lower node of the node 9, and the node 9 is a lower node of the node 13 in fig. 2), and then perform multiplication calculation on a set standard limit value and the priority coefficient to obtain a limit value currently used for determination by the node, so as to implement more refined difference service for different nodes.
It will be appreciated that the two approaches described above may be used in combination. That is, before the determination, each higher node may calculate a priority coefficient according to the traffic priority of the current traffic to be forwarded and the node priority of the lower node reporting the current traffic to be forwarded, and then perform multiplication calculation on the set standard limit value and the priority coefficient to obtain the limit value currently used for the determination by the node, thereby implementing differentiated services for different traffic and different nodes.
It should be noted that, in the above embodiments in which the limit value is calculated based on the priority coefficient, the standard limit value in the previous cycle may be dynamically updated according to the usage of the limit token in the previous cycle by the upper node of the node. The updating method can be seen from the foregoing, and is not described herein again.
It should be noted that, in the embodiment of the present application, the limit value does not need to be set in the highest-level node. To this end, the forwarding condition (hereinafter, referred to as a second forwarding condition) of the highest-level node may include: in the node, the current residual token number does not meet the requirement of forwarding the current flow to be forwarded, and the current residual token number limits the requirement of forwarding the current flow to be forwarded.
Further, the second forwarding condition may further include: in the node, the current quantity of the remaining guarantee tokens meets the requirement of forwarding the current traffic to be forwarded, and the current traffic to be forwarded has a first mark.
S103: and forwarding the current traffic to be forwarded.
It should be noted that, when forwarding the current traffic to be forwarded, the number of tokens required for forwarding the current traffic to be forwarded is reduced in each node that has performed the forwarding condition determination.
And if the current traffic to be forwarded is forwarded by the first mark, deducting the number of the guarantee tokens of each node. And if the current traffic to be forwarded is forwarded by the second mark, deducting the quantity of the limit tokens of each node.
S104: and discarding the current traffic to be forwarded.
It should be noted that, in a possible implementation manner of the embodiment of the present application, in the network outlet device, a packet loss threshold may also be set for each node, and whether the number of currently used restriction tokens of each node is greater than or equal to the packet loss threshold is monitored.
After monitoring that the number of currently used restriction tokens of any node in the period is greater than a preset packet loss threshold, the current used restriction tokens can be randomly discarded according to the received traffic to be forwarded corresponding to the node, so that an end-to-end flow control mechanism is triggered, a sending window is actively reduced by a traffic sending end, the sending traffic is reduced, and the purpose of controlling the traffic in advance is achieved.
It should be understood that, if the above feasible embodiment is adopted, after receiving the current traffic to be forwarded, before determining whether the forwarding condition is met on each node, the determination of the packet loss threshold value may be performed first, so as to perform random packet loss. In each node, if the current traffic to be forwarded is not discarded, further determining whether the forwarding condition is satisfied. If the current traffic to be forwarded is discarded randomly, the flow can be directly ended.
In this embodiment, the packet loss threshold of a node should be greater than the total number of guaranteed tokens of the node and smaller than the limit value of the node. For example, 80% of the limit value of the node may be taken as the packet loss threshold.
The flow control method provided by the embodiment of the application realizes the flow limitation of each node in the network outlet device by adopting the token bucket, thereby achieving the effect of flow control, and the process does not need to queue the flow, does not need to cache the flow data in the memory, has small pressure on the memory, thereby having higher algorithm performance, can be used on the network outlet device, realizes the flow control, and provides flow forwarding service for users. In addition, according to the scheme of the application, the limiting values corresponding to the nodes except the highest node are set, so that when the number of the used limiting tokens reaches the limiting value in a period, the current flow to be forwarded is discarded, and the limiting tokens of the higher node are not contended upwards, so that the flow of the lower node is limited in advance, individual lower nodes are prevented from seizing too many resources of the higher node, the situation that bandwidth resources are not distributed publicly is relieved, and the flow forwarding service experience perceived by a user is guaranteed.
Example two:
the present embodiment takes a specific flow control process as an example on the basis of the first embodiment, and further illustrates the present application.
Assume that the node relationship graph in the network egress device is as shown in fig. 3.
In the figure, the total number of the guarantee tokens of the node A is more than or equal to the sum of the total number of the guarantee tokens of the node B, the node C, the node D and the node E. The total number of restriction tokens for node a is equal to the total number of restriction tokens for node B, node C, node D and node E.
Assume that node B receives a traffic to be forwarded.
S1, judging whether the remaining guarantee token number of the node B is less than or equal to 0. If not, forwarding the traffic to be forwarded, and deducting the number of the guaranteed tokens in the node B and the node A (the deduction value is the number of the tokens required for sending the traffic to be forwarded). If yes, the subsequent steps are continuously executed.
And S2, determining a priority coefficient theta according to the DSCP field in the message of the traffic to be forwarded.
And S3, multiplying the priority coefficient theta by the standard limit value to obtain the limit value of the node B for the traffic to be forwarded.
The standard limit value is determined according to the usage of the limit token in a period on the node A. And if the limit token is used up in the previous period of the node A, the standard limit value in the period is reduced by one on the basis of the standard limit value in the previous period. If the restriction token is not used in the previous period of the node A, the standard restriction value in the period is increased by one on the basis of the standard restriction value in the previous period.
S4, determine whether the number of the restriction tokens used by the node B in the current period is greater than 80% of the restriction value. If not, executing the subsequent steps. And if so, randomly determining whether the traffic to be forwarded is discarded. If the determination is discarding, the process is ended. If the determination is that the data is not discarded, the subsequent steps are executed.
S5, determining whether the number of used restriction tokens in the current period of the node B is greater than the restriction value, and determining whether the number of remaining restriction tokens of the node B is less than or equal to 0.
If the number of the used limit tokens in the period of the node B is larger than the limit value or the number of the residual limit tokens of the node B is less than or equal to 0, discarding the message to be forwarded.
If the number of the used restriction tokens in the period of the node B is less than or equal to the restriction value and the number of the remaining restriction tokens of the node B is greater than 0, marking the traffic to be forwarded as yellow, and continuing the subsequent steps.
S6, it is determined whether the remaining number of restriction tokens at node a is equal to or less than 0. If yes, discarding the message to be forwarded. If not, forwarding the traffic to be forwarded, and deducting the number of the limiting tokens in the node B and the node A (the deduction value is the number of the tokens required for sending the traffic to be forwarded).
By the scheme, a lightweight QoS software solution is realized in the network outlet equipment, no flow queuing is needed in the process, no flow data is cached in the memory, the pressure on the memory is low, and the algorithm performance is high. And the flow distribution is dynamically adjustable based on the congestion state of the superior node, so that the individual inferior nodes are prevented from seizing too many resources of the superior node, the condition of unfair bandwidth resource distribution is relieved, and the flow forwarding service experience perceived by a user is guaranteed.
Example three:
based on the same inventive concept, the embodiment of the present application further provides a flow control device 400 disposed in a network outlet device. Referring to fig. 4, fig. 4 illustrates a flow control device using the method of fig. 1. It should be understood that the specific functions of the apparatus 400 can be referred to the above description, and the detailed description is omitted here as appropriate to avoid redundancy. The apparatus 400 includes at least one software functional module that can be stored in a memory in the form of software or firmware or solidified in an operating system of the apparatus 400. Specifically, the method comprises the following steps:
referring to fig. 4, the apparatus 400 includes: a determination module 401 and a processing module 402. Wherein:
the determining module 401 is configured to determine a target node corresponding to a current traffic to be forwarded; the target node is a node which is mapped in the network outlet equipment by the equipment which sends the current traffic to be forwarded;
the processing module 402 is configured to determine whether the current traffic to be forwarded satisfies a preset forwarding condition in the target node and each higher node of the target node; if the current traffic to be forwarded meets preset forwarding conditions in the target node and each superior node of the target node, forwarding the current traffic to be forwarded; otherwise, discarding the current traffic to be forwarded; wherein:
the forwarding conditions of the target node and each upper node except the highest node comprise: in a node, the number of the current residual guarantee tokens does not meet the requirement of forwarding the current flow to be forwarded, the number of the current residual limit tokens meets the requirement of forwarding the current flow to be forwarded, and the number of the limit tokens currently used by the node in the period is smaller than the limit value corresponding to the node; and the limit value corresponding to the node is more than or equal to the total number of the guarantee tokens of the node and less than or equal to the total number of the limit tokens of the node.
In a possible implementation manner of the embodiment of the present application, the processing module 402 is further configured to reduce the limit value of a node if a limit token of a superior node of the node is used up in a previous period; and if the limit token of the upper node of the node is not used completely in the previous period, increasing the limit value of the node.
In a feasible implementation manner of the embodiment of the present application, the determining module 401 is further configured to determine a traffic priority of a current traffic to be forwarded after determining a target node corresponding to the current traffic to be forwarded; the processing module 402 is further configured to determine a priority coefficient based on the traffic priority; and multiplying the set standard limit value and the priority coefficient to obtain the limit value of the target node. The higher the traffic priority, the smaller the priority coefficient, and the priority coefficient is greater than 0 and smaller than 1.
In a feasible implementation manner of the embodiment of the present application, the forwarding conditions of the target node and each higher-level node except the highest-level node further include: in a node, the number of the current residual guarantee tokens meets the requirement of forwarding the current traffic to be forwarded, and the current traffic to be forwarded has a first mark; the first mark represents the number of the remaining guarantee tokens at the last node of the node to meet the requirement of forwarding the current traffic to be forwarded; wherein the target node defaults that the current traffic to be forwarded has the first label.
In a possible implementation manner of the embodiment of the present application, the forwarding condition of the highest node includes: in the node, the current residual quantity of the guarantee tokens does not meet the requirement of forwarding the current flow to be forwarded, and the current residual quantity of the limit tokens meets the requirement of forwarding the current flow to be forwarded.
In a possible implementation of the embodiments of the present application, in the same cycle: the total number of the guarantee tokens of the superior node is more than or equal to the sum of the total number of the guarantee tokens of all the subordinate nodes of the superior node; the total number of the restriction tokens of the upper node is greater than or equal to the total number of the restriction tokens of any lower node of the upper node.
In this embodiment of the application, the processing module 402 is further configured to, after monitoring that the number of currently used restriction tokens of any node in the period is greater than a preset packet loss threshold, randomly discard the received traffic to be forwarded corresponding to the node; and the packet loss threshold is greater than the total number of the guarantee tokens of the node and less than the limit value of the node.
It should be understood that, for the sake of brevity, the contents described in some embodiments are not repeated in this embodiment.
Example four:
the present embodiment provides a network outlet device, which is shown in fig. 5 and includes a processor 501, a memory 502, an internal communication bus 503 and an external communication module 504. Wherein:
the internal communication bus 503 is used to realize connection communication among the processor 501, the memory 502, and the external communication module 504.
The external communication module 504 is used to receive and forward traffic.
The processor 501 is configured to execute one or more programs stored in the memory 502 to implement the flow control method in the first embodiment and/or the second embodiment.
It will be appreciated that the configuration shown in fig. 5 is merely illustrative and that the network outlet device may include more or fewer components than shown in fig. 5 or may have a different configuration than shown in fig. 5.
The present embodiment also provides a computer-readable storage medium, such as a floppy disk, an optical disk, a hard disk, a flash memory, a usb (universal serial bus) Card, an MMC (Multimedia Card) Card, etc., in which one or more programs implementing the above steps are stored, and the one or more programs can be executed by one or more processors to implement the flow control method in the first embodiment and/or the second embodiment. And will not be described in detail herein.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
In addition, units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
Furthermore, the functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
In this document, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions.
In this context, a plurality means two or more.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (10)

1. A flow control method is applied to a network outlet device, and comprises the following steps:
determining a target node corresponding to the current traffic to be forwarded; the target node is a node which is mapped in the network outlet equipment by the equipment which sends the current traffic to be forwarded;
judging whether the current traffic to be forwarded meets preset forwarding conditions in the target node and each superior node of the target node;
if the current traffic to be forwarded meets preset forwarding conditions in the target node and each superior node of the target node, forwarding the current traffic to be forwarded; otherwise, discarding the current traffic to be forwarded; wherein:
the forwarding conditions of the target node and each upper node except the highest node comprise: in a node, the number of the current residual guarantee tokens does not meet the requirement of forwarding the current flow to be forwarded, the number of the current residual limit tokens meets the requirement of forwarding the current flow to be forwarded, and the number of the limit tokens currently used by the node in the period is smaller than the limit value corresponding to the node; and the limit value corresponding to the node is more than or equal to the total number of the guarantee tokens of the node and less than or equal to the total number of the limit tokens of the node.
2. The flow control method of claim 1, wherein the method further comprises:
if the limit token of the superior node of the node in the previous period is used up, reducing the limit value of the node;
and if the limit token of the upper node of the node is not used completely in the previous period, increasing the limit value of the node.
3. The traffic control method according to claim 1, wherein after determining the target node corresponding to the current traffic to be forwarded, the method further comprises:
determining the traffic priority of the current traffic to be forwarded;
determining a priority coefficient based on the traffic priority; the higher the traffic priority is, the smaller the priority coefficient is, and the priority coefficient is greater than 0 and smaller than 1;
and multiplying the set standard limit value and the priority coefficient to obtain the limit value of the target node.
4. The flow control method according to claim 1, wherein the forwarding conditions of the target node and the upper nodes except the highest node further include:
in a node, the number of the current residual guarantee tokens meets the requirement of forwarding the current traffic to be forwarded, and the current traffic to be forwarded has a first mark; the first mark represents the number of the remaining guarantee tokens at the last node of the node to meet the requirement of forwarding the current traffic to be forwarded; wherein the target node defaults that the current traffic to be forwarded has the first label.
5. The traffic control method according to claim 1, wherein the forwarding condition of the highest-level node includes:
in the node, the current residual quantity of the guarantee tokens does not meet the requirement of forwarding the current flow to be forwarded, and the current residual quantity of the limit tokens meets the requirement of forwarding the current flow to be forwarded.
6. The flow control method of claim 1, wherein, in the same cycle:
the total number of the guarantee tokens of the superior node is more than or equal to the sum of the total number of the guarantee tokens of all the subordinate nodes of the superior node;
the total number of the restriction tokens of the upper node is greater than or equal to the total number of the restriction tokens of any lower node of the upper node.
7. The flow control method according to any one of claims 1 to 6, characterized in that the method further comprises:
when the fact that the number of currently used limiting tokens of any node is larger than a preset packet loss threshold value in the period is monitored, randomly discarding the received traffic to be forwarded corresponding to the node;
and the packet loss threshold is greater than the total number of the guarantee tokens of the node and less than the limit value of the node.
8. A flow control device, disposed on a network outlet device, comprising: a determining module and a processing module;
the determining module is used for determining a target node corresponding to the current flow to be forwarded; the target node is a node which is mapped in the network outlet equipment by the equipment which sends the current traffic to be forwarded;
the processing module is configured to determine whether the current traffic to be forwarded satisfies a preset forwarding condition in the target node and each higher-level node of the target node; if the current traffic to be forwarded meets preset forwarding conditions in the target node and each superior node of the target node, forwarding the current traffic to be forwarded; otherwise, discarding the current traffic to be forwarded; wherein:
the forwarding conditions of the target node and each upper node except the highest node comprise: in a node, the number of the current residual guarantee tokens does not meet the requirement of forwarding the current flow to be forwarded, the number of the current residual limit tokens meets the requirement of forwarding the current flow to be forwarded, and the number of the limit tokens currently used by the node in the period is smaller than the limit value corresponding to the node; and the limit value corresponding to the node is more than or equal to the total number of the guarantee tokens of the node and less than or equal to the total number of the limit tokens of the node.
9. A network egress device, comprising: the system comprises a processor, a memory, an internal communication bus and an external communication module;
the internal communication bus is used for realizing connection communication among the processor, the memory and the external communication module;
the external communication module is used for receiving and forwarding flow;
the processor is configured to execute a program stored in the memory to implement the flow control method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing one or more programs, the one or more programs being executable by one or more processors to implement the flow control method according to any one of claims 1 to 7.
CN202111270970.XA 2021-10-29 2021-10-29 Flow control method and device, electronic equipment and storage medium Pending CN113973342A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111270970.XA CN113973342A (en) 2021-10-29 2021-10-29 Flow control method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111270970.XA CN113973342A (en) 2021-10-29 2021-10-29 Flow control method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113973342A true CN113973342A (en) 2022-01-25

Family

ID=79588926

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111270970.XA Pending CN113973342A (en) 2021-10-29 2021-10-29 Flow control method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113973342A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114979012A (en) * 2022-05-31 2022-08-30 济南浪潮数据技术有限公司 Network flow current limiting method, system, device and computer storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140195688A1 (en) * 2013-01-10 2014-07-10 International Business Machines Corporation Token-based flow control of messages in a parallel computer
CN105939285A (en) * 2015-08-21 2016-09-14 杭州迪普科技有限公司 Message forwarding method and device
CN108667745A (en) * 2017-03-30 2018-10-16 深圳市中兴微电子技术有限公司 A kind of method and apparatus of traffic policing
CN109787915A (en) * 2018-12-14 2019-05-21 北京三快在线科技有限公司 Flow control methods, device, electronic equipment and the storage medium of network access

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140195688A1 (en) * 2013-01-10 2014-07-10 International Business Machines Corporation Token-based flow control of messages in a parallel computer
CN105939285A (en) * 2015-08-21 2016-09-14 杭州迪普科技有限公司 Message forwarding method and device
CN108667745A (en) * 2017-03-30 2018-10-16 深圳市中兴微电子技术有限公司 A kind of method and apparatus of traffic policing
CN109787915A (en) * 2018-12-14 2019-05-21 北京三快在线科技有限公司 Flow control methods, device, electronic equipment and the storage medium of network access

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
冯有存等: "基于MAC层速率调整的无线Mesh网络拥塞控制", 信息技术, no. 01, 25 January 2017 (2017-01-25) *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114979012A (en) * 2022-05-31 2022-08-30 济南浪潮数据技术有限公司 Network flow current limiting method, system, device and computer storage medium

Similar Documents

Publication Publication Date Title
CN106789729B (en) Cache management method and device in network equipment
US7006440B2 (en) Aggregate fair queuing technique in a communications system using a class based queuing architecture
US9112818B1 (en) Enhanced tail dropping in a switch
US7948976B2 (en) Efficient management of queueing resources for switches
US20110310742A1 (en) Guaranteed bandwidth sharing in a traffic shaping system
CN107404443B (en) Queue cache resource control method and device, server and storage medium
CN106330770A (en) Shared cache distribution method and device
US10063478B2 (en) Switching device and control method of switching device
US8989037B2 (en) System for performing data cut-through
WO2018013490A1 (en) Virtual ccap downstream traffic scheduling
CN113162789A (en) Method, device, equipment, system and storage medium for adjusting service level
CN114079638A (en) Data transmission method, device and storage medium of multi-protocol hybrid network
CN108259377A (en) Queue assignment method and device
US10044632B2 (en) Systems and methods for adaptive credit-based flow
CN113973342A (en) Flow control method and device, electronic equipment and storage medium
KR20120055946A (en) Method and apparatus for packet scheduling based on allocating fair bandwidth
CN111131061B (en) Data transmission method and network equipment
US10764191B2 (en) Device and method for managing end-to-end connections
CN111970149A (en) Shared bandwidth realizing method based on hardware firewall QOS
CN113765796B (en) Flow forwarding control method and device
KR20120055947A (en) Method and apparatus for providing Susbscriber-aware per flow
CN115567450A (en) Network equipment
CN109391558B (en) Queue control method and device
CN113453285B (en) Resource adjusting method, device and storage medium
KR101587379B1 (en) Method of dynamic control for queue size and apparatus thereof

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination