Disclosure of Invention
The present disclosure provides a message forwarding control method and device, which are used to solve the technical problem of too high packet loss rate when a link is congested.
Based on one aspect of the present disclosure, a method for controlling packet forwarding is provided, where the method includes:
when a link is congested and a message is judged to be discarded, acquiring a current forwarding mode of a message flow to which the message belongs;
if the current forwarding mode is a store-and-forward (SAF) mode, switching the current forwarding mode into a straight-through forwarding (CT) mode, and starting monitoring a message discarding event;
and when the condition that no message discarding event occurs within the preset time length threshold is monitored, switching the current forwarding mode back to the storage forwarding SAF mode.
Based on an aspect of the present disclosure, further, the determination that the packet needs to be discarded is a determination made when congestion avoidance processing at a physical port level in a hierarchical quality of service HQoS model is performed; the monitoring of the message discarding event is started by starting the monitoring of the message discarding event on the message flow to which the message belongs and/or the physical port to which the message belongs.
Based on an aspect of the disclosure, further, the method further includes:
when the current forwarding mode is judged to be a store-and-forward (SAF) mode, continuously judging whether the message receiving rate of a current receiving port Rx of the message stream to which the message belongs is greater than the message sending rate of a sending port Tx; if yes, the step of switching the current forwarding mode to a straight-through forwarding CT mode is executed, and the message is discarded; and if not, directly discarding the message.
Based on an aspect of the disclosure, further, the method further includes:
when the link is congested and the message is judged not to be discarded, judging the current forwarding mode of the message flow to which the message belongs;
if the message is in the storage forwarding SAF mode, carrying out physical layer fault packet inspection when the end identifier EOF of the message is judged to be set, and then, queuing the message;
and if the mode is a straight-through forwarding CT mode, directly queuing the message.
Based on an aspect of the present disclosure, the present disclosure further provides a packet forwarding control apparatus, which is applied in a transmission management unit TM of a forwarding plane of a data communication device, and the apparatus includes:
a forwarding mode judging unit, configured to, when a link is congested and a packet needs to be discarded, obtain a current forwarding mode of a packet flow to which the packet belongs;
a mode switching unit, configured to switch the current forwarding mode to a cut-through forwarding CT mode when the forwarding mode determination unit determines that the current forwarding mode is the store-and-forward SAF mode;
the monitoring unit is used for starting monitoring of a message discarding event when the mode switching unit completes the switching from the storage forwarding SAF mode to the direct forwarding CT mode;
and the mode switching-back unit is used for switching the current forwarding mode back to the storage forwarding SAF mode when the monitoring unit monitors that no message discarding event occurs within the preset time threshold.
Based on an aspect of the present disclosure, further, the transmission management unit TM performs congestion avoidance processing using a hierarchical quality of service HQoS model, where the determination that the determination packet needs to be discarded is a determination made when congestion avoidance processing at a physical port level in the hierarchical quality of service HQoS model is performed;
the monitoring unit starts monitoring the message discarding event refers to starting monitoring the message discarding event on the message flow to which the message belongs and/or the physical port to which the message belongs.
Based on an aspect of the disclosure, further, the apparatus further includes:
when the mode switching unit judges that the current forwarding mode is the store-and-forward (SAF) mode, the mode switching unit is also used for continuously judging whether the message receiving rate of the current receiving port Rx of the message stream to which the message belongs is greater than the message sending rate of the sending port Tx;
if yes, the step of switching the current forwarding mode to a straight-through forwarding CT mode is executed, and the message is discarded; and if not, directly discarding the message.
Based on an aspect of the disclosure, further, the apparatus further includes:
a pre-processing unit, configured to determine, when the forwarding mode determining unit determines that the packet does not need to be discarded when the link is congested, a current forwarding mode of a packet flow to which the packet belongs;
if the SAF mode is judged to be the store-and-forward mode, the method is also used for triggering physical layer fault packet inspection operation when the end identifier EOF of the message is set;
and if the mode is judged to be the straight-through forwarding CT mode, the method is also used for directly queuing the messages.
Based on an aspect of the present disclosure, the present disclosure also provides a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the above message forwarding control method.
Based on an aspect of the present disclosure, the present disclosure further provides a data communication device, where a forwarding plane of the data communication device includes the forwarding control apparatus.
According to the technical scheme, the forwarding mode is switched to the CT mode when the traffic congestion starts to occur, so that the advantage of high bandwidth utilization rate of the forwarding mode is fully utilized, and the packet loss caused by link congestion is reduced.
Detailed Description
The terminology used in the embodiments of the present disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the embodiments of the present disclosure. As used in the disclosed embodiments and claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. The term "and/or" as used herein is meant to encompass any and all possible combinations of one or more of the associated listed items.
It is to be understood that although the terms first, second, third, etc. may be used herein to describe various information in the embodiments of the present disclosure, such information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of embodiments of the present disclosure. Depending on the context, moreover, the word "if" as used may be interpreted as "at … …" or "when … …" or "in response to a determination".
The inventor carefully analyzes the cause of the TCP incast problem, and finds that, from the perspective of device forwarding, the nature of the TCP incast problem is that packet loss occurs due to queue buffer overflow caused by traffic burst.
Currently, there are 2 forwarding modes of data communication equipment: a Cut-Through forwarding mode (CT mode for short) And a Store And Forward mode (SAF mode for short). By analyzing the underlying forwarding logic of the CT mode and the SAF mode, the CT mode has relatively low requirement on the length of the queue, and the problem of traffic burst similar to TCPincast can be relieved.
TABLE 1
Table 1 is a schematic diagram of a processing mode when a SAF mode forwards a long packet and a short packet, and when a time slice 1 is started, a port1 and a port2 enter a short packet a and a long packet B, respectively, and both of the two are ports 3, and an outlet scheduling sequence is that a is sent first and then B is sent second. In the Store and Forward mode, the A message can be sent only when the time slice 2 is reached, because the A message is received only when the time slice 2 is reached; similarly, the B message can be sent only by time slice 4, since the a message is received only by time slice 4, it is obvious that the bandwidth of the time period of time slice 3 is wasted.
TABLE 2
Table 2 is a schematic diagram of a processing mode when a CT mode forwards a long packet and a short packet, and in the Cut-Through mode, there is no problem of wasting a time slice bandwidth, especially in a scenario where a large packet occupancy ratio is high, for example: in the distributed computing of image recognition, the model of each interaction reaches G bytes, the interactive message length between distributed computing servers is larger and larger, and the characteristic of large-packet interaction is obvious.
At present, data communication equipment services are complex, some services may need message information of a higher-layer protocol L3/L4 when forwarding decisions are made, and if tunnel-type services are superimposed, the support degree of a Cut-Through mode to the services is obviously inferior to that of Store and Forward, so that the current mainstream forwarding mode is Store and Forward.
In order to solve the technical problem that when a link is congested, a packet loss ratio is too high, which causes unstable service, service delay or even interruption, fig. 1 is a schematic flow diagram of a packet forwarding control method provided in an embodiment of the present disclosure, where the method is applied to a packet forwarding device, such as a switch, a router, or a server with a packet forwarding function, and the method includes:
s101, when a link is congested and a message is judged to need to be discarded, acquiring a current forwarding mode of a message flow to which the message belongs;
s102, if the current forwarding mode is a store-and-forward (SAF) mode, switching the current forwarding mode into a direct forwarding (CT) mode, and starting monitoring a message discarding event;
s103, when it is monitored that no message discarding event occurs within the preset time threshold, switching the current forwarding mode back to the store and forward (SAF) mode.
The message forwarding control method provided by the embodiment of the present disclosure improves a forwarding control mechanism of a message when a link is congested, and triggers a forwarding mode of a flow to which the message belongs to switch from an SAF mode to a CT mode when a congestion avoidance mechanism (e.g., WRED) determines that the message needs to be discarded, where the flow is defined as a series of messages belonging to the same forwarding path from an ingress port to an egress port from a forwarding path perspective. In another embodiment of the present disclosure, the determination that a packet needs to be discarded is a determination made during congestion avoidance processing at a physical Port level (e.g., Port and/or Interface) in the hierarchical quality of service HQoS model.
The embodiment of the present disclosure starts the mode switching operation at the moment when congestion just occurs, and simultaneously starts the watchdog monitoring process, monitors a "discard event" that is a message discarding event for the message stream or the physical port where the message stream is located, and switches the forwarding mode of the message stream back to the SAF mode when it is monitored that the message discarding event does not occur within a predetermined time threshold. Through the processing, when the traffic congestion starts to occur, the forwarding mode is switched to the CT mode, so that the advantage of higher bandwidth utilization rate of the forwarding mode is fully utilized, and the further increase of the congestion degree is relieved. Because the physical layer error packet is easy to spread to other devices in the CT mode, the forwarding mode of the message stream is switched back to the SAF mode after the traffic congestion is relieved. The method can fully utilize the advantages of the two forwarding modes, so that a packet loss curve of a congestion avoidance mechanism becomes smoother, and the condition of throughput reduction caused by packet loss in a scene similar to TCP incast is relieved.
Fig. 2 is a schematic diagram of a forwarding plane module of a data communication device according to an embodiment of the present disclosure, which illustrates an improvement made to a forwarding plane of a communication device. The present disclosure is primarily directed to improving the functionality of the transmission management unit TM in the forwarding plane of a data communication device, and is described below in conjunction with other elements of the forwarding plane.
Firstly, a message enters a message receiving unit Rx in a frame form, the message receiving unit Rx sends the received frame to a resource management unit RM, the RM stores the message, and meanwhile, a data frame is organized in a buffer chain form with a fixed length. When the first buffer area first buffer of the message is ready, the RM unit generates a message unique identifier PID and sends the PID to a message analysis unit PA, and the PA unit analyzes the message characteristics. After the analysis is finished, the PA unit sends the PID to the message scheduling unit PQA to prepare for scheduling to the message processing unit PP for processing. After the PP unit finishes processing the message, the message content is modified to the RM unit, and meanwhile, the PQA unit is informed of finishing the processing and the message can be sent. Before sending, the message is firstly processed with order-preserving operation by the order-preserving unit OU, and finally sent to the transmission management TM unit.
In this embodiment, the TM unit is additionally provided with the message forwarding control function in steps S101 to S103, so as to implement switching of the forwarding mode under the condition of link congestion, and perform a switch-back operation of the forwarding mode after the link congestion is relieved.
The packet forwarding control function in steps S101-S103 in the above embodiment is triggered by a packet loss event of a congestion avoidance mechanism in the TM, but considering that there are multiple congestion avoidance processing measures in a Hierarchical Quality of service (HQoS) model in a TM subunit, where is the packet forwarding control function touched? Further detailed analysis of the congestion avoidance mechanism in conjunction with TM is required.
The HQoS model divides the congestion avoidance processing hierarchy into 6 levels, which are:
the first stage performs congestion avoidance processing for one type of traffic that may correspond to a certain user (e.g., virtual local area network V L AN, label switched path L SP, permanent virtual circuit PVC, etc.).
The second level is for Class: the congestion avoidance processing can be performed for all services of a certain user.
Third level for sub port subpart: the congestion avoidance process may be performed for a group of users (e.g., all gold users).
The fourth stage is for Port: congestion avoidance processing may be performed on the corresponding physical port.
The fifth level is for the Interface: congestion avoidance processing may be performed on the corresponding interface.
Level six for Global: global congestion avoidance processing may be performed for the TM unit.
Because the present disclosure mainly solves the problem of packet loss of an output Port queue caused by traffic burst, the embodiment of the present disclosure selects the packet forwarding control function in fig. 1 at a physical Port level, i.e., a Port level or an Interface level, when performing congestion avoidance processing, so as to avoid excessive packet loss caused by overflow of an output Port queue packet when a link is congested due to traffic burst.
Fig. 3 is a schematic flow chart illustrating a process of performing packet forwarding control in a transmission management unit TM in an implementation of the present disclosure, where the method includes:
step 301, when the physical port level performs congestion avoidance processing based on the service quality, it is determined whether the packet needs to be discarded, if so, thestep 302 is performed, otherwise, thestep 310 is performed.
Taking an HQoS model as an example, after a packet PID enters TM for processing, the packet PID enters Port and Interface levels for congestion avoidance processing after Flow, Class and subpart three-level HQoS processing, and the methods for performing packet forwarding control processing based on the Flow of fig. 1 at the Port level and the Interface level are completely the same. Where it is determined whether the PID is determined by the congestion avoidance mechanism to be discard to be discarded, and subsequent processing is performed based on the determination result.
Step 302, judging whether the current forwarding mode of the flow to which the message belongs is a store and forward mode SAF, if so, executingstep 303, otherwise, executingstep 307.
If the current mode is not the SAF mode, it indicates that the mode is switched to the CT mode, and in this case, it is determined that the packet is lost, and only the packet is lost.
Step 303, determining whether the message receiving rate of the current receiving port Rx of the flow to which the message belongs is greater than the message sending rate of the sending port Tx, if so, executingstep 304, and if not, executingstep 307.
If the current is the SAF mode, it needs to further determine whether the Rx interface rate of the stream to which the message belongs is greater than the Tx interface rate, if so, the forwarding mode of the stream to which the message belongs is switched to the CT mode, otherwise, the forwarding mode cannot be switched, and the SAF mode is still maintained, so as to prevent the Tx from sending residual packets that have not been completely received, and at this time, the message can only be discarded.
And step 304, switching the current forwarding mode of the flow to which the message belongs to a straight-through forwarding CT mode, starting a monitoring task and discarding the message.
When the mode is switched to the CT mode, it is necessary to start a monitoring task to monitor how long a packet is discarded based on the congestion avoidance mechanism of the HQoS for the stream and/or the physical port (e.g., port, interface) to which the packet belongs, for example, start watchdog program loop detection, and if the predetermined time threshold is exceeded, for example, within 1 second, switch the forwarding mode of the stream to which the packet belongs back to the store-and-forward SAF mode.
Step 305, a monitoring task monitors whether a message is discarded within a specified time threshold? If there are still messages to be discarded, the monitoring is continued, and if there are no messages to be discarded,step 306 is executed.
In the CT mode, if no packet drop is detected within the predetermined time threshold, it indicates that the packet congestion of the packet belonging stream and/or the physical port where the packet belonging stream belongs to is already relieved, and the SAF mode can be switched back.
Step 306, switching the forwarding mode of the current message flow back to the SAF mode.
Untilstep 306, the complete SAF mode to CT mode is completed, and then the SAF mode is switched back to SAF mode from CT mode. After switching back to the SAF mode, when the message is received again and it is determined that the link is congested,step 301 is performed again.
Step 310, when the physical port level performs congestion avoidance processing based on the service quality, if it is not currently determined that there is a message discard, then it is further determined whether the current mode is an SAF mode, if so,step 311 is executed, otherwise,step 313 is executed.
If the current forwarding mode of the flow to which the message belongs is the CT mode, the current forwarding mode indicates that the current forwarding mode is the processing process after the CT mode is switched, and the current forwarding mode can be directly queued to wait for scheduling.
Step 311, judging whether the end of message flag EOF corresponding to PID is set to 1, if yes, executingstep 312, otherwise, circularly waiting for the flag bit to be set to 1;
step 312, after determining that the EOF of the packet corresponding to the PID is set to 1, performing packet physical layer error check, and then executingstep 313.
And 313, sending the message corresponding to the PID into a message queue to wait for scheduling.
The embodiment provided by the disclosure can realize that immediately when interface congestion starts to occur, a condition triggers and switches the current forwarding mode to the straight-through forwarding CT mode to accelerate the sending efficiency of the message, and compared with the existing congestion avoidance mechanism, such as WRED mechanism, the direct packet loss strategy is smoother, and the problem of throughput reduction caused by packet loss similar to TCP-incast can be improved.
Another embodiment of the present disclosure provides a packet forwarding control apparatus, which is applied to a transmission management unit TM of a forwarding plane of a data communication device, and the apparatus includes:
and the forwarding mode judging unit is used for acquiring the current forwarding mode of the message flow to which the message belongs when the link is congested and the message is judged to need to be discarded.
And the mode switching unit is used for switching the current forwarding mode into the cut-through forwarding CT mode when the forwarding mode judging unit judges that the current forwarding mode is the store-and-forward SAF mode.
The monitoring unit is used for starting monitoring of a message discarding event when the mode switching unit completes switching from the storage forwarding SAF mode to the direct forwarding CT mode;
and the mode switching-back unit is used for switching the current forwarding mode back to the storage forwarding SAF mode when the monitoring unit monitors that no message discarding event occurs within the preset time threshold.
Based on the foregoing embodiment, in another embodiment of the present disclosure, the transmission management unit TM performs congestion avoidance processing using a hierarchical quality of service HQoS model, where the determination that the determination packet needs to be discarded is a determination made when congestion avoidance processing at a physical port level in the hierarchical quality of service HQoS model is performed; the monitoring unit starts monitoring the message discarding event refers to starting monitoring the message discarding event on the message flow to which the message belongs and/or the physical port on which the message flow to which the message belongs.
Based on the foregoing embodiment, in another embodiment of the present disclosure, when determining that the current forwarding mode is the store and forward SAF mode, the mode switching unit is further configured to continue to determine whether a message receiving rate of a current receiving port Rx of a message stream to which the message belongs is greater than a message sending rate of a sending port Tx. If yes, the step of switching the current forwarding mode to a straight-through forwarding CT mode is executed, and the message is discarded; and if not, directly discarding the message.
Based on the foregoing embodiment, in another embodiment of the present disclosure, the packet forwarding control apparatus further includes:
a pre-processing unit, configured to determine, when the forwarding mode determining unit determines that the packet does not need to be discarded when the link is congested, a current forwarding mode of a packet flow to which the packet belongs; if the SAF mode is judged to be the store-and-forward mode, the method is also used for triggering physical layer fault packet inspection operation when the end identifier EOF of the message is set; and if the mode is judged to be the straight-through forwarding CT mode, the method is also used for directly queuing the messages.
The above description is only an example of the present disclosure and is not intended to limit the present disclosure. Various modifications and variations of this disclosure will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present disclosure should be included in the scope of the claims of the present disclosure.