Detailed Description
The technical solution in the present application will be described below with reference to the accompanying drawings.
Fig. 1 is a diagram of an example system architecture of a network device that can be applied to an embodiment of the present invention. As shown in fig. 1 (a). The network device may include an input interface module 110 (e.g., a Media Access Control (MAC) module), a Packet Processing (PP) module 120, a Traffic Manager (TM) module 130, and an output interface module 140 (e.g., a Media Access Control (MAC) module). The PP module 120 may be configured to perform processing on a packet in a service flow, as an example, the PP module 120 may perform functions of segmenting the service flow and obtaining each packet, for example, the PP module 120 may be responsible for analyzing, classifying, forwarding, searching and header processing of a received packet, and the PP module 120 may further send a queuing request of the packet to the TM module 130 according to the processing result. TM module 130 may manage the packets in the traffic flow, for example, may perform functions of queuing, discarding, scheduling, and classifying the packets in the traffic flow. The input interface module 110 and the output interface module 140 may also be integrated into one component. The PP module 120 and the TM module 130 may be implemented by hardware, or may be implemented by hardware and software.
The messages in the traffic flow may be transmitted to the network device by the link, and the input interface module 110 (which may also be referred to as a receive Rx module of the network device) in the network device may receive the messages. PP module 120 may then parse the message, and then the message may be enqueued (enqueue) to a traffic shaping queue in TM module 130 for dequeue (dequeue). When the packets in the traffic flow satisfy the dequeue condition, the shaper may perform dequeue enabling, and then the scheduler may schedule the packets in the traffic flow to dequeue. Finally, the message may be sent to the link by the output interface module (also referred to as the Tx module of the network device) 140, and may be transmitted to the next network device on the transmission path. The shaping queues, shapers, and schedulers in TM module 130 may be implemented in hardware or in combination with software.
Optionally, the above service flow may include one or more sub-flows, and the messages of the service flow include the messages of all sub-flows included in the service flow. When a traffic flow includes one sub-flow, the one sub-flow may be regarded as one traffic flow; when a traffic flow includes a plurality of sub-flows, the plurality of sub-flows may be regarded as one traffic flow. For example, as shown in fig. 1(b), the service flow may include sub-flow 1, sub-flow 2, and sub-flow 3, and the packets of the service flow may include packets of sub-flow 1, packets of sub-flow 2, and packets of sub-flow 3. The multiple sub-streams may be buffered in the same or different shaping queues. The multiple sub-flows may have different destinations, for example, and the network device may enqueue the packets in the shaping queue corresponding to the sub-flow according to the identifications of the packets in the sub-flow (e.g., the destinations of the packets).
The embodiment of the invention provides a method for sending a message, which can reduce the jitter of the message in a service flow, better fit the actual transmission condition and reduce the complexity of flow shaping. Embodiments of the present invention are described in detail below with reference to fig. 2-5.
The embodiment of the present invention does not specifically limit the number of network devices in the network and the connection relationship between the network devices. For example, fig. 2 is a schematic structural diagram of a communication system according to an embodiment of the present invention. As shown in fig. 2, the communication system 200 shown in fig. 2 may include a fourth network device (also referred to as simply network device 4)210, a second network device (also referred to as simply network device 2)220, a first network device (also referred to as simply network device 1)230, and a third network device (also referred to as simply network device 3) 240. The fourth network device may be a previous hop network device of the second network device, the second network device may be a previous hop network device of the first network device, and the first network device may be a previous hop network device of the third network device.
The type of the network device mentioned in fig. 2 is not specifically limited in the embodiment of the present invention, and may be, for example, a switch, a router, a hub, a gateway, a bridge, a Network Interface Card (NIC), a Wireless Access Point (WAP), a printer, a modem, an optical fiber transceiver, an optical cable, and the like. Network devices may also sometimes be referred to as network nodes or hops (hops).
Fig. 3 is a schematic flowchart of a method for sending a packet according to an embodiment of the present invention. The method of FIG. 3 may include steps 310-360, and the steps 310-360 are described in detail below.
In step 310, a first network device receives a first packet in a traffic flow from a second network device.
The traffic flow in the embodiment of the present invention may also be sometimes referred to as traffic (traffic).
Optionally, in this embodiment of the present invention, a traffic flow may include at least one sub-flow, and the at least one sub-flow may include the first packet. Before the first network device receives the first packet in the traffic flow from the second network device, the second network device may receive a fifth packet in at least one sub-flow in the traffic flow from the fourth network device. The fifth packet includes a fifth time tag indicating a fifth time at which the fifth packet is allowed to leave a third queue of the fourth network device. The second network device may replace the fifth time tag with the calculated first time to obtain the first packet, and may enqueue the first packet in the first queue of the second network device. The second network device may dequeue the first packet from the first queue, and the second network device may send the first packet to the first network device, such that the time to dequeue the first packet from the first queue is no earlier than the first time.
In this embodiment of the present invention, a first network device may receive a first packet in a service flow from a second network device, where the first packet may include a first time tag. The first time tag may be used to indicate a first time (also referred to as a first eligible time) at which the first packet in the traffic flow is enabled out of a first queue in the second network device by the shaper in order to meet a restriction requirement of traffic shaping (e.g., may be a restriction rate of a sub-flow to which the first packet in the traffic flow belongs).
In step 320, the first network device calculates a second time, replaces the first time tag in the first packet with a second time tag to obtain a second packet, and enqueues the second packet in a second queue of the first network device.
In this embodiment of the present invention, the first network device may receive the first packet sent by the second network device, and before the first network device enqueues the first packet in the second queue of the first network device, the first network device may calculate the second time. After the first time stamp may be replaced with a second time stamp to obtain a second packet, the second packet may be enqueued in a second queue of the first network device.
In this embodiment of the present invention, the second time stamp may be used to indicate a second time (which may also be referred to as a second qualified time) when the second packet in the traffic flow is considered by the shaper to be able to go out of the second queue in the first network device, in order to meet a restriction requirement of traffic shaping (for example, may be a limit rate of a sub-flow to which the second packet in the traffic flow belongs).
The module for calculating the second time of the first network device in the embodiment of the present invention is not specifically limited, and may be any module capable of calculating the qualified time of the first packet in front of the TM module in the network device. As an example, the function of calculating the qualifying time of the first message may be performed by a PP module in the network device. Alternatively, the function of calculating the qualified time of the message may be performed by the TM module.
The method by which the first network device calculates the second qualifying time at step 320 may also be referred to as debounce calculation. Optionally, in some embodiments, the first network device may also calculate the second qualifying time using a flow-by-flow rate limit calculation. The debounce calculation method and the flow-by-flow speed limit calculation method will be described in detail with reference to specific embodiments.
The application scenarios of the above-mentioned two methods for calculating the second qualified time are not specifically limited in the embodiments of the present invention. Referring to fig. 4, as an example, the per-flow rate limit calculation method may be selected at both the edge node and the central node in the network. As another example, the debounce calculation method may be selected at both the edge node and the central node in the network (in which case the sub-streams in the traffic flow may have been shaped using the per-flow rate limit calculation method before reaching the edge node into the network). As another example, the flow-by-flow rate limit calculation method may be selected at an edge node (edge node) in the network, and the debounce calculation method may be selected at a core node (core node) in the network. The former network device can execute the flow-by-flow speed-limiting method, and the latter device can execute the jitter reduction method, so as to realize jitter reduction while respectively shaping the messages in the service flow, thus the quantity of the flow shaping queue and the shaper can get rid of the dependence on the quantity of the sub-flows, and the complexity of the flow shaping is reduced. For example, in fig. 2, the second network device may perform a flow-by-flow rate limit calculation method, and the first network device may perform a debounce calculation method. The previous hop network device can execute the jitter reduction calculation method again by the current device on the basis of executing the jitter reduction calculation method, so that the jitter newly generated when the message is transmitted from the previous hop network device to the current network device can be reduced, and the flow shaping effect of the whole network transmission is improved. For another example, the fourth network device in fig. 2 performs a flow-by-flow speed limit calculation method, and the second network device and the first network device may perform a jitter reduction calculation method. As another example, different calculation methods may also be configured at any node in the network according to the actual needs of the user. For example, in some network nodes, if it is necessary to ensure that the output packet meets the shaping constraint condition and also needs a label with qualified time, a flow-by-flow speed limit calculation method may be selected. For another example, in some network nodes, the sub-streams in the traffic flow all satisfy the shaping constraint and the packets have time tags of the qualified time, then the jitter reduction calculation method may be selected.
In step 330, the first network device receives a third packet in the traffic flow from the second network device.
Optionally, in this embodiment of the present invention, the at least one sub-stream may further include the third packet. Before the first network device receives the third packet in the at least one sub-stream of the traffic flow from the second network device, the second network device may receive a sixth packet in the at least one sub-stream of the traffic flow from the fourth network device. The sixth packet includes a sixth time label indicating a sixth time at which the sixth packet is allowed to leave a third queue of the fourth network device. The second network device may replace the sixth time stamp with the calculated third time to obtain the first packet, and may enqueue the third packet in the first queue of the second network device. The second network device may dequeue the third packet from the first queue, and the second network device may send the third packet to the first network device, such that the time to dequeue the third packet from the first queue is not earlier than the third time.
In this embodiment of the present invention, the first network device may receive, from the second network device, a third packet in the service flow, where the third packet may include a third time tag. The third time tag may be used to indicate a third time (which may also be referred to as a third qualified time) at which the third packet in the traffic flow is considered by the shaper to be able to go out of the first queue in the second network device in order to meet a restriction requirement of traffic shaping (which may be, for example, a restriction rate of a sub-flow to which the third packet in the traffic flow belongs). In step 340, the first network device calculates a fourth time, replaces the third time tag in the third packet with the fourth time tag to obtain a fourth packet, and enqueues the fourth packet in the second queue of the first network device.
In this embodiment of the present invention, the fourth time tag indicates the fourth time for allowing the fourth packet to leave the second queue, a difference between the fourth time and the second time is not less than the maximum transmission delay of the second queue, and the maximum transmission delay of the second queue may be the maximum transmission delay of the transmission delays from the second network device to the first network device of all packets in the service flow queued in the second queue.
The fourth time calculated in step 340 corresponds to the second time calculated in step 320, which may specifically refer to the description of step 320, and is not described herein again.
In step 350, the first network device dequeues the second packet from the second queue, and sends the second packet to the third network device.
The first network device may enable dequeuing of the second packet from the second queue, and may cause the second packet to leave the traffic shaping queue no earlier than the second eligible time. The third network device may receive a second packet sent by the first network device, where the second packet may include a second time tag. The second time tag may be used to indicate a second qualifying time for allowing the second packet to leave a second queue in the first network device.
The first network device dequeuing the second packet from the second queue may include a function to check the time to pass for the second packet, which may be performed by a traffic shaper in the TM module. The method for checking the qualified time of the second packet will be described in detail below with reference to specific embodiments. And after the first network equipment dequeues the second message from the second queue, sending the second message to third network equipment.
In step 360, the first network device dequeues the fourth packet from the second queue, and sends the fourth packet to the third network device.
Step 360 corresponds to step 350, and reference may be specifically made to the description of step 350, which is not described herein again.
In this embodiment of the present invention, the first network device may regard at least one sub-flow passing through the same traffic shaping queue as the same service flow, and shape the service flow by the normalized delay based on the maximized transmission delay. The flow shaping mode reduces the jitter of the messages in the service flow, is more suitable for the actual transmission condition, enables the quantity of the flow shaping queue and the shaper to get rid of the dependence on the quantity of the sub-flows in the service flow, and reduces the complexity of the flow shaping.
The method for checking the qualified time of the packet according to the embodiment of the present invention is described in detail below with reference to specific examples. It should be noted that the example of fig. 5 is merely to help those skilled in the art understand the embodiments of the present invention, and is not intended to limit the embodiments of the present invention to the specific values or specific scenarios illustrated. It will be apparent to those skilled in the art that various equivalent modifications or variations are possible in light of the example given in figure 5, and such modifications or variations also fall within the scope of the embodiments of the invention.
Fig. 5 is a schematic flow chart of checking the message qualification time according to an embodiment of the present invention. Referring to fig. 5, message a may define the following variables:
tel: the time of eligibility of message a in the current network device (current hop, e.g., first network device);
tcur: (current time) current time.
The flow of fig. 5 may include steps 510-540, which are described in detail below.
In step 510: inputting a message a (nth message) in the service flow, wherein a time tag carried by the message a records the qualified time of the message in the current network device (current hop).
In step 520: and comparing the current time with the qualified time of the message A in the current network equipment, and controlling the time of the message A leaving the flow shaping queue. If the current time of message a is greater than or equal to the qualifying time, proceed to step 530. If the current time of the message A is less than the qualified time, the size relationship between the current time of the message A and the qualified time of the message A in the current network equipment is continuously compared.
In step 530: the message A meets the shaping constraint condition, and can leave the flow shaping queue corresponding to the message A by being enabled by the shaper in the TM module.
In step 540: and outputting the message A with the time label (recording the qualified time Tel of the message A in the current network equipment in the time label).
In this embodiment of the present invention, the first network device may regard at least one sub-flow passing through the same traffic shaping queue as the same service flow, and shape the service flow by the normalized delay based on the maximized transmission delay. The flow shaping mode reduces the jitter of the messages in the service flow, is more suitable for the actual transmission condition, enables the quantity of the flow shaping queue and the shaper to get rid of the dependence on the quantity of the sub-flows in the service flow, and reduces the complexity of the flow shaping.
Fig. 6 is a schematic flow chart of one possible implementation of step 340 in fig. 3, and the method of fig. 6 may also be referred to as a debounce calculation method (by which a fourth qualifying time is calculated). The method of FIG. 6 may include steps 610-640, which are described in detail below in relation to steps 610-640, respectively.
In step 610, the larger of the pre-stored transmission delay and the transmission delay of the third packet is taken as the maximum transmission delay.
In this embodiment of the present invention, the pre-stored transmission delay may be the maximum transmission delay among transmission delays from the second network device to the first network device of all the messages in the service flow that have enqueued the second queue before the third message. The transmission delay of the third packet may be, for example, a transmission delay of the third packet from the second network device to the first network device.
In the embodiment of the present invention, there are various specific implementation manners for determining the transmission delay of the third packet, and the specific implementation manner may be any one of the manners for indicating the transmission delay of the third packet from the second network device to the first network device. For example, the transmission delay of the third packet may be a difference between the current time and the third qualified time. Wherein the current time may be a time when the fourth qualifying time is calculated by the first network device.
In the embodiment of the invention, the difference between the current time (namely the time when the fourth time is calculated) and the third time is selected for the transmission delay of the third message, so that the delay condition of the third message can be more accurately reflected.
In step 620, the pre-stored value of the transmission delay is updated to the value of the maximum transmission delay.
In the embodiment of the present invention, the pre-stored value of the transmission delay may be updated to the value of the maximum transmission delay, and may be stored, so as to facilitate comparison and calculation of the next packet. Thus, the first network device can continuously record the maximum transmission delay among the transmission delays of all the packets in the traffic flow enqueued in the second queue on the first network device (transmission delay from the second network device to the first network device).
In step 630, a shaping delay is calculated, where the shaping delay is a difference between the maximum transmission delay and the transmission delay of the third packet.
In this embodiment of the present invention, the shaping delay may be a time length of the fourth packet that needs to be adjusted in the first network device. That is to say, the fourth packet may determine, in the first network device, a time length that needs to be adjusted by the fourth packet according to a time interval between the transmission delay of the third packet and the maximum transmission delay of the third packet that is obtained in advance.
In step 640, the fourth time is calculated according to the shaping delay and a current time, the current time is a time when the fourth time is calculated by the first network device, and a difference between the fourth time and the current time is not less than the shaping delay.
It should be appreciated that if the transmission delay of the third packet is less than the maximum transmission delay (i.e. the time taken by the third packet from the second network device to the first network device is less than the maximum transmission delay, at which time the qualifying time of the third packet needs to be adjusted backwards, and the time for sending the third packet backwards is delayed in order to reduce jitter), a fourth time (which indicates the time at which the fourth packet can leave the second queue) may be calculated based on the shaping delay and the current time (i.e. the time at which the fourth time is calculated by the first network device), and the difference between the fourth time and the current time may be made not less than the shaping delay (i.e. the qualifying time of the packet may be adjusted backwards such that the qualifying time is equal to or later than the sum of the current qualifying time and the length of time that needs to be adjusted). Therefore, the transmission delay of the message of the service flow in the shaping queue can be adjusted to the maximum transmission delay, the delay normalization can be realized, and the jitter of message transmission is reduced.
In the jitter reduction calculation method provided by the embodiment of the present invention, the number of the traffic shaping queues and the shapers in the first network device may not depend on the number of the sub-streams in the service flow entering the first network device. As an example, a shaping queue and a shaper may be configured for the traffic flow, and the same shaping queue and shaper may be used for the sub-flows in the traffic flow. Likewise, the first network device may also set another shaping queue and another shaper for another traffic flow. The other traffic flow may, for example, have a different previous hop device or a different next hop device than the previous traffic flow.
In the embodiment of the invention, the maximum transmission delay is continuously updated in the message transmission process, and the service flow can be shaped by the normalized delay. The flow shaping mode reduces the jitter of the messages in the service flow, is more suitable for the actual transmission condition, can ensure that the quantity of the flow shaping queue and the shaper get rid of the dependence on the quantity of the sub-flows in the service flow, and reduces the complexity of the flow shaping.
The debounce calculation method according to the embodiment of the present invention is described in more detail below with reference to specific examples. It should be noted that the examples of fig. 7-8 are merely intended to assist those skilled in the art in understanding embodiments of the present invention, and are not intended to limit embodiments of the present invention to the specific values or specific contexts illustrated. It will be apparent to those skilled in the art that various equivalent modifications or variations are possible in light of the examples given in figures 7-8, and such modifications or variations are intended to be included within the scope of embodiments of the present invention.
Fig. 7 is a schematic variable diagram of a jitter reduction calculation method according to an embodiment of the present invention, and as shown in fig. 7, in an adjacent network device 2 (a current network device) and a network device 1(a previous hop of the current network device), a message a (an nth message) may define the following variables:
d, Dhop: per-hop delay of message a: the starting point of the time interval is the qualified time t of the message A in the network device 12The end point of the time interval is the qualified time t of the message A in the network device 25;
Dcon: transmission delay of message a: the starting point of the time interval is the qualified time t of the message A in the network device 12The end point of the time interval is the current time t of the message A in the network device 24(calculation of t5Time of day);
ds: delay time of the message a (time that the message a needs to be delayed in the network device 2 in order to satisfy the requirement of the rate limit of the sub-stream of the service flow where the message a is located (for example, the rate limit of the sub-stream is 20 megabits per second (Mbits/s));
dmax: in the module for calculating the qualified time of the message A, the network device 2 calculates the maximum value of the transmission delay (Dcon) of all messages enqueued in the shaping queue before the message A in the service flow;
tcur: (Current time) Current time (t)4);
Tel: the qualified time of the message in the current network equipment;
timestamp: and (4) time labels.
Referring to fig. 7, the transmission delay Dcon (t) of the message a between the network device 1 and the network device 2 may be obtained4-t2) And the maximum value Dmax of the transmission delay of all messages before the message A and the transmission delay Dcon (t) of the message A can be used4-t2) The time interval between the messages A and the network device 2 is the current time t of the message A4Delay Ds (t)5-t4) The message A can be obtained at the network equipment 2Time to pass t5。
Calculation flow of debounce method referring to fig. 8, the flow of fig. 8 may include steps 810-870, which are described in detail below.
In step 810: inputting a message A in the service flow, wherein the time tag carried by the message A records the qualified time of the message in the last-hop network equipment.
In step 820: and reading the qualified time in the time label of the message A and assigning a variable Tel.
In step 830: and measuring the transmission delay Dcon of the message A as Tcur-Tel.
In step 840: the maximum value Dmax of the transmission delay of the update message is max { Dmax, Dcon }.
In step 850: and calculating the delay time Ds of the message A as Dmax-Dcon.
In step 860: and updating the qualified time and the time tag Timestamp ═ Tel ═ Tcur + Ds of the message A.
In step 870: and outputting the message A with the time label (recording the qualified time Tel of the message A in the network equipment 2 in the time label).
Optionally, in some embodiments, a difference between the third time and the first time is not less than a maximum transmission delay of the first queue, where the maximum transmission delay of the first queue is a maximum transmission delay of transmission delays of all packets in the traffic flow enqueued in the first queue from a last-hop network device of the second network device to the second network device (which is equivalent to that the first packet and the third packet have been subjected to traffic shaping in the first network device through a jitter reduction calculation method).
In this embodiment of the present invention, before the first network device receives the first packet and the third packet in the service flow from the second network device, the first packet and the third packet have already performed, in the second network device, traffic shaping based on a jitter reduction calculation method. In the technical scheme, the first network device performs jitter reduction and flow shaping, so that the jitter newly generated when the message is transmitted from the last-hop network device (namely, the second network device) to the first network device can be reduced.
Optionally, in some embodiments, the traffic flow includes at least one sub-flow, where the at least one sub-flow includes the first packet and the third packet, and a difference between the third time and the first time is not less than an expected transmission time of the first packet from the second network device to the first network device at a limiting rate of the sub-flow where the first packet and the third packet are located (which is equivalent to that the first packet and the third packet in one sub-flow have been subjected to traffic shaping in the first network device by a flow-by-flow rate-limiting calculation method).
In this embodiment of the present invention, before the first network device receives the first packet and the third packet in one sub-flow of the service flow from the second network device, the first packet and the third packet have performed flow shaping based on a flow-by-flow speed limit calculation method in the second network device. The method can realize the respective shaping of the messages in the service flow, and simultaneously ensure that the quantity of the flow shaping queue and the shaper get rid of the dependence on the quantity of the sub-flows, thereby reducing the complexity of the flow shaping.
In this embodiment of the present invention, before receiving the first packet and the third packet sent by the second network device, the first network device may further receive a fifth packet and a sixth packet sent by the fourth network device, and the second network device may perform shaping processing on the fifth packet and the sixth packet by using a flow-by-flow speed limit calculation method, so as to obtain the first qualified time of the first packet and the third qualified time of the third packet.
Fig. 9 is a schematic flow chart of a possible implementation manner of the flow-by-flow speed limit calculation method according to the embodiment of the present invention, where the method of fig. 9 may include steps 910-930, and the steps 910-930 are described in detail below.
In the flow-by-flow speed limit calculation method according to the embodiment of the present invention, the message received by the network device may or may not include a time tag. When the time label is included, the network device replaces the original time label included in the message with a new time label indicating the new qualified time after calculating the new qualified time so as to obtain the message sent to the next hop network device. When the time tag is not included, the network device adds a new time tag indicating the new qualified time to the message after calculating the new qualified time to obtain the message sent to the next hop network device.
It should be understood that the traffic flow may include at least one sub-flow, and the network device may set a shaping queue and a shaper for each sub-flow in the traffic flow when performing the flow-by-flow rate-limiting calculation method, so as to shape the traffic of each sub-flow according to the limiting rate of each sub-flow respectively.
In step 910, the second network device receives a fifth packet in the at least one sub-flow from the fourth network device.
In this embodiment of the present invention, before the first network device receives the first packet in at least one sub-stream from the second network device, the second network device may first receive a fifth packet in the at least one sub-stream from the fourth network device. The fifth packet may include a fifth time tag indicating a fifth time at which the fifth packet is allowed to leave a third queue in the fourth network device.
In step 920, the second network device calculates the first time, replaces the fifth time tag in the fifth packet with the first time tag to obtain the first packet, and enqueues the first packet in the first queue of the second network device.
In this embodiment of the present invention, the second network device may receive the fifth packet sent by the fourth network device, and before the second network device enqueues the fifth packet in the first queue of the second network device, the second network device may calculate the first time. After the fifth time stamp may be replaced with the first time stamp to obtain the first packet, the first packet may be enqueued in the first queue of the second network device.
In step 930, the second network device receives a sixth packet in the at least one sub-flow from the fourth network device.
In this embodiment of the present invention, before the first network device receives the third packet in the at least one sub-stream from the second network device, the second network device may first receive a sixth packet in the at least one sub-stream from the fourth network device. The sixth packet may include a sixth time label indicating a sixth time at which the sixth packet is allowed to leave the third queue in the fourth network device.
In this embodiment of the present invention, a difference between a fifth time corresponding to a fifth packet and a sixth time corresponding to a sixth packet in at least one sub-stream received by a second network device from a fourth network device is not less than an expected transmission time of the fifth packet from the fourth network device to the second network device at a rate limited by the at least one sub-stream. In other words, for the fifth packet and the sixth packet in the same sub-stream, the time interval between the fifth time corresponding to the fifth packet and the sixth time corresponding to the sixth packet may be measured. If the time interval is less than the expected transmission time of the fifth packet from the fourth network device to the second network device at the sub-flow rate limit, the sixth time may be adjusted such that the time interval between the sixth time and the fifth time is greater than the expected transmission time of the fifth packet from the fourth network device to the second network device at the sub-flow rate limit (at this time, the fifth packet and the sixth packet may satisfy the sub-flow rate limit).
In step 940, the second network device calculates the third time, replaces the sixth time tag in the sixth packet with the second time tag to obtain the second packet, and enqueues the second packet in the first queue of the second network device.
In this embodiment of the present invention, the second network device may receive the sixth packet sent by the fourth network device, and before the second network device enqueues the sixth packet in the first queue of the second network device, the second network device may calculate the third time. After the sixth time stamp may be replaced with the third time stamp to obtain the third packet, the third packet may be enqueued in the first queue of the second network device.
In this embodiment of the present invention, a difference between a first time corresponding to a first packet and a third time corresponding to a third packet in at least one sub-stream calculated by a second network device is not less than an expected transmission time of the first packet from the second network device to the first network device at a rate limited by the at least one sub-stream. In other words, for a first packet and a third packet in the same sub-stream, a time interval between a first time corresponding to the first packet and a third time corresponding to the third packet may be measured. If the time interval is less than the expected transmission time of the first packet from the second network device to the first network device at the rate limit of the sub-stream, the third time may be adjusted such that the time interval between the third time and the first time is greater than the expected transmission time of the first packet from the second network device to the first network device at the rate limit of the sub-stream (at which point the first packet and the third packet may satisfy the rate limit of the sub-stream).
In step 950, the second network device dequeues the first packet from the first queue and sends the first packet to the first network device.
The second network device may enable dequeuing of the first packet from the first queue, and may cause the first packet to leave the first queue no earlier than a first qualifying time of the second packet in the second network device. The first network device may receive a first packet sent by the second network device, where the first packet may include a first time tag. The first time tag may be used to indicate a first qualifying time to allow the first packet to leave a first queue in a second network device.
In step 960, the second network device dequeues the third packet from the first queue and sends the third packet to the first network device.
The second network device may enable dequeuing of the third packet from the first queue, and may cause the third packet to leave the first queue no earlier than a third qualified time of the third packet in the second network device. The first network device may receive a third packet sent by the second network device, where the third packet may include a third time tag. The third time tag may be used to indicate a third qualified time for allowing the third packet to leave the first queue in the second network device.
In the embodiment of the invention, the limiting rate of each sub-stream can be maintained by a flow-by-flow rate-limiting calculation method, the qualified time of the messages is delayed, and the messages of each sub-stream in the service flow can meet the constraint condition of the limiting rate of each sub-stream. And the qualified time of the message in the current network equipment can be recorded on the time label of the message, so that reference can be provided for the subsequent use of a jitter reduction calculation method.
The flow-by-flow speed limit calculation method according to the embodiment of the present invention will be described in more detail with reference to specific examples. It should be noted that the examples of fig. 10-11 are merely intended to assist those skilled in the art in understanding embodiments of the present invention, and are not intended to limit embodiments of the present invention to the specific values or specific scenarios illustrated. It will be apparent to those skilled in the art that various equivalent modifications or variations are possible in light of the examples given in figures 10-11, and such modifications or variations are intended to be included within the scope of embodiments of the present invention.
Fig. 10 is a schematic diagram of variables of a flow-by-flow speed limit calculation method according to an embodiment of the present invention, as shown in fig. 10, in an nth packet and an n-1 st packet of a service flow, the nth packet and the n-1 st packet belong to adjacent packets in a same sub-flow, and the nth packet may define the following variables:
r: limiting the speed of the sub-flow to which the nth message and the (n-1) th message belong in the service flow;
l: the length of the message (the length of the nth message is denoted as Ln);
de: the interval between the qualified time of the n-1 th message and the qualified time of the n-th message (when n is less than or equal to 1, De is 0);
and Dt: the transmission time of the nth message transmitted at the limited rate of the service flow where the nth message is located (when n is less than or equal to 0, Dt is 0), and Dt (n-1) is represented as Dt corresponding to the nth-1 message;
and Dg: a time interval from the qualified time of the (n-1) th message to the arrival time of the (n) th message (when n is less than or equal to 1, Dg is 0);
tel-pre: the previous adjacent message (n-1 message) of the nth message is in the qualified time of the current network device (if n is 1, Tel-pre is 0);
tel: the qualified time of the nth message in the current network equipment;
tcur: (current time) current time;
timestamp: and (4) time labels.
Referring to fig. 10, the time when the qualification time of the nth packet is calculated, i.e., the current time Tcur, may be obtained, Dg between the nth packet and the n-1 th packet may be measured, and if Dg < Dt (n-1), the current time Tcur of the nth packet may be delayed by a period of time (delay time Ds) such that the interval between the qualification times of the n-1 th packet and the nth packet is greater than or equal to the transmission time of the n-1 th packet at the limiting rate of the sub-stream, i.e.,: de ≧ Dg + Ds ≧ Dt (n-1).
Flow of calculation of the flow-by-flow rate limiting method referring to fig. 11, the flow of fig. 11 may include steps 1110-1180, which are described in detail below.
In step 1110: message a (nth message) in the incoming traffic stream, which may be time-stamped.
In step 1120: judging the size of n, if n is not equal to 1 (not the first message in the service flow), going to step 1130, if n is equal to 1 (message a is the first message in the service flow), going to step 640.
In step 1130: the interval Dg between the qualified time of the previous message (n-1 th message) of the message a and the arrival time of the message a (n-th message) is calculated as Tcur-Tel-pre.
In step 1140: and calculating the delay time Ds of the message A as max {0, Dt-Dg } (the initial value of Dt is 0, and the Dt at the moment is the Dt value of the previous message of the message A).
In step 1150: and calculating the qualified time and the time label Timestamp ═ Tel ═ Tcur + Ds of the message A.
In step 1160: the qualifying time Tel-pre ═ Tel (Dg used to calculate the next message of message a) for message a is stored.
In step 1170: and calculating and storing the transmission time Dt of the message A at the limiting rate of the sub-flow, namely Ln/r (Ds for calculating the next message of the message A).
In step 1180: and outputting the message A with the time label (recording the qualified time Tel of the message A in the current network equipment in the time label, replacing the existing time label when the arrived message comprises the time label, and adding the time label when the arrived message does not comprise the time label).
The method for sending a packet according to the embodiment of the present invention is described in detail above with reference to fig. 3 to 11, and the network device according to the embodiment of the present invention is described in detail below with reference to fig. 12 to 13.
Fig. 12 is a schematic structural diagram of a first network device according to an embodiment of the present invention. The first network device 1200 in fig. 12 may execute the method for sending a message described in any of fig. 3-11. The first network device 1200 of fig. 12 may include an input interface module 1201, a message processing module 1202, a traffic management module 1203, and an output interface module 1204. The input interface module 1201 may be, for example, the input interface module 110 in fig. 1, the message processing module 1202 may be, for example, the message processing module 120 in fig. 1, the traffic management module 1203 may be, for example, the traffic management module 130 in fig. 1, and the output interface module 1204 may be, for example, the output interface module 140 in fig. 1.
The input interface module 1201 may be configured to receive a first packet in a traffic flow from a second network device, where the first packet includes a first time tag indicating a first time at which the first packet is allowed to leave a first queue of the second network device.
The input interface module 1201 is further configured to receive a third packet in a traffic flow from the second network device, where the third packet includes a third time tag, and the third time tag indicates a third time when the third packet is allowed to leave the first queue of the second network device.
The message processing module 1202 may be configured to calculate a second time, and replace the first time tag in the first message with a second time tag to obtain a second message.
The message processing module 1202 may be further configured to calculate a fourth time, and replace the third time tag in the third message with the fourth time tag to obtain a fourth message.
Traffic management module 1203 may be configured to enqueue the second packet in a second queue of the first network device, where the second time tag indicates the second time at which the second packet is allowed to leave the second queue.
The traffic management module 1203 may be further configured to enqueue the fourth packet in the second queue of the first network device, where the fourth time tag indicates a fourth time that the fourth packet is allowed to leave the second queue, a difference between the fourth time and the second time is not less than a maximum transmission delay of the second queue, and the maximum transmission delay of the second queue is a maximum transmission delay of transmission delays from the second network device to the first network device of all packets in the service flow enqueued in the second queue.
The output interface module 1204 may be configured to dequeue the second packet from the second queue and send the second packet to the third network device, where the time for dequeuing the second packet from the second queue is not earlier than the second time.
The input interface module 1204 may be further configured to dequeue, by the first network device, the fourth packet from the second queue and send the fourth packet to the third network device, where the time for dequeuing the fourth packet from the second queue is not earlier than the fourth time.
Fig. 13 is a schematic structural diagram of a network device according to an embodiment of the present invention. The network device 1300 in fig. 13 may execute the method for sending a packet described in any of fig. 3-11. Network device 1300 of fig. 13 may include memory 1301 and processor 1302. Memory 1301 may be used to store programs. A processor 1302 may be used to execute programs stored in the memory. When the program stored in the memory 1301 is executed, the processor 1302 may be configured to perform the method for sending a message described in any of the above embodiments.
In the above embodiments, all or part of the implementation may be realized by software, hardware, firmware or any other combination. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored on a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website, computer, server, or data center to another website, computer, server, or data center via wire (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a Digital Video Disk (DVD)), or a semiconductor medium (e.g., a Solid State Disk (SSD)), among others.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, 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 through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The 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.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.