主权项 |
1. A system for controlling packet traffic, wherein a token bucket algorithm is an SrTCM algorithm in color-blind mode or an MEF10 algorithm in color-blind mode and wherein the system comprises:
a processor; and a computer-readable storage medium storing a program to be executed by the processor, the program including instructions for:
determining a number of tokens in a C bucket and a number of tokens in an E bucket at the current time point when the packet to be sent is received;determining whether the number of tokens in the C bucket at the current time point is greater than or equal to the length of the packet to be sent and is greater than the preset virtual threshold;refreshing, in response to determining that the number of tokens in the C bucket at the current time point is greater than or equal to the length of the packet to be sent and is greater than the preset virtual threshold, the number of tokens in the C bucket so that the number of tokens in the C bucket is the number of tokens in the C bucket at the current time point minus the number of tokens needed to be subtracted when the packet to be sent passes; and marking the packet to be sent with green;determining, in response to determining that the number of tokens in the C bucket at the current time point is not greater than or equal to the length of the packet to be sent and is not greater than the preset virtual threshold, whether the number of tokens in the E bucket at the current time point is greater than or equal to the length of the packet to be sent and is greater than the preset virtual threshold;refreshing, in response to determining that the number of tokens in the E bucket at the current time point is greater than or equal to the length of the packet to be sent and is greater than the preset virtual threshold, the number of tokens in the E bucket so that the number of tokens in the E bucket is the number of tokens in the E bucket at the current time point minus the number of tokens needed to be subtracted when the packet to be sent passes; and marking the packet to be sent with yellow; andkeeping, in response to determining that the number of tokens in the E bucket at the current time point is not greater than or equal to the length of the packet to be sent and is not greater than the preset virtual threshold, the number of tokens in the C bucket and the number of tokens in the E bucket unchanged and marking the packet to be sent with red, wherein the preset virtual threshold is configured according to a target passing ratio of long packets to short packets. |