Example 1
An embodiment of the present invention provides a method for scheduling a variable length message flow control service, as shown in fig. 1, where the method includes:
step 101, determining a time interval between messages according to a preset message fixed length and a configuration bandwidth, and scheduling calculation of actual sending time of a next message according to the time interval;
optionally, determining an actual arrival time of the current packet and an expected arrival time of the current packet;
judging whether the actual arrival time of the current message is greater than the sum of the expected arrival time of the current message and a message arrival time tolerance value;
when the actual arrival time of the current message is greater than the sum of the expected arrival time of the current message and the message arrival time tolerance value, determining the actual sending time of the next message as the actual arrival time of the current message;
when the actual arrival time of the current message is not more than the sum of the expected arrival time of the current message and the message arrival time tolerance value, judging whether the actual arrival time of the current message is more than the difference between the expected arrival time of the current message and the message arrival time tolerance value;
when the actual arrival time of the current message is larger than the difference between the expected arrival time of the current message and the message arrival time tolerance value, determining the actual sending time of the next message as the actual arrival time of the current message;
and when the actual arrival time of the current message is not more than the difference between the expected arrival time of the current message and the tolerance value of the message arrival time, determining the actual sending time of the next message as the expected arrival time of the current message.
102, acquiring the actual length of the received current message, and determining a time increment according to the actual length and the time interval;
optionally, a time increment is determined according to X-L2 × T/L1, where X is the time increment, L2 is the actual length of the received current packet, T is the time interval between the determined packets, and L1 is the fixed length of the preset packet.
And 103, updating the expected time of the next message according to the time increment, and sending the next message according to the actual sending time.
Optionally, determining an actual arrival time of the current packet and an expected arrival time of the current packet;
judging whether the expected time of the current message arrival is greater than the actual arrival time;
when the expected time of the current message arrival is greater than the actual arrival time, updating the expected time of the next message arrival to be the sum of the time arrival time and the time increment;
and when the expected time of the arrival of the current message is not more than the actual arrival time, updating the expected time of the arrival of the next message to be the sum of the expected time of the arrival of the current message and the time increment.
The embodiment of the invention provides a method for scheduling variable-length message flow control service, which determines the time interval between messages according to the preset message fixed length and the configuration bandwidth, and schedules the calculation of the actual sending time of the next message according to the time interval; acquiring the actual length of the received current message, and determining a time increment according to the actual length and the time interval; and updating the expected time of the next message according to the time increment, and sending the next message according to the actual sending time. Compared with the prior art that when scheduling is performed based on the scheduling method of the credit leaky bucket, due to the fact that scheduling performance is affected by the total bandwidth, the total configured bandwidth is often tens of times of the source flow specification, and therefore when the design specification is determined, resources consumed by the credit leaky bucket are much lower.
An embodiment of the present invention provides a device for scheduling a variable length message flow control service, as shown in fig. 2, the device includes: a calculation unit 201, an acquisition unit 202, an update unit 203;
a calculating unit 201, configured to determine a time interval between messages according to a preset message fixed length and a configuration bandwidth, and schedule calculation of actual sending time of a next message according to the time interval;
an obtaining unit 202, configured to obtain an actual length of a received current packet and an expected time of arrival of the current packet;
the calculating unit 201 is further configured to determine a time increment according to the actual length and the time interval;
optionally, the computing unit 201 is specifically configured to:
and determining a time increment according to X-L2T/L1, wherein X is the time increment, L2 is the actual length of the received current message, T is the time interval between the determined messages, and L1 is the fixed length of a preset message.
An updating unit 203, configured to update the expected time of arrival of the next packet according to the time increment;
a sending unit 204, configured to send the next packet according to the actual sending time.
The embodiment of the invention provides a device for scheduling variable-length message flow control service, which is characterized in that a computing unit determines the time interval between messages according to the preset fixed length of the messages and the configuration bandwidth and schedules the calculation of the actual sending time of the next message according to the time interval; the obtaining unit obtains the actual length of the received current message, and the calculating unit determines the time increment according to the actual length and the time interval; and the updating unit updates the expected time of the next message according to the time increment, and the sending unit sends the next message according to the actual sending time. Compared with the prior art that when scheduling is performed based on the scheduling method of the credit leaky bucket, due to the fact that scheduling performance is affected by the total bandwidth, the total configured bandwidth is often tens of times of the source flow specification, and therefore when the design specification is determined, resources consumed by the credit leaky bucket are much lower.
Example 2
The embodiment of the invention provides a method for scheduling variable-length message flow control service, and the application scenario of the embodiment is as follows: the calculation of the actual transmission time of the next packet is scheduled to occur synchronously with the updating of the expected time of arrival of the next packet, and the expected time of arrival of the next packet is updated once every time the calculation of the actual transmission time of one packet is scheduled, as shown in fig. 3, the method includes:
step 301, determining a time interval between messages according to a preset message fixed length and a configuration bandwidth, and scheduling calculation of actual sending time of a next message according to the time interval;
optionally, calculating a time interval between the messages according to T-L1 × 8/M, where T is the time interval between the messages, L1 is a preset message fixed length, and M configures a bandwidth;
as shown in fig. 4, the actual arrival time of the current packet is ta (K), K indicates that the current packet is the kth packet, the determined expected arrival time of the current packet is tat (K), and then, it is determined whether ta (K) is greater than [ tat (K) + P ], where P is a packet arrival time tolerance value;
when ta (k) > [ tat (k) + P ], it is described that the actual traffic used when the current message is sent is lower than the configured bandwidth, and the traffic does not need to be limited, and the actual sending time Ts of the next message is ta (k);
when Ta (K) is less than or equal to [ TAT (K) + P ], the actual flow used when the current message is sent is higher than the configuration bandwidth, and at the moment, whether Ta (K) is greater than [ TAT (K) -P ] is continuously judged;
when ta (k) > [ tat (k) — P ], it is described that the actual traffic used when the current message is sent is higher than the configured bandwidth, but a certain amount of bursts are allowed according to the actual situation, so that within the tolerance range, the traffic does not need to be limited at this time, and the actual sending time Ts of the next message is ta (k);
when ta (k) is less than or equal to [ tat (k) -P ], it is described that the actual traffic used when the current packet is sent is higher than the configured bandwidth, the traffic needs to be limited, and the actual sending time Ts of the next packet is tat (k) to achieve the traffic smoothing in the sending direction.
Step 302, obtaining the actual length of the received current message, and determining a time increment according to the actual length and the time interval;
optionally, after receiving the current packet, writing the current packet into a memory, controlling to read and transmit the packet from the memory according to the actual transmission time, after reading the packet from the memory, obtaining the actual length of the current packet, and determining a time increment according to X ═ L2 × T/L1, where X is the time increment, L2 is the actual length of the received current packet, T is the time interval between the determined packets, and L1 is the fixed length of the preset packet.
Step 303, updating the expected time of arrival of the next message according to the time increment;
optionally, as shown in fig. 4, determining an actual arrival time ta (k) of the current packet, where the expected arrival time of the current packet is tat (k);
judging whether Ta (K) is more than [ TAT (K) + P ];
when ta (K) > [ TAT (K) + P ], then TAT (K +1) ═ ta (K) + X;
when Ta (K) is less than or equal to [ TAT (K) + P ], judging whether Ta (K) is more than [ TAT (K) -P ];
when ta (K) > [ TAT (K) -P ], then TAT (K +1) ═ TAT (K) + X;
when ta (K) ≦ [ TAT (K) -P ], then TAT (K +1) ═ TAT (K) + X.
And step 304, sending the next message according to the actual sending time.
The embodiment of the invention provides a method for scheduling variable-length message flow control service, which determines the time interval between messages according to the preset message fixed length and the configuration bandwidth, and schedules the calculation of the actual sending time of the next message according to the time interval; acquiring the actual length of the received current message, and determining a time increment according to the actual length and the time interval; and updating the expected time of the next message according to the time increment, and sending the next message according to the actual sending time. The scheme provided by the embodiment of the invention controls the flow control service scheduling of the variable length message based on the time scale, the scheduling is accurate, the scheduling performance only depends on the source flow specification, the scheduling performance is not influenced by the total bandwidth, and the consumed resources are less while the scheduling performance is met.
The embodiment of the invention provides another method for scheduling variable-length message flow control services, and the application scenarios of the embodiment are as follows: the calculation of the actual sending time of the next message is scheduled to occur asynchronously with the updating of the expected time of the next message arrival, and the expected time of the next message arrival is updated according to the calculated time increment only after the actual length of the current message is obtained, that is, the scheduling can be performed temporarily according to the preset interval during the period that the expected time is not updated, and the scheduling deviation before the actual length of the message is corrected after the actual length of the message is obtained, as shown in fig. 5, the method includes:
step 501, determining a time interval between messages according to a preset message fixed length and a configuration bandwidth, and scheduling calculation of actual sending time of a next message according to the time interval;
as shown in fig. 6, the calculation of the actual sending time for scheduling the next packet is an independent process, and the calculation of the actual sending time is a loop iteration calculation, that is, ts (k) is calculated successively;
it should be noted that, in the embodiment of the present invention, the calculation of the actual sending time is the same as the calculation of the actual sending time in fig. 4, and reference may be specifically made to the calculation of the actual sending time in fig. 4, which is not described in detail herein. It should be noted that, when calculating the actual sending time in fig. 6 and fig. 4, the difference is that the expected time of the current message arrival is tat (k) and tat (j), respectively, that is, fig. 4 shows that the calculation of the actual sending time of the next message is scheduled and the expected time of the next message arrival is updated synchronously, that is, the subscripts of ts (k) and tat (k) are the same; fig. 6 shows that the calculation of the actual transmission time of the next scheduled packet occurs asynchronously with the update of the expected arrival time of the next packet, i.e. the subscripts of ts (k) and tat (j) are different.
Step 502, transmitting the next message according to the actual transmission time of the next message;
at the moment, the time interval between the messages and the actual sending time of the next message are calculated according to the preset message fixed length, the next message is sent according to the actual sending time of the next message, the process is an independent process and is completely asynchronous with the updating of the expected arrival time of the next message, namely the expected arrival time of the next message is not changed by calculating any scheduling before the actual length of the message is not fed back.
The calculation steps of the expected time of the next message arrival at this time are as follows:
determining the actual arrival time Ta (K) of the current message and the expected arrival time TAT (J) of the current message;
judging whether Ta (K) is greater than TAT (J);
when ta (k) > TAT (J), then TAT (J +1) ═ tc (k) + T;
when Ta (K) ≦ TAT (J), TAT (J +1) ═ TAT (J) + T.
Wherein, T is the time interval between messages, Tc (K) is a QOS global accumulation counter, and the uniform flow of the simulation time. Since the calculation of the actual transmission time Ts of the next message is serial, Tc is equivalent to Ta when Ts is updated.
Step 503, obtaining the actual length of the received current message, and determining a time increment according to the actual length and the time interval;
optionally, a time increment is determined according to X-L2 × T/L1, where X is the time increment, L2 is the actual length of the received current packet, T is the time interval between the determined packets, and L1 is the fixed length of the preset packet.
Step 504, updating the expected time of the next message according to the time increment;
optionally, as shown in fig. 7, determining whether Tc is greater than tat (j);
when Tc > TAT (J), then TAT (J +1) ═ Tc + X;
when Tc is not more than TAT (J), TAT (J +1) ═ TAT (J) + X.
If the TAT lags behind the Tc, the sending flow is larger than the configuration bandwidth, and the TAT needs to increase time increment on the basis of the TAT to ensure the accuracy of current limiting; if TAT is earlier than Tc, it shows that the actual flow is lower than the configuration, TAT needs to be updated, time increment is increased or decreased on the basis of Tc, and the flow does not need to be limited;
the time increment of TAT update is X, that is, TAT increment is modified proportionally according to actual length, and longer message indicates larger sending flow, TAT increment should be increased.
As shown in fig. 8, the time of reading the message may be controlled according to Ts and the message may be sent, the expected time of arrival of the next message is updated only after the actual length information of the message is obtained, and then the actual sending time of the next message is recalculated by comparing the actual time Tc of arrival of the next message with the updated expected time TAT of arrival of the next message.
And 505, sending the next message according to the actual sending time.
For example, in the flow control of the existing 1K flows, each flow specification is maximum 1Gbps, and then 1K × 1Gbps — 1Tbps is actually only a configuration specification, the actual total traffic is limited by a physical bandwidth, the actual total traffic is only 10Gbps, and when scheduling is performed by using a leaky bucket credit method in the prior art, the designed total polling capacity needs 1Tbps, so that more parallel processing resources are needed; when the time scale mode provided by the embodiment of the invention is adopted, 1k streams can share one group of scheduling device for pipelining operation, the scheduling capacity is only required to be greater than the actual total traffic of 10Gbps according to the time trigger scheduling event, the designed total performance requirement is greatly reduced, and the resource cost is also reduced.
The embodiment of the invention provides a method for scheduling variable-length message flow control service, which determines the time interval between messages according to the preset message fixed length and the configuration bandwidth, and schedules the calculation of the actual sending time of the next message according to the time interval; acquiring the actual length of the received current message, and determining a time increment according to the actual length and the time interval; and updating the expected time of the next message according to the time increment, and sending the next message according to the actual sending time. The scheme provided by the embodiment of the invention controls the flow control service scheduling of the variable-length message based on the time scale, the scheduling performance only depends on the source flow specification and is not influenced by the total bandwidth, the scheduling period is not influenced by the reading delay of the memory, the scheduling performance can be greatly improved, and when the design specification is determined, the consumed resources are less.
An embodiment of the present invention provides a device for scheduling a variable length message flow control service, as shown in fig. 9, where the device includes: the system comprises a calculation unit 901, a determination module 9011, a first judgment module 9012, a first calculation module 9013, a second judgment module 9014, a second calculation module 9015, an acquisition unit 902, a control unit 903, an update unit 904, a determination module 9041, a judgment module 9042, a first update module 9043, a second update module 9044 and a sending unit 905;
a calculating unit 901, configured to determine a time interval between messages according to a preset message fixed length and a configuration bandwidth, and schedule calculation of actual sending time of a next message according to the time interval;
optionally, the determining module 9011 in the calculating unit 901 is configured to determine an actual arrival time of the current packet;
a first determining module 9012 in the calculating unit 901, configured to determine whether the actual arrival time of the current packet is greater than a sum of an expected arrival time of the current packet and a packet arrival time tolerance value;
when the actual arrival time of the current packet is greater than the sum of the expected arrival time of the current packet and the packet arrival time tolerance value, the first calculation module 9013 in the calculation unit 901 is configured to determine that the actual sending time of the next packet is the actual arrival time of the current packet;
when the actual arrival time of the current packet is not greater than the sum of the expected arrival time of the current packet and the packet arrival time tolerance value, the second determining module 9014 in the calculating unit 901 is configured to determine whether the actual arrival time of the current packet is greater than the difference between the expected arrival time of the current packet and the packet arrival time tolerance value;
when the actual arrival time of the current packet is greater than the difference between the expected arrival time of the current packet and the tolerance value of the packet arrival time, the first calculation module 9013 is further configured to determine the actual sending time of the next packet as the actual arrival time of the current packet;
when the actual arrival time of the current packet is not greater than the difference between the expected arrival time of the current packet and the tolerance value of the packet arrival time, the second calculation module 9015 in the calculation unit 901 is configured to determine that the actual sending time of the next packet is the expected arrival time of the current packet.
An obtaining unit 902, configured to obtain an actual length of a received current packet;
the calculating unit 901 is further configured to determine a time increment according to the actual length and the time interval;
the calculating unit 901 is specifically configured to: and determining a time increment according to X-L2T/L1, wherein X is the time increment, L2 is the actual length of the received current message, T is the time interval between the determined messages, and L1 is the fixed length of a preset message.
It should be noted that the calculation of the actual sending time of the next message is scheduled to occur synchronously with the updating of the expected arrival time of the next message; or, the calculation of the actual sending time of the next message is scheduled to occur asynchronously with the updating of the expected arrival time of the next message;
a control unit 903, configured to update the expected time of arrival of the next packet once every time the calculation of the actual sending time of one packet is scheduled when the calculation of the actual sending time of the next packet is scheduled and the expected time of arrival of the next packet is updated synchronously;
when the calculation of the actual sending time of the next packet is scheduled to occur asynchronously with the updating of the expected time of arrival of the next packet, the control unit 903 is further configured to update the expected time of arrival of the next packet according to the calculated time increment only after the actual length of the current packet is obtained.
An updating unit 904, configured to update the expected time of arrival of the next packet according to the time increment;
optionally, the determining module 9041 in the updating unit 904 is configured to determine an actual arrival time of the current packet and an expected arrival time of the current packet;
a determining module 9042 in the updating unit 804, configured to determine whether the expected time of arrival of the current packet is greater than the actual arrival time or a sum of the expected time of arrival of the current packet and the tolerance value of the arrival time of the packet;
when the expected time of arrival of the current packet is greater than the actual arrival time or the sum of the expected time of arrival of the current packet and the tolerance value of the arrival time of the packet, the first updating module 9043 in the updating unit 904 updates the expected time of arrival of the next packet to be the sum of the time arrival time and the time increment;
when the expected time of arrival of the current packet is not greater than the actual arrival time or the sum of the expected time of arrival of the current packet and the tolerance value of the arrival time of the packet, the second updating module 9044 in the updating unit 904 is configured to update the expected time of arrival of the next packet to be the sum of the expected time of arrival of the current packet and the time increment.
A sending unit 905, configured to send the next packet according to the actual sending time.
The embodiment of the invention provides a device for scheduling variable-length message flow control service, which is characterized in that a computing unit determines the time interval between messages according to the preset fixed length of the messages and the configuration bandwidth and schedules the calculation of the actual sending time of the next message according to the time interval; the obtaining unit obtains the actual length of the received current message, and the calculating unit determines the time increment according to the actual length and the time interval; and the updating unit updates the expected time of the next message according to the time increment, and the sending unit sends the next message according to the actual sending time. The scheme provided by the embodiment of the invention can consume less resources when the design specification is determined.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention 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 invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.