WO2023116611A1 - 一种队列控制的方法及装置 - Google Patents

一种队列控制的方法及装置 Download PDF

Info

Publication number
WO2023116611A1
WO2023116611A1 PCT/CN2022/139953 CN2022139953W WO2023116611A1 WO 2023116611 A1 WO2023116611 A1 WO 2023116611A1 CN 2022139953 W CN2022139953 W CN 2022139953W WO 2023116611 A1 WO2023116611 A1 WO 2023116611A1
Authority
WO
WIPO (PCT)
Prior art keywords
queue
parameter
packet loss
threshold
packets
Prior art date
Application number
PCT/CN2022/139953
Other languages
English (en)
French (fr)
Inventor
温华锋
王健
邵士文
周兴旺
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2023116611A1 publication Critical patent/WO2023116611A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/32Flow control; Congestion control by discarding or delaying data units, e.g. packets or frames

Definitions

  • the present application relates to the technical field of communications, and in particular to a queue control method and device.
  • Devices in the communication network can be connected to other devices through the egress port, and send messages to other devices through the egress port.
  • the device can cache the packets that need to be sent through the egress port in the queue, and dispatch the cached packets out of the queue through the queue scheduling algorithm. Packets scheduled out of the queue can be sent to other devices through the egress port.
  • the maximum total number of bytes that a device allows to buffer packets in a queue can be called the queue threshold. That is to say, the sum of the bytes of packets buffered in the queue does not exceed the queue threshold.
  • the device refuses to add new packets to the queue. For example, the device can discard new packets received after the total bytes of packets buffered in the queue reach the queue threshold.
  • the present application provides a queue control method and device, aiming to flexibly adjust the queue threshold of the queue, reduce the probability of message being discarded, and improve the reliability of message forwarding.
  • the present application provides a method for queue control, the method is applied to a first device, and the first device may be a network device such as a switch, for example.
  • the first device acquires the packet loss parameter of the first queue and determines whether the packet loss parameter of the first queue is greater than a first packet loss threshold.
  • the first queue may be a queue corresponding to a port of the first device, or may be a queue corresponding to ports of other devices except the first device.
  • the packet loss parameter of the first queue is determined according to the number of packets or the total number of bytes discarded by the first device because it cannot join the first queue. The total number of bytes of packets added to the first queue.
  • the first packet loss threshold is a lower limit value for adjusting the first cache parameter by the first device. If the packet loss parameter of the first queue is greater than the first packet loss threshold, it indicates that the first device has discarded many packets because it cannot add packets to the first queue. Then, in order to reduce the probability of the packet being discarded, the first device may increase the first cache parameter, and control the packet to be added to the first queue according to the increased first cache parameter. Wherein, the first cache parameter is used to adjust the queue threshold of the first queue.
  • the queue threshold of the first queue indicates the maximum total bytes of packets that are allowed to be buffered in the first queue.
  • the first device may adjust the first cache parameter used to determine the queue threshold of the first queue according to the packet discarded because it cannot join the first queue. In this way, the first device can flexibly adjust the queue threshold of the first queue according to the packet loss situation of the first queue. In this way, packets can be prevented from being discarded because the total number of bytes of packets buffered in the first queue reaches the queue threshold of the first queue, the probability of packet discarding is reduced, and the reliability of packet forwarding is improved.
  • the first buffer parameter represents a ratio between the buffer space that can be occupied by the first queue and the remaining buffer space of the port where the first queue is located.
  • the remaining buffer space is an unoccupied buffer space in the total buffer space of the port where the first queue is located. That is to say, the first buffer parameter indicates how many proportions of buffer space can be allocated to the first queue in the remaining buffer space of the port where the first queue is located.
  • the first device first obtains the remaining buffer space of the port where the first queue is located.
  • the first device calculates the additional cache space that the first queue can occupy based on the remaining cache space of the port where the first queue is located and the first cache parameters, and calculates the cache space already occupied by the first queue and the additional cache space that the first queue can occupy The sum of the cache space is used as the queue threshold of the first queue. In this way, the first device can determine whether to add the packet to the first queue according to the queue threshold of the first queue, and limit the total number of bytes of packets buffered in the first queue to be below the queue threshold of the first queue.
  • the first device may obtain the remaining buffer space of the port where the first queue is located, and re-according to the first buffer parameter Calculate the queue threshold for the first queue.
  • the aforementioned first cache parameter is not greater than the upper limit of the cache parameter.
  • the first device may first determine that the first cache parameter is less than the upper limit of the cache parameter, or determine that the increased first cache parameter is less than (or less than or equal to) the upper limit of the cache parameter.
  • the ratio of the buffer space that the first queue can additionally occupy to the remaining buffer space of the port where the first queue is located does not exceed the upper limit of the cache parameter, so that the first queue will not excessively occupy the remaining buffer space of the port where the first queue is located, so that Ensure that other queues corresponding to the first listed port have enough buffer space for buffering packets.
  • the packet loss parameter of the first queue is greater than the first packet loss threshold.
  • the first device reduces the first cache parameter. For example, after acquiring the packet loss parameter of the first queue, the first device may determine whether the packet loss parameter of the first queue is smaller than the second packet loss threshold. If the packet loss parameter of the first queue is less than (or less than or equal to) the second packet loss threshold, the first device may reduce the first buffer parameter, so as to reduce the remaining buffer of the port where the first queue can be additionally occupied by the first queue The proportion of the space is such that the first queue will not excessively occupy the remaining buffer space of the port where the first queue is located.
  • the above-mentioned second packet loss threshold may be equal to the first packet loss threshold, or may be smaller than the first packet loss threshold.
  • the first device periodically adjusts the first cache parameter. For example, the first device may periodically obtain the packet loss parameters of the first queue, and each time after obtaining the packet loss parameters of the first queue, according to the size between the packet loss parameters of the first queue and the first packet loss threshold Relationship, adjust the first cache parameter.
  • the first device adjusts the first cache parameter according to the packet loss parameters of the first queue in multiple cycles. Taking the first device reducing the first cache parameter in the i-th cycle as an example, the first device may acquire the cache parameters of the first queue in each cycle in the first M cycles of the i-th cycle. Wherein, i and M are positive integers, and M is smaller than i. Next, the first device may determine whether the packet loss parameters of the first queue are smaller than the second packet loss threshold in the first M periods of the i period.
  • the first device may reduce the first cache parameter.
  • the first device determines whether to reduce the first buffer parameter according to the buffered packets in the first queue. Taking the first device reducing the first cache parameter in the i-th cycle as an example, the first device can obtain the first queue cached message at the end of each cycle in the first M cycles of the i-th cycle. Case. If at the end of each cycle in the first M cycles of the i-th cycle, the total number of bytes of messages buffered in the first queue is less than or equal to the set threshold, it means that the messages added to the first queue in each cycle less, the first device may reduce the first cache parameter.
  • the first device stores the packet loss parameters in each period, so that in a subsequent process, the stored packet loss parameters of the first queue can be used to determine whether to adjust the first cache parameter.
  • the port where the first queue is located also includes the second queue.
  • the first queue is used to forward packets of small flows
  • the second queue is used to forward packets of large flows.
  • a data flow that includes a number of packets less than or equal to N is called a small flow
  • a data flow that includes a number of packets greater than N is called a large flow.
  • the first device adjusts the forwarding parameters of the first queue and the forwarding parameters of the second queue.
  • the forwarding parameters may include average packet length and/or forwarding rate.
  • the first device first obtains the forwarding parameters of the first queue and the forwarding parameters of the second queue.
  • the first device calculates a ratio between the forwarding parameter of the first queue and the forwarding parameter of the second queue, and compares the calculated ratio with the expected ratio.
  • the first device can adjust N to change the number of packets entering the first queue and the second queue, and ensure that the small flow Forwarding indicators, for example, forwarding indicators such as flow completion time (flow completion time, FCT).
  • flow completion time flow completion time, FCT
  • the desired ratio is 0.25.
  • the first device adjusts N according to a ratio between a forwarding parameter of the first queue and a forwarding parameter of the second queue and an expected ratio. For example, if the ratio of the forwarding parameter of the first queue to the forwarding parameter of the second queue is greater than the expected ratio, it means that too many packets are buffered in the first queue.
  • the first device can reduce N to reduce the number of packets added to the first queue; if the ratio of the forwarding parameters of the first queue to the forwarding parameters of the second queue is less than the expected ratio, it means that there are too many packets being buffered into In the second queue, the first device may increase N to increase the number of packets added to the first queue.
  • the first device does not adjust the N.
  • the above-mentioned ratio of the forwarding parameters of the first queue to the forwarding parameters of the second queue is greater than the expected ratio, which may include that the ratio of the forwarding parameters of the first queue to the forwarding parameters of the second queue is greater than the upper limit of the trusted range of the expected ratio Value; the ratio of the forwarding parameters of the first queue to the forwarding parameters of the second queue is less than the expected ratio, which may include the lower limit of the credible range that the ratio of the forwarding parameters of the first queue to the forwarding parameters of the second queue is less than the expected ratio value.
  • the first device may discard packets to be added to the second queue probabilistically. For example, when the total number of bytes of packets buffered in the second queue reaches the start threshold, and the total number of bytes of packets buffered in the second queue is smaller than the stop threshold of the second queue, the first device may The total number of buffered packets calculates the discard probability, and discards the packets to be added to the second queue according to the discard probability. Wherein, the starting threshold is smaller than the stopping threshold, and the stopping threshold is smaller than or equal to the queue threshold of the second queue.
  • the first device uses a weighted random early detection (weighted random early detection, WRED) probability to discard packets to be added to the second queue.
  • WRED weighted random early detection
  • the first device adjusts the second cache parameter according to the packet loss situation of the first queue, and the second cache parameter is used to instruct the first device to discard packets to be added to the second queue with probability.
  • the second cache parameter may include the above-mentioned start threshold and stop threshold.
  • the first device may determine whether the packet loss parameter of the first queue is greater than the third packet loss threshold. If the packet loss parameter of the first queue is greater than the third packet loss threshold, the first device can adjust the second cache parameter to increase the probability of the first device discarding packets to be added to the second queue and reduce the buffer space occupied by the second queue , so as to increase the remaining buffer space of the port where the first queue is located, thereby increasing the additional buffer space that the first queue can occupy.
  • the third packet loss threshold may be equal to the foregoing first packet loss threshold and/or the second packet loss threshold.
  • adjusting the second cache parameter by the first device includes reducing the start threshold and/or stop threshold by the first device.
  • the adjusted second buffer parameter can instruct the first device to start discarding the packets to be added to the second queue when the total number of bytes of the packets buffered in the second queue is smaller.
  • message or, when the total number of bytes of the message buffered in the second queue is smaller, the message to be added to the second queue is discarded according to the maximum discard probability.
  • the first device may discard more packets to be added to the second queue, so as to increase the remaining buffer space of the port where the first queue is located.
  • the first device adjusts the second cache parameter according to the packet loss situation of the first queue in the past several periods, so as to reduce the number of discarded packets to be added to the second queue by the first device.
  • the first device may obtain the packet loss parameter of each cycle of the first queue in the first K cycles of the jth cycle. If the first queue is in the first K cycles of the j cycle, and the packet loss parameters in each cycle are less than the fourth packet loss threshold, the first device can adjust the second cache parameter, for example, it can increase the startup threshold and/or The stop threshold is used to reduce the number of packets discarded by the first device to be added to the second queue.
  • j and K are positive integers
  • K is less than j
  • the fourth packet loss threshold may be equal to any one or more of the aforementioned first packet loss threshold, second packet loss threshold, and third packet loss threshold.
  • the first device is checking the reliability of the calculated parameters. For example, after adjusting any one or more of the first cache parameter, N, and the second cache parameter, the first device may perform a credibility check on the adjusted parameters. After passing the credibility check, the first device controls the first queue according to the adjusted parameters.
  • the present application provides a queue control method, which is applied to a first device, and the first device may be a network device such as a switch, for example.
  • the port of the first device has a first queue and a second queue.
  • the first queue is used for forwarding packets of a small flow, the number of packets included in the small flow is less than or equal to N, where N is an integer, and the second queue is used for forwarding packets of a large flow.
  • the queue control method includes: the first device first obtains the forwarding parameters of the first queue and the forwarding parameters of the second queue. Forwarding parameters may include average packet length and/or forwarding rate.
  • the first device may calculate a ratio of the forwarding parameter of the first queue to the forwarding parameter of the second queue, and compare the calculated ratio with the expected ratio. If the calculated ratio does not match the expected ratio, indicating that the division of large flows and small flows is unreasonable, then the first device can adjust N to change the number of packets entering the first queue and the second queue, and ensure that the small flow forwarding indicator. In this way, large-flow packets and small-flow packets in the data stream can be better distinguished to ensure the reliability of small-flow packet forwarding.
  • the present application provides a method for queue control, the method is applied to a first device, and the first device may be a network device such as a switch, for example.
  • the port of the first device has a first queue and a second queue.
  • the first queue is used for forwarding packets of a small flow, the number of packets included in the small flow is less than or equal to N, where N is an integer, and the second queue is used for forwarding packets of a large flow.
  • the queue control method includes: the first device acquires a packet loss parameter of the first queue and determines whether the packet loss parameter of the first queue is greater than a fourth packet loss threshold.
  • the packet loss parameter of the first queue is determined according to the number of packets or the total number of bytes discarded by the first device because it cannot join the first queue. The total number of bytes of packets added to the first queue.
  • the fourth packet loss threshold is a lower limit value for adjusting the second cache parameter by the first device. If the packet loss parameter of the first queue is greater than the fourth packet loss threshold, it indicates that the first device has discarded many packets because it cannot add packets to the first queue. Then, in order to reduce the probability of the packet being discarded, the first device may increase the second cache parameter, and discard the packet to be added to the second queue according to the probability of the second cache parameter.
  • the cache space occupied by the messages cached in the second queue is reduced, and then the remaining cache space of the port where the first queue is located is increased, so that the additional buffer space occupied by the first queue increases, which is equivalent to increasing the first queue.
  • the queue threshold for the queue is used. In this way, the first queue can buffer more packets, which reduces the probability of discarding packets to be added to the first queue, and improves the reliability of small-flow packet forwarding.
  • the present application provides an apparatus for queue control, which is applied to a first device, and includes one or more units for implementing the methods described in the above-mentioned first aspect and each implementation manner of the first aspect,
  • the first or more units may be realized by software, hardware or a combination of software and hardware.
  • the present application provides a queue control device, the device is applied to the first device, and includes one or more units for implementing the method described in the above second aspect and each implementation manner of the second aspect,
  • the first or more units may be realized by software, hardware or a combination of software and hardware.
  • the present application provides a device for queue control, which is applied to the first device, and includes one or more units for implementing the method described in the third aspect and the third aspect,
  • the first or more units may be realized by software, hardware or a combination of software and hardware.
  • the present application provides a device, the device includes a processor and a memory, the memory is used to store instructions or program codes, and the processor is used to call and run the instructions or program codes from the memory, To implement the method for queue control as described in any one of the first aspect, the second aspect or the third aspect and their respective implementation manners.
  • the present application provides a chip for performing the aforementioned first aspect, second aspect or third
  • the present application provides a computer-readable storage medium, including instructions, programs or codes, which, when executed on a computer, enable the computer to execute any of the aforementioned first, second, or third aspects.
  • the embodiment of the present application provides a computer-readable storage medium, including instructions, programs or codes, which, when executed on a computer, enable the computer to perform the message scheduling as described in the aforementioned first aspect. method.
  • FIG. 1 is a schematic structural diagram of a network system provided by an embodiment of the present application.
  • FIG. 2 is a schematic flowchart of a queue control method provided in an embodiment of the present application
  • FIG. 3 is another schematic flow chart of the queue control method provided by the embodiment of the present application.
  • FIG. 4 is a schematic structural diagram of a queue processing device 400 provided by an embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of a device 500 provided in an embodiment of the present application.
  • FIG. 6 is a schematic structural diagram of a device 600 provided in an embodiment of the present application.
  • a device can include one or more egress ports for sending packets to other devices. Each output port can correspond to one or more queues.
  • the queue is used to buffer the packets that need to be sent through the egress port where the queue is located. For example, the device adds the packets to be sent through the egress port to the tail of the queue, and at the same time dispatches the packets at the head of the queue through the queue scheduling algorithm. Packets scheduled out of the queue are sent to other devices through the egress port. If the total bytes of packets buffered in the queue reaches the queue threshold, the device refuses to add new packets to the queue.
  • the total number of bytes of packets buffered in the queue refers to the sum of the bytes of all packets buffered in the queue. If the total number of bytes of packets buffered in the queue reaches the queue threshold, the device can discard new packets after receiving them.
  • the device may receive multiple packets within a short period of time, resulting in more packets buffered in the queue. If the total number of bytes of packets buffered in the queue reaches the queue threshold and the burst traffic has not yet ended, the device discards some packets that need to be sent through the egress port to increase the packet loss rate.
  • the embodiment of the present application provides a queue control method, which aims to flexibly adjust the queue threshold of the queue, reduce the probability of packet being discarded, and improve the reliability of packet forwarding.
  • the queue control method provided in the embodiment of the present application can be applied to the network shown in FIG. 1 .
  • the figure is a schematic structural diagram of a network system provided by an embodiment of the present application.
  • the network system includes a device 111 and a device 112 .
  • device 111 is connected to device 112 through egress port A.
  • At least one queue is deployed on outbound port A.
  • the packets buffered in these queues can be sent to the device 112 through the egress port A after being dispatched out of the queues.
  • device 111 and device 112 may be network devices with a forwarding function, such as forwarding devices such as routers or switches, or devices with forwarding functions such as servers or terminal devices.
  • device 111 and device 112 may be network devices in a data center network (data center network, DCN), such as leaf switches or spine switches in the DCN.
  • DCN data center network
  • FIG. 2 it is a schematic flowchart of a queue control method provided by an embodiment of the present application, including steps S201-S204.
  • S201 The first device acquires a packet loss parameter of the first queue.
  • the first device and the first queue are introduced.
  • the first device may be a network device configured to forward packets in a network system.
  • the first device includes a first port, and the first port corresponds to the first queue.
  • the first device may be device 111 or device 112 in the embodiment shown in FIG. 1 .
  • the first port may be port A of the device 111
  • the first queue may be a queue corresponding to port A.
  • the first queue may be any one of the multiple queues corresponding to the first port.
  • the packets cached in the first queue and the second queue described later may be data packets or control packets.
  • the first device allows the total number of bytes of packets buffered in the first queue to not exceed the queue threshold of the first queue.
  • the total number of bytes of packets buffered in the first queue may be controlled not to exceed the queue threshold of the first queue by allocating storage space for the first queue. For example, storage space may be allocated for the first queue according to the queue threshold of the first queue, and used to store packets added to the first queue. In this way, after the total number of bytes of packets buffered in the first queue reaches the queue threshold of the first queue, the storage space of the first queue cannot continue to store packets, and the first device can store subsequent received packets that need to pass through the first queue.
  • Packets scheduled by the queue are discarded.
  • part of the storage space may be divided from the storage space corresponding to the first port of the first device as the storage space of the first queue.
  • the storage space corresponding to the first port may be allocated for the first port from the memory of the first device, or may be a memory associated with the first port on the first device.
  • the storage may be, for example, a memory or a cache. If the queue threshold of the first queue changes, the first device may adjust the size of the storage space allocated for the first queue.
  • the storage space allocated for the first queue may be referred to as a buffer (buffer) of the first queue.
  • the following describes the packet loss parameters of the first queue and the method for the first device to obtain the packet loss parameters of the first queue.
  • the packet loss parameter of the first queue is determined according to the discarded packets that cannot be added to the first queue.
  • the packet discarded because it cannot be added to the first queue refers to the packet that should originally be added to the first queue, but is discarded by the first device because the total number of bytes of the packet buffered in the first queue reaches the queue threshold.
  • the first device may record relevant information of discarded packets due to being unable to join the first queue, so as to obtain the packet loss parameters of the first queue.
  • the first device may periodically calculate the packet loss parameter of the first queue. Then, the packet loss parameter of the first queue in the i-th cycle may be the total number of bytes of packets discarded due to failure to join the first queue in the i-th cycle. Correspondingly, the first device may record the total number of bytes of packets discarded due to failure to join the first queue in the i-th cycle as the packet loss parameter of the first queue in the i-th cycle. where i is a positive integer.
  • the packet loss parameter of the first queue in the i-th cycle is the total number of bytes of packets discarded due to failure to join the first queue in the i-th cycle and the number of bytes dispatched out of the first queue in the i-th cycle The ratio between the total number of bytes in the message. Then the first device can record the total number of bytes of packets dispatched from the first queue in the i-th cycle, and the total number of bytes of packets discarded because they cannot join the first queue in the i-th cycle.
  • the packet loss parameter of the first queue may also be determined according to the total number of discarded packets that cannot be added to the first queue.
  • the packet loss parameter of the first queue in the i-th cycle may be the total number of packets discarded because they cannot join the first queue in the i-th cycle.
  • the first device may store the packet loss parameter of the first queue in the i-th cycle, so that the first queue can determine whether to The first cache parameter needs to be adjusted.
  • the first queue may also be a queue of a port of a device other than the first device, that is, the first port where the first queue is located may be an egress port of a device other than the first device.
  • the packet loss parameter of the first queue may be reported to the first device by the device to which the first queue belongs, or calculated by the first device according to other information reported by the device to which the first queue belongs.
  • the first device may be the device 112 in the embodiment shown in FIG. 1
  • the first queue may be the queue of port A in the device 111 .
  • device 111 may send the packet loss parameter of the first queue to device 112 .
  • the device 111 may send to the device 112 the total number of bytes of messages dispatched from the first queue in the i-th cycle and the total number of bytes of messages discarded because they cannot be added to the first queue in the i-th cycle, so that Device 112 calculates the packet loss parameter of the first queue.
  • the first device may be a server or a controller, and the device to which the first queue belongs may be a network device such as a switch.
  • S202 The first device judges whether the packet loss parameter of the first queue is greater than a first packet loss threshold.
  • the first device may determine whether the packet loss parameter of the first queue is greater than a first packet loss threshold.
  • the first packet loss threshold is a lower limit value for adjusting the queue threshold of the first queue. If the packet loss parameter of the first queue reaches the queue threshold of the first queue, it indicates that the packet loss parameter of the first queue is high, and the number of packets discarded by the first device because it cannot join the first queue is large. Then the first device may execute S203 to increase the upper limit of the queue threshold of the first queue by increasing the first cache parameter, thereby increasing the queue threshold of the first queue. In this way, the first queue can accommodate more packets, reducing the probability of packets being discarded. Correspondingly, if the packet loss parameter of the first queue is less than or equal to the first packet loss threshold, the first device may not process the first cache parameter, or reduce the first cache parameter. The introduction of this part can be found below, and will not be repeated here.
  • the packet loss parameter of the first queue in the i-th cycle may be the total number of bytes of packets discarded due to failure to join the first queue in the i-th cycle.
  • the first threshold may be 0 byte. That is to say, if in the i-th cycle, the first device discards any packet because the packets cached in the first queue reach the queue threshold of the first queue, the first device can adjust the first cache parameter to increase the Queue threshold for the first queue in i+1 cycles.
  • the first device may increase the first cache parameter, for example, the first device may increase or double the first cache parameter, or the first device may also Increase the first cache parameter according to the packet loss parameter of the first queue.
  • the first cache parameter is used to adjust the queue threshold of the first queue.
  • the first cache parameter can be used to increase the queue threshold of the first queue.
  • the queue threshold of the first queue will correspondingly increase, that is, the total number of bytes of packets that the first device allows the first queue to cache is increased. In this way, even if a traffic burst occurs, since the queue threshold of the first queue increases, the first queue can accommodate more packets, reducing the probability of packets being discarded.
  • the first cache parameter is introduced below.
  • the first cache parameter represents additional cache space that the first queue can occupy.
  • the queue threshold of the first queue may be the sum of the first cache parameter and the cache space occupied by the first queue.
  • the first buffer parameter represents a ratio of additional buffer space that can be occupied by the first queue to the remaining buffer space of the first port.
  • the remaining cache space is an unoccupied cache space in the total cache space of the first port.
  • the total buffer space of the first port is the sum of buffer spaces of all queues corresponding to the first port, for example, may be the buffer space of a memory corresponding to the first port.
  • the queue threshold of the first queue is the sum of the buffer space occupied by the first queue and the value that can be increased by the above-mentioned queue threshold of the first queue, and the value that can be increased by the queue threshold of the first queue is equal to the value of the first cache parameter and The product of the remaining buffer space of the first port at the current moment.
  • the first port may correspond to multiple queues.
  • the first cache parameter may indicate additional cache space that the first queue can preempt from the remaining cache spaces of the multiple queues.
  • the first device will not fail to send the packet Joining the first queue and discarding packets reduces the probability of packets being discarded.
  • an upper limit of the first cache parameter may be set.
  • the upper bound of the first cache parameter may be referred to as a cache parameter upper bound.
  • the first device may determine that the first cache parameter is less than the cache parameter upper limit. If the first cache parameter is greater than or equal to the cache parameter upper limit, the first device may not increase the first cache parameter.
  • the foregoing first cache parameter may be represented by an alpha (alpha, ⁇ ) value.
  • the alpha value may be equal to the first cache parameter, or may correspond to the first cache parameter.
  • the value of ⁇ may be a natural number, and different values may correspond to different first cache parameters.
  • 2 to the ⁇ minus 7th power is a ratio of the additional buffer capacity that the first queue can occupy to the remaining buffer capacity of the first port.
  • the above cache parameter upper limit may be 8.
  • the first device may periodically obtain the packet loss parameter of the first queue.
  • the first device adjusts the first cache parameter in the i+1th cycle according to the packet loss parameter of the first queue in the i-th cycle.
  • the first device may determine the queue threshold of the first queue according to the first cache parameter of the i+1th cycle, and control packets to join the first queue according to the queue threshold of the first queue.
  • the first device may calculate the first cache parameter in the i+2th cycle according to the packet loss parameter of the first queue in the i+1th cycle.
  • the first device can determine the first cache parameter corresponding to the first queue in this period according to the packet loss parameter of the first queue in the previous period, and then control the packet adding according to the first cache parameter in this period. first queue.
  • the adjustment of the queue threshold of the first queue is guided by the historical packet loss data of the first queue, which improves the flexibility of adjusting the queue threshold of the first queue and improves the reliability of packet forwarding.
  • S204 Determine a queue threshold of the first queue according to the first cache parameter, and control packets to be added to the first queue according to the queue threshold of the first queue.
  • the first device may determine a queue threshold of the first queue according to the first cache parameter, and control packets to join the first queue according to the queue threshold of the first queue. For example, after receiving the first message to be added to the first queue, the first device may obtain the total number of bytes of the message buffered in the first queue, and Add the first packet to the first queue or discard the first packet. If the total number of bytes of packets buffered in the first queue is equal to the queue threshold of the first queue, the first device may discard the first packet and refuse to add the first packet to the first queue. If the total number of bytes of packets buffered in the first queue is less than the queue threshold of the first queue, the first device may add the first packet to the tail of the first queue.
  • the first device may also determine whether to allow the first packet to join the first queue according to the sum of the total number of bytes of the packets buffered in the first queue and the number of bytes of the first packet. If the total bytes of packets buffered in the first queue is less than the queue threshold of the first queue, but the sum of the total bytes of packets buffered in the first queue and the bytes of the first packet is greater than the first The queue threshold of the queue, the first device may also refuse the first packet to join the first queue, and discard the first packet.
  • the first device may first perform a confidence judgment on the first cache parameter to determine whether the first cache parameter can be used to determine the queue of the first queue threshold. For example, the first device can verify the credibility of the first cache parameters through the upper confidence interval (Upper Confidence bounds applied to Trees, UCT) algorithm, and then determine the first queue according to the number of first cache adoptions after the verification is passed. queue threshold.
  • UCT Upper Confidence bounds applied to Trees
  • the first device may obtain the remaining cache space of the port where the first queue is located, and calculate the first queue again according to the first cache parameter queue threshold.
  • the first device may calculate the queue threshold of the first queue according to the preconfigured first cache parameter.
  • the first queue is the queue of the outbound port on the first device. It can be understood that, if the first queue does not belong to the egress port of the first device, the first device may send the first cache parameter to the device to which the first queue belongs after determining the first cache parameter. In this case, S204 may be executed by the device to which the first queue belongs.
  • the first device may further reduce the first cache parameter, so as to reduce the upper limit of the increase of the queue threshold of the first queue. In this way, the maximum buffer space that can be occupied by the first queue can be limited, so that other queues corresponding to the first port can occupy more buffer space.
  • the first device may determine whether to adjust the first cache parameter according to the size of the packet loss parameter of the first queue.
  • the first device judges whether the packet loss parameter of the first queue is greater than the first packet loss threshold. If the packet loss parameter of the first queue is less than or equal to the first packet loss threshold, the first device may further determine whether the packet loss parameter of the first queue is less than the second packet loss threshold. If the packet loss parameter of the first queue is less than the second packet loss threshold, the first device may reduce the first cache parameter, for example, the first device may subtract one or divide the first cache parameter by two, or the first device may also reduce the first cache parameter according to The packet loss parameter of the first queue decreases the first buffer parameter. Wherein, the second packet loss threshold may be smaller than the first packet loss threshold, or may be equal to the first packet loss threshold.
  • the first device may periodically obtain the packet loss parameter of the first queue. Then in some other implementations, the first device can obtain the packet loss parameters of the first queue in each cycle in the first M cycles of the current cycle, and based on the packet loss of the first queue in the first M cycles of the current cycle The parameter judges whether to increase the first cache parameter, where M is a positive integer. For example, the first device may acquire the packet loss parameters of the first queue stored in the past 20 cycles. If in each of the past 20 cycles, the packet loss parameter of the first queue is smaller than the second packet loss threshold, the first device may reduce the first cache parameter.
  • the first device may further determine whether to reduce the first buffer parameter based on the total number of bytes of packets buffered by the first queue at the end of the period. For example, the first device may obtain the total number of bytes of packets buffered by the first queue at the end of each cycle in the first K cycles of the current cycle (K is a positive integer), and combine The total number of bytes of packets buffered at the end of each cycle in each cycle and the packet loss parameter determine whether the first packet loss parameter needs to be reduced.
  • the above K and M may be equal.
  • the first device can obtain the status of buffered packets in the first queue at the end of each cycle in the first M cycles of the i-th cycle, and The packet loss parameter of the first queue in each cycle at the end of each cycle. If the packet loss parameters of the first queue in each cycle in the first M cycles of the i-th cycle are less than the second packet loss threshold, and the first queue in each cycle in the first M cycles of the i-th cycle At the end, the total number of buffered packets is less than or equal to the set threshold, and the first device may reduce the first buffering parameter of the first device.
  • the first device may send one or more data streams to the second device based on the first port.
  • the second device may be any device connected to the first device, and the first device is connected to the second device through the first port. For example, if the first device is device 111 in FIG. 1 and the first port is outbound port A of device 111, then the second device may be device 112 in FIG. 1 .
  • the data flow may be multiple packets with the same characteristics sent continuously by the device through the port.
  • the feature can be, for example, one or more of the quintuples (ie, source IP address, destination IP address, source port, destination port, and protocol number), or a flow identifier included in the message. If the sending interval of two messages with the same feature exceeds the set time, the two messages may be considered to belong to different data streams.
  • the first device may first establish a connection with the second device before sending a message to the second device. Next, the first device may send one or more packets to the second device through the connection. After sending the message, the first device may disconnect from the second device. After the connection is disconnected, if the first device obtains a new message that needs to be sent to the second device, the first device may establish a connection with the second device again. Correspondingly, after the connection is established and before the connection is disconnected by the first device, all packets sent by the first device may be regarded as packets in the same data stream.
  • TCP Transmission Control Protocol
  • the data flow may be divided into a small flow and a large flow according to the number of packets included in the data flow.
  • a data flow that includes packets less than or equal to N may be called a small flow
  • a data flow that includes packets greater than N may be called a large flow.
  • the small flow is used to carry small flow services
  • the large flow is used to carry large flow services.
  • the high-flow business has higher requirements on throughput-related parameters such as goodput.
  • Small streaming services have higher requirements on parameters such as FCT and queries per second (QPS).
  • the first queue can be used to forward packets of small flows
  • the second queue can be used to forward packets of large flows.
  • the packets of small and medium-flow services may also be called small-flow packets
  • the packets of large-flow services may also be called large-flow packets.
  • the data flow forwarded by the first device may include a large flow and a small flow. Due to the different requirements of large-flow services and small-flow services, the normal transmission of small-flow services may not be guaranteed by scheduling both large-flow and small-flow services through a queue.
  • the first device may add the first N packets in each data flow as packets of a small flow to the first queue, and add the packets other than the first N packets in the data flow to the first queue. Packets as a large flow are added to the second queue. If the total number of packets of a data flow is less than N, all packets of the data flow enter the first queue.
  • the second queue belongs to the first port, for example, the second queue may be the queue marked as 3 in the first port.
  • the scheduling priority of the second queue is lower than that of the first queue.
  • the first device may receive multiple data streams within a relatively short period of time. In this way, if the first device adds the first N packets of each data flow in the multiple data flows to the first queue as small flow packets, the total number of bytes of the buffered packets in the first queue will reach the first queue queue threshold. In this way, the first device may discard subsequent received packets of the small flow, thereby affecting parameters such as the FCT of the packets of the small flow.
  • the first device can adjust the first cache parameter according to the packet loss parameter of the first queue. If there is packet loss in the first queue in the last period, the first device may increase the first cache parameter. In this way, in the next cycle, if there is a traffic burst in the packets of the small flow, and the first device receives more packets of the small flow, the first device can determine the additional cache that the first queue can occupy according to the first buffer parameter. space, and then increase the queue threshold of the first queue, so that the first queue can accommodate more small-flow packets, and avoid discarding small-flow packets because the cached packets in the first queue reach the queue threshold of the first queue .
  • the first device can adjust the queue threshold of the first queue according to the packet loss of the first queue, so that the queue threshold of the first queue can be flexibly adjusted according to the transmission status of packets of the small flow, reducing the packet loss of the small flow.
  • the probability of discarding improves the reliability of packet forwarding for small flows.
  • the network device determines the number of packets added to the first queue in each data flow according to a fixed N, it may cause packets of a large flow to be added to the first queue, or cause packets of a small flow to be added to the second queue .
  • packets added to the first queue are regarded as packets of a small flow
  • packets added to the second queue are regarded as packets of a large flow.
  • the first device will treat it as a packet of a small flow for scheduling; if a packet of a small flow service is added to the second queue, the first device will The device considers the packets of small-flow services as packets of large-flow services for scheduling. In this way, the confusion of the packets of the large flow service and the packets of the small flow service may affect the transmission of the packets of the small flow.
  • device 111 transmits two data streams, data stream X and data stream Y, through egress port A.
  • the data flow X includes 10 packets
  • the queue control method provided in the embodiment of the present application may also adjust N used to distinguish small flows from large flows. Details are given below.
  • FIG. 3 it is another schematic flowchart of the queue control method provided by the embodiment of the present application, including steps S301-S304.
  • S301 The first device acquires the forwarding parameters of the first queue and the forwarding parameters of the second queue.
  • the first device may first obtain the forwarding parameters of the first queue and the forwarding parameters of the second queue.
  • the forwarding parameters of the first queue may include an average packet length of the first queue and/or a forwarding rate of the first queue.
  • the forwarding parameters of the second queue may include an average packet length of the second queue and/or a forwarding rate of the second queue. The following takes the first queue as an example to introduce the average packet length and forwarding rate.
  • the average packet length is the average number of bytes of the packets scheduled out of the queue. That is to say, the average packet length of the first queue is the average number of bytes of the packets dequeued from the first queue.
  • the first device may record the number of packets dequeued from the first queue, and the number of bytes of each packet. Next, the first device can sum the bytes of multiple packets, and divide the summed result by the number of packets dequeued from the first queue, and the obtained result is the average value of the first packet. Packet length.
  • the forwarding rate is the number of bytes dispatched out of the queue within the set time. That is to say, the forwarding rate of the first queue is the number of bytes of messages dequeued from the first queue within a set time.
  • the first device can record the number of bytes of each message dequeued from the first queue within a period of time. Next, the first device may sum the number of bytes of multiple packets within this period, and divide the summed result by this period of time, and the obtained result is the forwarding rate of the first packet.
  • the first device may periodically obtain the packet loss parameter of the first queue. Similarly, the first device may also periodically calculate the forwarding parameter of the first queue. For example, the first device may record the relevant parameters of the packets dispatched from the first queue within a period, and calculate the forwarding parameters of the packets in the period. For example, the first device may record the total number of packets dispatched from the first queue in the i-th period, and the number of bytes of each packet. Based on this, the first device can calculate and obtain the average packet length of the first queue in the i-th period. Combined with the duration of the cycle, the first device may also calculate the forwarding rate of the first queue in the i-th cycle.
  • the foregoing method for calculating the forwarding parameters of the first queue and the forwarding parameters of the second queue may be performed by the first device, or may be performed by other devices. If the above calculation method is executed by the third device, the acquisition by the first device of the forwarding parameters of the first queue and the forwarding parameters of the second queue may include: the first device receiving the forwarding parameters of the first queue and the forwarding parameters of the second queue sent by the third device Forward parameters.
  • S302 The first device judges whether a ratio of a forwarding parameter of the first queue to a forwarding parameter of the second queue matches an expected ratio.
  • the first device can calculate the ratio of the forwarding parameters of the first queue to the forwarding parameters of the second queue, and judge the difference between the forwarding parameters of the first queue and the second Whether the ratio of the forwarding parameter of the queue matches the expected ratio. If the ratio of the forwarding parameters of the first queue to the forwarding parameters of the second queue matches the expected ratio, the first device may not adjust the N; if the ratio of the forwarding parameters of the first queue to the forwarding parameters of the second queue matches the expected If the ratios do not match, the first device may execute S303 to adjust the N.
  • the ratio of the forwarding parameter of the first queue to the forwarding parameter of the second queue does not match the expected ratio, which may include the ratio of the forwarding parameter of the first queue to the forwarding parameter of the second queue Confidence range beyond expected ratio.
  • the credible range of the expected ratio is a range that fluctuates in a small range up and down based on the expected ratio. For example, assuming the expected ratio is 0.25 and the confidence range is 4%, then the confidence range for the expected ratio could be [0.24 0.26].
  • the first device may determine that the ratio of the forwarding parameter of the first queue to the forwarding parameter of the second queue matches the expected ratio.
  • the first device may determine that the ratio of the forwarding parameter of the first queue to the forwarding parameter of the second queue does not match the expected ratio.
  • the forwarding parameters may include an average packet length and/or a forwarding rate, which will be introduced respectively below.
  • the forwarding parameters include the average packet length.
  • the first device may calculate the ratio of the average packet length of the first queue to the average packet length of the second queue.
  • a higher ratio of the average packet length of the first queue to the average packet length of the second queue indicates that the average number of bytes of packets in the first queue is larger than the average number of bytes of packets in the second queue.
  • the length of packets of small flows is often much smaller than the length of packets of large flows. If the first queue is only used to schedule packets of small flows, the average packet length of the first queue should be much smaller than the average packet length of the second queue.
  • the ratio of the average packet length of the first queue to the average packet length of the second queue is higher than the expected ratio, it means that the average packet length of the first queue is greater than the average packet length of packets of small flows, and the first There is a large flow of packets in the queue. That is to say, the first device adds some packets of large flows in the first data flow to the first queue, and N is greater than the number of packets of small flows in the first data flow. Then the first device may reduce N, so as to prevent a large flow of packets from being added to the first queue.
  • the ratio of the average packet length of the first queue to the average packet length of the second queue is smaller than the expected ratio, it means that the average packet length of the second queue is smaller than the average packet length of the packets of the large flow, and the second There are small flow packets in the queue. That is to say, the first device adds packets of some small flows in the first data flow to the second queue, and N is smaller than the number of packets of small flows in the first data flow. Then the first device can increase N, so as to prevent packets of small flows from being added to the second queue.
  • the forwarding parameter includes a forwarding rate. Then the first device may calculate the ratio of the forwarding rate of the first queue to the forwarding rate of the second queue. If the ratio of the forwarding rate of the first queue to the forwarding rate of the second queue is higher, it means that the forwarding rate of packets in the first queue is faster than the forwarding rate of packets in the second queue.
  • the bandwidth occupied by the first device for sending packets of a small flow should be smaller than the bandwidth occupied by the first device for sending packets of a large flow.
  • the first device adds part of the packets of a large flow to the first queue, so the first device can reduce N to reduce the number of packets added to the first queue, and prevent the packets of a large flow from being added to the first queue. queue.
  • the ratio of the forwarding rate of the first queue to the forwarding rate of the second queue is smaller than the expected ratio, it means that the bandwidth occupied by the second queue is smaller than the bandwidth required for forwarding large-flow packets, and there are small-flow packets in the second queue.
  • the first device adds some packets of the small flow to the second queue, and N cannot properly divide the large flow and the small flow. Then, the first device may increase N to increase the number of packets added to the first queue, and prevent packets of small streams from being added to the second queue.
  • the ratio of the forwarding parameter of the first queue to the forwarding parameter of the second queue does not match the expected ratio, which may include the forwarding parameter of the first queue and the forwarding parameter of the second queue
  • the ratio is outside the credible range for the expected ratio.
  • the ratio of the average packet length of the first queue to the average packet length of the second queue is greater than the expected ratio, including that the ratio of the average packet length of the first queue to the average packet length of the second queue is greater than the expected ratio
  • the upper limit of the credible range; the ratio of the average packet length of the first queue to the average packet length of the second queue is less than the expected ratio, including the average packet length of the first queue and the average packet length of the second queue
  • the ratio of the length is less than the lower limit of the credible range of the expected ratio;
  • the ratio of the forwarding rate of the first queue to the forwarding rate of the second queue is greater than the expected ratio, including the forwarding rate of the first queue and the forwarding rate of the second queue
  • the ratio is greater than the upper limit of the credible range of the expected ratio; the ratio of the forwarding rate of the first queue to the forwarding rate of the second queue is less than the expected ratio, including the ratio of the forwarding rate of the first queue to the forwarding rate of the second queue is less than The lower value of the
  • the first device may also perform a credibility check on N after calculating N.
  • S304 The first device joins the first queue according to the N control packet.
  • the first device may join the first queue or the second queue according to the N control message. For example, when the first device receives a new data flow that needs to be sent through the first port, the first device can add the first N packets of the data flow to the first queue according to the adjusted N, and divide the first N packets of the data flow into the first queue. Other messages other than the N messages are added to the second queue.
  • the first device may join the first queue or the second queue according to the pre-configured N control packets in the data flow.
  • the value of N used to distinguish large-flow packets from small-flow packets can be adjusted according to the data flow forwarded by the first device, which can reduce the probability that small-flow packets are added to the second queue, and The probability that a large number of packets will be added to the first queue improves the reliability of packet forwarding.
  • the first device may adjust the first cache parameter.
  • the first buffer parameter is a ratio between the buffer space that can be further occupied by the first queue and the remaining buffer space of the first port. In this way, the first queue can occupy more buffer space after the packet of the small flow has a traffic burst, so as to accommodate the burst of packets of the small flow.
  • the remaining buffer space of the first port may be relatively less. Then even if the first device increases the first buffer parameter, the remaining buffer space that the first queue can occupy is limited, and there is still a possibility that the first device discards the packets of the small flow because it cannot add the packets of the small flow to the first queue.
  • the first device may discard new packets to be added to the first queue after the total number of bytes of packets buffered in the first queue reaches the queue threshold of the first queue.
  • the above-mentioned second queue may also have a queue threshold, and the first device may discard a new message to be added to the second queue after the total number of bytes of messages buffered in the second queue reaches the queue threshold of the second queue .
  • the first device may discard some packets to be added to the second queue before the total number of bytes of the packets buffered in the second queue reaches the queue threshold of the second queue. In this way, the buffer space occupied by the second queue is reduced, and the remaining buffer space of the first port is increased, thereby increasing the buffer space that the first queue can occupy, and improving the reliability of message forwarding of small flows.
  • the first device may determine the discard probability according to the second cache parameter, and then discard the packet to be added to the second queue according to the discard probability.
  • the first device adjusts the second cache parameter according to the packet loss parameter of the first queue. For example, the first device may compare the packet loss parameter of the first queue with the third packet loss threshold. The third packet loss threshold may be equal to the foregoing first packet loss threshold or the second packet loss threshold. If the packet loss parameter of the first queue is greater than the third packet loss threshold, the first device may adjust the second buffer parameter to increase the probability that the first device discards packets to be added to the second queue.
  • the first device may use the WRED algorithm to probabilistically discard some packets to be added to the second queue.
  • the above-mentioned second cache parameter may include a start threshold (also known as a low threshold) and a stop threshold (also known as a high threshold).
  • the second cache parameter may also include a maximum discard probability.
  • the first device can determine the discard probability according to the total number of bytes of the packets buffered in the second queue, and discard the packets to be added to the second queue based on the discard probability. message.
  • the total number of bytes of the packets buffered in the second queue gradually increases, and the probability that the first device discards the packets also gradually increases.
  • the first device may discard the packets to be added to the second queue according to a fixed probability.
  • the first device can discard all packets to be added to the second queue.
  • the fixed probability may be referred to as a maximum discard probability.
  • the stop threshold may be equal to a second queue threshold.
  • the first device may reduce the start threshold and/or stop threshold in the second cache parameter. In this way, compared with the second buffer parameter before reduction, the first device can start discarding the packets to be added to the second queue when the total number of bytes of the packets buffered in the second queue is smaller, or the second queue If the total number of buffered packets is smaller, the packets to be added to the second queue are discarded according to the maximum discard probability.
  • the first device may also increase the foregoing maximum discard probability when the packet loss parameter of the first queue is greater than the third packet loss threshold.
  • multiple sets of second cache parameters may be configured.
  • the start threshold and/or stop threshold of different sets of second cache parameters may be different. If the packet loss parameter of the first queue is greater than the third packet loss threshold, the first device may select a second cache parameter whose start threshold and/or stop threshold is lower than the current second cache parameter as the second cache parameter for the next cycle . That is to say, the first device may have multiple levels of second cache parameters, and adjust among the multiple levels of second cache parameters according to the packet loss parameter of the first queue.
  • the first device may control packets to join the second queue according to the pre-configured second cache parameter.
  • the start threshold of the preconfigured second cache parameter may be two-thirds of the queue threshold of the second queue
  • the stop threshold of the preconfigured second cache parameter may be the queue threshold of the second queue .
  • the first device may also increase the start threshold and stop threshold in the second cache parameter. For example, the first device may determine whether the packet loss parameter of the first queue is greater than the fourth packet loss threshold in K periods before the current period.
  • the fourth packet loss threshold may be equal to the third packet loss threshold. If in the K cycles before the current cycle, the packet loss parameters of the first queue are not greater than the fourth packet loss threshold, it means that the packets of the small flow are less likely to be discarded in the past K cycles, and the first device
  • the start threshold and/or stop threshold can be increased to reduce the probability of discarding packets to be added to the second queue and improve the reliability of packet forwarding in large flows.
  • the first device may also determine that the packet loss parameter of the first queue is not greater than the fourth packet loss threshold within K cycles before the current cycle, and the first queue is in After the total number of buffered packets at the end of each cycle is less than or equal to the set threshold, then increase the start threshold and/or stop threshold.
  • the specific method for determining and adjusting the first device can be referred to above, and will not be repeated here.
  • the above-mentioned technical solution for adjusting the second cache parameter may be implemented on the basis of the technical solution for adjusting the first cache parameter shown in FIG. 2 and/or the technical solution for adjusting N shown in FIG. 3 , or may be implemented independently accomplish.
  • the embodiment of the present application further provides a queue control apparatus 400 , and the queue control apparatus 400 can realize the function of the first device in the embodiment shown in FIG. 2 or FIG. 3 .
  • the apparatus 400 for queue control includes an acquiring unit 410 , a judging unit 420 and a processing unit 430 .
  • the acquiring unit 410 is used to realize S201 in the embodiment shown in FIG. 2 or S301 in the embodiment shown in FIG. 3
  • the judging unit 420 is used to realize S202 in the embodiment shown in FIG. 2 or the embodiment shown in FIG. 3
  • the processing unit 430 is configured to implement S203 and S204 in the embodiment shown in FIG. 2 , or S303 and S304 in the embodiment shown in FIG. 3 .
  • the obtaining unit 410 is configured to obtain the packet loss parameter of the first queue, where the packet loss parameter of the first queue is determined according to the discarded packets that cannot be added to the first queue.
  • a judging unit 420 configured to judge whether the packet loss parameter of the first queue is greater than a first packet loss threshold.
  • the processing unit 430 is configured to increase a first cache parameter when the packet loss parameter of the first queue is greater than the first packet loss threshold, and the first cache parameter is used to adjust the queue threshold of the first queue,
  • the queue threshold of the first queue indicates the maximum total number of bytes of packets allowed to be buffered by the first queue.
  • the obtaining unit 410 is configured to determine the forwarding parameters of the first queue and the forwarding parameters of the second queue, the first queue and the second queue belong to the same port, and the packets in the first queue include the The first N packets in the target data flow forwarded by the first device, the target data flow corresponds to the second queue, the N is a positive integer, and the forwarding parameters include the average packet length and/or forwarding rate.
  • the judging unit 420 is configured to judge whether the ratio of the forwarding parameter of the first queue to the forwarding parameter of the second queue matches the expected ratio.
  • the processing unit 430 is configured to adjust the N when the ratio of the forwarding parameter of the first queue to the forwarding parameter of the second queue is different from the expected ratio.
  • the obtaining unit 410 is configured to obtain the packet loss parameter of the first queue, the packet loss parameter of the first queue is determined according to the discarded message that cannot be added to the first queue, the first queue and the The second queue belongs to the same port, the packets in the first queue include the first N packets in the target data flow forwarded by the first device, the target data flow corresponds to the second queue, and the Said N is a positive integer.
  • a judging unit 420 configured to judge whether the packet loss parameter of the first queue is greater than a fourth packet loss threshold.
  • a processing unit 430 configured to adjust a second cache parameter when the packet loss parameter of the first queue is greater than the fourth packet loss threshold; discard packets to be added to the second queue according to the probability of the second cache parameter arts.
  • each functional unit in the embodiment of the present application may be integrated into one processing unit, or each unit may physically exist separately, or two or more units may be integrated into one unit.
  • the processing unit and the sending unit may be the same unit or different units.
  • the above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
  • FIG. 5 is a schematic structural diagram of a device 500 provided in an embodiment of the present application.
  • the above apparatus 400 for queue control may be implemented by the device shown in FIG. 5 .
  • the device 500 includes at least one processor 501 , a communication bus 502 and at least one communication interface 504 , and optionally, the device 500 may further include a memory 503 .
  • the processor 501 may be a general-purpose central processing unit (central processing unit, CPU), a specific application integrated circuit (application-specific integrated circuit, ASIC) or one or more integrated circuits (integrated circuit) for controlling the program execution of the application scheme , IC).
  • the processor 501 may be configured to process packets or parameters, so as to implement the queue control method provided in the embodiment of the present application.
  • the processor may be used for:
  • the packet loss parameter of the first queue is determined according to the discarded message because it cannot join the first queue; judging whether the packet loss parameter of the first queue is higher than the first threshold ; When the packet loss parameter of the first queue is higher than the first threshold, increase the first cache parameter, the first cache parameter is used to adjust the queue threshold of the first queue, and the first queue’s
  • the queue threshold indicates the maximum total number of bytes of data packets that are allowed to be buffered in the first queue.
  • Communication bus 502 is used to transfer information between processor 501 , communication interface 504 and memory 503 .
  • the memory 503 can be a read-only memory (read-only memory, ROM) or other types of static storage devices that can store static information and instructions, and the memory 503 can also be a random access memory (random access memory, RAM) or can store information and other types of dynamic storage devices for instructions, and can also be compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compact disc, laser disc, optical disc, digital versatile disc, Blu-ray optical discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited thereto.
  • the memory 503 may exist independently, and is connected to the processor 501 through the communication bus 502 .
  • the memory 503 can also be integrated with the processor 501 .
  • the memory 503 is used to store program codes or instructions for executing the technical solutions provided by the embodiments of the present application, and the execution is controlled by the processor 501 .
  • the processor 501 is used to execute program codes or instructions stored in the memory 503 .
  • One or more software modules may be included in the program code.
  • the processor 501 may also store program codes or instructions for executing the technical solutions provided by the embodiments of the present application. In this case, the processor 501 does not need to read the program codes or instructions from the memory 503 .
  • the communication interface 504 may be a device such as a transceiver for communicating with other devices or a communication network, and the communication network may be Ethernet, a radio access network (radio access network, RAN) or a wireless local area network (wireless local area networks, WLAN) )wait.
  • the communication interface 504 may be an Ethernet interface (Ethernet) interface, a fast Ethernet (fast Ethernet, FE) interface or a Gigabit Ethernet (gigabit Ethernet, GE) interface, etc.
  • the device 500 may include multiple processors, for example, the processor 501 and the processor 505 shown in FIG. 5 .
  • processors may be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor.
  • a processor herein may refer to one or more devices, circuits, and/or processing cores for processing data (eg, computer program instructions).
  • FIG. 6 is a schematic structural diagram of a device 600 provided in an embodiment of the present application.
  • the first device in FIG. 2 or FIG. 3 may be implemented by the device shown in FIG. 6 .
  • the device 600 includes a main control board and one or more interface boards.
  • the main control board is communicatively connected with the interface board.
  • the main control board is also called a main processing unit (main processing unit, MPU) or a route processing card (route processor card).
  • the main control board includes a CPU and a memory. Route calculation, device management and maintenance functions.
  • the interface board is also called a line processing unit (line processing unit, LPU) or a line card (line card), and is used to receive and send packets.
  • line processing unit line processing unit
  • LPU line processing unit
  • line card line card
  • the communication between the main control board and the interface board or between the interface board and the interface board is through a bus.
  • the interface boards communicate through the SFU.
  • the device 600 also includes the SFU.
  • the SFU communicates with the main control board and the interface board.
  • the SFU is used to forward the interface board.
  • the data between them, the SFU can also be called a switch fabric unit (SFU).
  • the interface board includes a CPU, a memory, a forwarding engine, and an interface card (interface card, IC), where the interface card may include one or more communication interfaces.
  • the communication interface may be an Ethernet interface, an FE interface, or a GE interface.
  • the CPU communicates with the memory, the forwarding engine and the interface card respectively.
  • the memory is used to store the forwarding table.
  • the forwarding engine is used to forward the received message based on the forwarding table stored in the memory. If the destination address of the received message is the IP address of the device 600, the message is sent to the CPU of the main control board or the interface board for further processing. Processing; if the destination address of the received message is not the IP address of the device 600, then look up the forwarding table according to the destination, if the next hop and the outgoing interface corresponding to the destination address are found from the forwarding table, the message will be Forward to the outbound interface corresponding to the destination address.
  • the forwarding engine may be a network processor (network processor, NP).
  • the interface card is also called a daughter card, which can be installed on the interface board.
  • the CPU can also perform the function of the forwarding engine, such as implementing soft forwarding based on a general-purpose CPU, so that no forwarding engine is needed in the interface board.
  • the forwarding engine may be implemented by an ASIC or a field programmable gate array (field programmable gate array, FPGA).
  • the memory storing the forwarding table can also be integrated into the forwarding engine as a part of the forwarding engine.
  • the embodiment of the present application also provides a chip system, including: a processor, the processor is coupled with a memory, and the memory is used to store programs or instructions, and when the programs or instructions are executed by the processor, the The chip system implements the queue control method performed by the first device in the embodiment shown in FIG. 2 above.
  • processors in the chip system there may be one or more processors in the chip system.
  • the processor can be realized by hardware or by software.
  • the processor may be a logic circuit, an integrated circuit, or the like.
  • the processor may be a general-purpose processor implemented by reading software codes stored in a memory.
  • the memory can be integrated with the processor, or can be set separately from the processor, which is not limited in this application.
  • the memory can be a non-transitory processor, such as a read-only memory ROM, which can be integrated with the processor on the same chip, or can be respectively arranged on different chips.
  • the setting method of the processor is not specifically limited.
  • the system-on-a-chip can be an FPGA, an ASIC, a system on chip (SoC), a CPU, an NP, or a digital signal processing circuit (digital signal processor, DSP), can also be a microcontroller unit (microcontroller unit, MCU), can also be a programmable logic device (programmable logic device, PLD) or other integrated chips.
  • SoC system on chip
  • DSP digital signal processing circuit
  • MCU microcontroller unit
  • PLD programmable logic device
  • each step in the foregoing method embodiments may be implemented by an integrated logic circuit of hardware in a processor or instructions in the form of software.
  • the method steps disclosed in connection with the embodiments of the present application may be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules in the processor.
  • the embodiment of the present application also provides a computer-readable storage medium, including instructions, which, when run on a computer, cause the computer to execute the queue control method provided by the above method embodiment and performed by the first device.
  • the embodiment of the present application also provides a computer program product containing instructions, which, when run on a computer, causes the computer to execute the queue control method provided by the above method embodiment and executed by the first device.
  • the disclosed system, device and method can be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical module division.
  • multiple units or components can be combined or May be integrated into another system, or some features may be ignored, or not implemented.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be obtained according to actual needs to achieve the purpose of the solution of this embodiment.
  • each module unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units can be implemented in the form of hardware or in the form of software module units.
  • the integrated unit is implemented in the form of a software module unit and sold or used as an independent product, it can be stored in a computer-readable storage medium.
  • the technical solution of the present application is essentially or part of the contribution to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , including several instructions to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage medium includes: various media capable of storing program codes such as U disk, mobile hard disk, ROM, RAM, magnetic disk or optical disk.

Landscapes

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

Abstract

本申请公开了一种队列控制的方法及装置,旨在灵活调整队列的队列阈值,降低报文被丢弃的概率,提高报文转发的可靠性。其中,所述队列控制的方法包括:第一设备获取第一队列的丢包参数,所述第一队列的丢包参数根据因无法加入所述第一队列被丢弃的报文确定;所述第一设备判断所述第一队列的丢包参数是否大于第一丢包阈值;当所述第一队列的丢包参数大于所述第一丢包阈值时,所述第一设备增加第一缓存参数,所述第一缓存参数用于调整所述第一队列的队列阈值,所述第一队列的队列阈值表示允许所述第一队列缓存的报文的最大字节总数。

Description

一种队列控制的方法及装置
本申请要求于2021年12月21日提交中国国家知识产权局、申请号为202111575784.7、发明名称为“一种队列控制的方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及通信技术领域,尤其涉及一种队列控制的方法及装置。
背景技术
通信网络中的设备可以通过出端口与其他设备连接,并通过出端口向其他设备发送报文。为了保证报文的传输质量,可以为网络设备的出端口配置队列。设备可以将需要通过出端口发送的报文缓存在队列中,并通过队列调度算法将队列中缓存的报文调度出队。被调度出队的报文可以通过出端口向其他设备发送。
设备允许队列中缓存的报文的最大字节总数可以被称为队列阈值。也就是说,队列中缓存的报文的字节数之和不超过队列阈值。在队列中缓存的报文的总字节数达到队列阈值之后,设备拒绝新报文加入队列。例如,设备可以将队列中缓存的报文的总字节数达到队列阈值之后接收到的新报文丢弃。
但是,上述队列控制的方法会增加报文被丢弃的概率,影响报文的正常传输。
发明内容
本申请提供了一种队列控制的方法及装置,旨在灵活调整队列的队列阈值,降低报文被丢弃的概率,提升报文转发的可靠性。
第一方面,本申请提供了一种队列控制的方法,该方法应用于第一设备,第一设备例如可以是交换机等网络设备。例如,第一设备获取第一队列的丢包参数并判断第一队列的丢包参数是否大于第一丢包阈值。其中,第一队列可以是第一设备的端口对应的队列,也可以是除第一设备以外的其他设备的端口对应的队列。第一队列的丢包参数是根据因无法加入第一队列,而被第一设备丢弃的报文的数量或字节总数确定的,例如可以是第一设备在设定时间内丢弃的、本应加入第一队列的报文的字节总数。第一丢包阈值为第一设备调整第一缓存参数的下限值。如果第一队列的丢包参数大于第一丢包阈值,说明第一设备因无法将报文加入第一队列而丢弃了较多报文。那么为了降低报文被丢弃的概率,第一设备可以增加第一缓存参数,并根据增加后的第一缓存参数控制报文加入第一队列。其中,第一缓存参数用于调整第一队列的队列阈值。第一队列的队列阈值表示允许第一队列缓存的报文的最大字节总数。也就是说,第一设备可以根据因无法加入第一队列而被丢弃的报文的情况,调整用于确定第一队列的队列阈值的第一缓存参数。这样,第一设备可以灵活地根据第一队列丢包的情况调整第一队列的队列阈值。如此,可以避免报文因第一队列中缓存的报文的字节总数达到第一队列的队列阈值而被丢弃,降低报文被丢弃的概率,提升报文转发的可靠性。
在一种可能的设计中,第一缓存参数表示第一队列可占用的缓存空间与第一队列所在的端口的剩余缓存空间之间的比例。其中,所述剩余缓存空间为第一队列所在的端口的总缓存空间中未被占用的缓存空间。也就是说,第一缓存参数表示第一队列所在的端口剩余 的缓存空间中,有多少比例的缓存空间能够被分配给第一队列。相应地,在将报文加入第一队列的过程中,第一设备先获取第一队列所在的端口的剩余缓存空间。接着,第一设备根据第一队列所在的端口的剩余缓存空间和第一缓存参数,计算第一队列能够额外占用的缓存空间,并将第一队列已占用的缓存空间和第一队列能够额外占用的缓存空间之和作为第一队列的队列阈值。这样,第一设备可以根据第一队列的队列阈值确定是否将报文加入第一队列,将第一队列中缓存的报文的字节总数限制在第一队列的队列阈值以下。可选地,在第一队列中缓存的报文的字节总数达到第一队列的队列阈值之后,第一设备可以再次获取第一队列所在的端口的剩余缓存空间,并根据第一缓存参数再次计算第一队列的队列阈值。
在一种可能的设计中,为避免第一队列占用的缓存空间过大影响其他队列,前述第一缓存参数不大于缓存参数上限。例如,第一设备在增加第一缓存参数之前,可以先确定第一缓存参数小于缓存参数上限,或确定增加后的第一缓存参数小于(或小于等于)缓存参数上限。这样,第一队列能够额外占用的缓存空间与第一队列所在的端口的剩余缓存空间的比例不超过缓存参数上限,使得第一队列不会过度侵占第一队列所在的端口的剩余缓存空间,以保证第一所列所在的端口对应的其他队列有足够的缓存空间用于缓存报文。
在上述可能的设计中,第一队列的丢包参数大于第一丢包阈值。在另一种可能的设计中,如果第一队列的丢包参数小于或等于第一丢包阈值,第一设备降低第一缓存参数。例如,在获取到第一队列的丢包参数之后,第一设备可以判断第一队列的丢包参数是否小于第二丢包阈值。如果第一队列的丢包参数小于(或小于等于)第二丢包阈值,第一设备可以减小第一缓存参数,以减小第一队列能够额外占用的第一队列所在的端口的剩余缓存空间的比例,使得第一队列不会过度侵占第一队列所在的端口的剩余缓存空间。可选地,上述第二丢包阈值可以等于第一丢包阈值,也可以小于第一丢包阈值。
在一种可能的设计中,第一设备周期性调整第一缓存参数。例如,第一设备可以周期性获取第一队列的丢包参数,并在每次获取到第一队列的丢包参数之后,根据第一队列的丢包参数与第一丢包阈值之间的大小关系,调整第一缓存参数。
在一种可能的设计中,第一设备根据多个周期中第一队列的丢包参数,调整第一缓存参数。以第一设备在第i个周期内减小第一缓存参数为例,第一设备可以获取第i个周期的前M个周期中,每个周期内第一队列的缓存参数。其中,i和M为正整数,且M小于i。接着,第一设备可以判断第一队列的丢包参数是否在第i个周期的前M个周期中均小于第二丢包阈值。如果第一队列的丢包参数在第i个周期的前M个周期中均小于第二丢包阈值,说明在当前周期之前的连续M个周期内,需要加入第一队列的报文被丢弃的概率较小,第一设备可以减小第一缓存参数。
在一种可能的设计中,第一设备根据第一队列中缓存报文的情况确定是否需要减小第一缓存参数。以第一设备在第i个周期内减小第一缓存参数为例,第一设备可以获取第一队列在第i个周期的前M个周期中每个周期结束时,第一队列缓存报文的情况。如果在第i个周期的前M个周期中每个周期结束时,第一队列均缓存的报文的字节总数小于或等于设定的阈值,说明每个周期内加入第一队列的报文较少,第一设备可以减小第一缓存参数。
在一种可能的设计中,第一设备存储每个周期内的丢包参数,以便后续过程中利用存储的第一队列的丢包参数判断是否调整第一缓存参数。
在一种可能的设计中,第一队列所在的端口还包括第二队列。其中,第一队列用于转发小流的报文,第二队列用于转发大流的报文。可选地,将包括的报文数小于等于N的数据流称为小流,将包括的报文数大于N的数据流称为大流,当第一设备接收到一条数据流A的第一个报文时,先将该数据流A作为小流通过第一队列转发,当该数据流A的报文数大于N时,则从第N+1个报文开始,将该数据流A作为大流通过第二队列转发。此时虽然第一队列中可能仍然存在数据流A的报文,但是仍然认为第一队列处理的全都是小流的报文。
在一种可能的设计中,为了将小流报文能够加入第一队列,且将大流报文加入第二队列,第一设备根据第一队列的转发参数和第二队列的转发参数调整所述N。例如,所述转发参数可以包括平均报文长度和/或转发速率。第一设备先获取第一队列的转发参数和第二队列的转发参数。接着,第一设备计算第一队列的转发参数和第二队列的转发参数的比值,并将计算得到的比值与期望比值相比较。如果计算得到的比值与期望比值不匹配,说明大流和小流的划分不合理,那么第一设备可以调整N,以改变进入第一队列和第二队列的报文的数量,并保证小流的转发指标,例如,流完成时间(flow completion time,FCT)等转发指标。
在一种可能的设计中,所述期望比值为0.25。
在一种可能的设计中,第一设备根据第一队列的转发参数和第二队列的转发参数的比值与期望比值大小关系调整N。例如,如果第一队列的转发参数和第二队列的转发参数的比值大于期望比值,说明过多报文被缓存到第一队列。第一设备可以减小N,以减小加入第一队列的报文的数量;如果第一队列的转发参数和第二队列的转发参数的比值小于期望比值,说明存在过多报文被缓存到第二队列,第一设备可以增加N,以增加加入第一队列的报文的数量。
在一种可能的设计中,如果第一队列的转发参数和第二队列的转发参数的比值在期望比值的可信范围之内,第一设备不调整所述N。例如,上述第一队列的转发参数和第二队列的转发参数的比值大于期望比值,可以包括第一队列的转发参数和第二队列的转发参数的比值大于期望比值的可信范围内的上限值;上述第一队列的转发参数和第二队列的转发参数的比值小于期望比值,可以包括第一队列的转发参数和第二队列的转发参数的比值小于期望比值的可信范围内的下限值。
在一种可能的设计中,第一设备可以概率丢弃待加入第二队列的报文。例如,在第二队列中缓存的报文的字节总数达到启动阈值,且第二队列中缓存的报文的字节总数小于第二队列的停止阈值时,第一设备可以根据第二队列中缓存的报文的字节总数计算丢弃概率,并根据丢弃概率丢弃待加入第二队列的报文。其中,启动阈值小于停止阈值,停止阈值小于或等于第二队列的队列阈值。
在一种可能的设计中,第一设备采用加权随机早期检测(weighted random early detection,WRED)概率丢弃待加入第二队列的报文。
在一种可能的设计中,第一设备根据第一队列的丢包情况调整第二缓存参数,第二缓存参数用于指示第一设备概率丢弃待加入第二队列的报文。可选地,第二缓存参数可以包括上述启动阈值和停止阈值。例如,第一设备可以判断第一队列的丢包参数是否大于第三丢包阈值。如果第一队列的丢包参数大于第三丢包阈值,第一设备可以调整第二缓存参数,以增加第一设备丢弃待加入第二队列的报文的概率,降低第二队列占用的缓存空间,从而提高第一队列所在的端口的剩余缓存空间,进而增加第一队列能够额外占用的缓存空间。可选地,第三丢包阈值可以等于前述第一丢包阈值和/或第二丢包阈值。
在一种可能的设计中,如果第二缓存参数包括启动阈值和停止阈值,第一设备调整第二缓存参数包括第一设备降低启动阈值和/或停止阈值。这样,相比调整前的第二缓存参数,调整后的第二缓存参数可以指示第一设备在第二队列中缓存的报文的字节总数更小的情况下开始丢弃待加入第二队列的报文,或者,在第二队列中缓存的报文的字节总数更小的情况下开始根据最大丢弃概率丢弃待加入第二队列的报文。如此,第一设备可以更多地丢弃待加入第二队列的报文,以增加第一队列所在的端口的剩余缓存空间。
在一种可能的设计中,第一设备根据第一队列在过去的若干个周期的丢包情况调整第二缓存参数,以减小第一设备丢弃待加入第二队列的报文的数量。以第一设备在第j个周期内调整第二缓存参数为例,第一设备可以获取第一队列在第j个周期的前K个周期中每个周期的丢包参数。如果第一队列在第j个周期的前K个周期中,每个周期内的丢包参数均小于第四丢包阈值,第一设备可以调整第二缓存参数,例如可以增加启动阈值和/或停止阈值,以减小第一设备丢弃待加入第二队列的报文的数量。其中,j和K为正整数,且K小于j,第四丢包阈值可以等于前述第一丢包阈值、第二丢包阈值和第三丢包阈值中的任意一个或多个。
在一种可能的设计中,第一设备在对计算得到的参数进行可信度校验。例如,在调整第一缓存参数、N和第二缓存参数中的任意一个或多个之后,第一设备可以对调整后的参数进行可信度校验。在可信度校验通过之后,第一设备根据调整后的参数控制第一队列。
第二方面,本申请提供了一种队列控制的方法,该方法应用于第一设备,第一设备例如可以是交换机等网络设备。第一设备的端口具有第一队列和第二队列。其中,第一队列用于转发小流的报文,所述小流包括的报文数小于等于N,N为整数,第二队列用于转发大流的报文。例如,所述队列控制的方法包括:第一设备先获取第一队列的转发参数和第二队列的转发参数。转发参数可以包括平均报文长度和/或转发速率。接着,第一设备可以计算第一队列的转发参数和第二队列的转发参数的比值,并将计算得到的比值与期望比值相比较。如果计算得到的比值与期望比值不匹配,说明大流和小流的划分不合理,那么第一设备可以调整N,以改变进入第一队列和第二队列的报文的数量,并保证小流的转发指标。如此,可以更好地区分数据流中的大流报文和小流报文,保障小流报文转发的可靠性。
第三方面,本申请提供了一种队列控制的方法,该方法应用于第一设备,第一设备例如可以是交换机等网络设备。第一设备的端口具有第一队列和第二队列。其中,第一队列用于转发小流的报文,所述小流包括的报文数小于等于N,N为整数,第二队列用于转发大流的报文。例如,所述队列控制的方法包括:第一设备获取第一队列的丢包参数并判断 第一队列的丢包参数是否大于第四丢包阈值。第一队列的丢包参数是根据因无法加入第一队列,而被第一设备丢弃的报文的数量或字节总数确定的,例如可以是第一设备在设定时间内丢弃的、本应加入第一队列的报文的字节总数。第四丢包阈值为第一设备调整第二缓存参数的下限值。如果第一队列的丢包参数大于第四丢包阈值,说明第一设备因无法将报文加入第一队列而丢弃了较多报文。那么为了降低报文被丢弃的概率,第一设备可以增加第二缓存参数,并根据第二缓存参数概率丢弃待加入第二队列的报文。这样,减小了第二队列中缓存的报文占用的缓存空间,进而增加第一队列所在的端口的剩余缓存空间,从而使得第一队列能够额外占用的缓存空间增加,相当于增加了第一队列的队列阈值。如此,第一队列能够缓存更多的报文,降低了待加入第一队列的报文被丢弃的概率,提升了小流报文转发的可靠性。
第四方面,本申请提供了一种队列控制的装置,所述装置应用于第一设备,包括用于实现上述第一方面及第一方面各实施方式所述的方法的一个或多个单元,所述第一个或多个单元可以通过软件、硬件或软件和硬件的结合实现。
第五方面,本申请提供了一种队列控制的装置,所述装置应用于第一设备,包括用于实现上述第二方面及第二方面各实施方式所述的方法的一个或多个单元,所述第一个或多个单元可以通过软件、硬件或软件和硬件的结合实现。
第六方面,本申请提供了一种队列控制的装置,所述装置应用于第一设备,包括用于实现上述第三方面及第三方面各实施方式所述的方法的一个或多个单元,所述第一个或多个单元可以通过软件、硬件或软件和硬件的结合实现。
第七方面,本申请提供了一种设备,所述设备包括处理器和存储器,所述存储器用于存储指令或程序代码,所述处理器用于从存储器中调用并运行所述指令或程序代码,以执行如前述第一方面、第二方面或第三方面任一方面及其各实现方式所述的队列控制的方法。
第八方面,本申请提供了一种芯片,用于执行如前述第一方面、第二方面或第三
方面任一方面及其各实现方式所述的队列控制的方法。
第九方面,本申请提供了一种计算机可读存储介质,包括指令、程序或代码,当其在计算机上执行时,使得所述计算机执行如前述第一方面、第二方面或第三方面任一方面及其各实现方式所述的队列控制的方法。
第五方面,本申请实施例提供了一种计算机可读存储介质,包括指令、程序或代码,当其在计算机上执行时,使得所述计算机执行如前述第一方面所述的报文调度的方法。
附图说明
图1为本申请实施例提供的网络***的一种结构示意图;
图2为本申请实施例提供的队列控制的方法的一种流程示意图;
图3为本申请实施例提供的队列控制的方法的另一种流程示意图;
图4为本申请实施例提供的队列处理的装置400的一种结构示意图;
图5为本申请实施例提供的一种设备500的结构示意图;
图6为本申请实施例提供的一种设备600的结构示意图。
具体实施方式
下面结合附图对本申请实施例提供的队列控制的方法及装置进行介绍。
设备可以包括一个或多个出端口,用于向其他设备发送报文。每个出端口可以对应一条或多条队列。队列用于缓存需要通过队列所在的出端口发送的报文。例如,设备一边将需要通过出端口发送的报文加入队列尾部,一边通过队列调度算法调度队列头部的报文出队。被调度出队的报文通过出端口向其他设备发送。如果队列中缓存的报文的总字节数达到队列阈值,设备拒绝新的报文加入队列。其中,队列中缓存的报文的字节总数指队列中缓存的全部报文的字节数之和。如果队列中缓存的报文的总字节数达到队列阈值,设备在接收到新报文之后可以将新报文丢弃。
如果网络中出现了突发流量,设备可能在短时间内接收到多条报文,导致队列中缓存的报文增多。如果队列中缓存的报文的总字节数达到了队列阈值,且突发流量仍未结束,那么设备会丢弃部分需要通过出端口发送的报文,增加报文的丢包率。
为了解决上述问题,本申请实施例提供了一种队列控制的方法,旨在灵活调整队列的队列阈值,降低报文被丢弃的概率,提高报文转发的可靠性。
本申请实施例提供的队列控制的方法可以应用于图1所示的网络。参见图1,该图为本申请实施例提供的一种网络***的结构示意图。在图1中,该网络***包括设备111和设备112。例如,设备111通过出端口A与设备112连接。出端口A上部署了至少一个队列。这些队列中缓存的报文被调度出队后可以通过出端口A向设备112发送。
可选地,设备111和设备112可以是具有转发功能的网络设备,例如可以是路由器(router)或交换机(switch)等转发设备,还可以是服务器或者终端设备等具有转发功能的设备。例如,在一些可能的实现方式中,设备111和设备112可以是数据中心网络(data center network,DCN)中的网络设备,例如是DCN中的叶子(leaf)交换机或脊(spine)交换机。
下面结合图2对本申请实施例提供的技术方案进行介绍。参见图2,为本申请实施例提供的队列控制的方法的一种流程示意图,包括步骤S201-S204。
S201:第一设备获取第一队列的丢包参数。
首先介绍第一设备和第一队列。
在本申请实施例中,第一设备可以是网络***中用于转发报文的网络设备。第一设备包括第一端口,第一端口与第一队列相对应。例如,第一设备可以是图1所示实施例中的设备111或设备112。如果第一设备为图1所示实施例中的设备111,第一端口可以是设备111的端口A,第一队列可以是端口A对应的队列。可选地,如果第一端口与多条队列相对应,第一队列可以是第一端口所对应的多条队列中的任意一条队列。可选地,第一队列以及后文所述的第二队列中缓存的报文可以是数据报文,也可以是控制报文。
根据前文介绍可知,第一设备允许第一队列中缓存的报文的字节总数不超过第一队列的队列阈值。可选地,可以通过为第一队列划分存储空间,控制第一队列中缓存的报文的字节总数不超过第一队列的队列阈值。例如,可以根据第一队列的队列阈值为第一队列划分存储空间,用于存储加入第一队列的报文。这样,在第一队列中缓存的报文的字节总数 达到第一队列的队列阈值之后,第一队列的存储空间无法继续存储报文,第一设备可以将后续接收到的、需要通过第一队列调度的报文丢弃。例如,可以从第一设备的第一端口对应的存储空间中划分出部分存储空间,作为第一队列的存储空间。其中第一端口对应的存储空间可以是从第一设备的存储器中为第一端口划分的,也可以是第一设备上与第一端口相关联的存储器。所述存储器例如可以是内存或缓存(cache)。如果第一队列的队列阈值发生改变,第一设备可以调整为第一队列划分出的存储空间的大小。可选地,为第一队列划分的存储空间可以被称为第一队列的缓冲(buffer)。
下面介绍第一队列的丢包参数,以及第一设备获取第一队列的丢包参数的方法。
在本申请实施例中,第一队列的丢包参数是根据因无法加入第一队列被丢弃的报文确定的。其中,因无法加入第一队列被丢弃的报文是指原本应当加入第一队列,但是因为第一队列中缓存的报文的字节总数达到队列阈值,而被第一设备丢弃的报文。相应地,在转发报文的过程中,第一设备可以记录因无法加入第一队列被丢弃的报文的相关信息,从而得到第一队列的丢包参数。
在一种可能的实现方式中,第一设备可以周期性计算第一队列的丢包参数。那么第一队列在第i个周期内的丢包参数可以是第i个周期内因无法加入第一队列被丢弃的报文的字节总数。相应地,第一设备可以在第i个周期内,记录因无法加入第一队列被丢弃的报文的字节总数,作为第i个周期内第一队列的丢包参数。其中i为正整数。
或者,第一队列在第i个周期内的丢包参数是第i个周期内因无法加入第一队列被丢弃的报文的字节总数与第i个周期内第一队列中被调度出队的报文的字节总数之间的比值。那么第一设备可以记录第i个周期内从第一队列调度出队的报文的字节总数,和第i个周期内因无法加入第一队列被丢弃的报文的字节总数。
在一些其他的实现方式中,如果设备调度的报文长度相等,第一队列的丢包参数也可以是根据因无法加入第一队列被丢弃的报文的总数量确定。例如,第一队列在第i个周期内的丢包参数可以是第i个周期内因无法加入第一队列被丢弃的报文的总数量。
可选地,在确定第一队列在第i个周期内的丢包参数之后,第一设备可以存储第一队列在第i个周期内的丢包参数,以便第一队列在后续过程中判断是否需要调整第一缓存参数。
可以理解的是,第一队列也可以是第一设备以外其他设备的端口的队列,即第一队列所在的第一端口可以是第一设备以外其他设备的出端口。那么第一队列的丢包参数可以是第一队列所属的设备向第一设备上报的,或者是第一设备根据第一队列所属的设备上报的其他信息计算得到的。例如,第一设备可以是图1所示实施例中的设备112,第一队列可以是设备111中端口A的队列。相应地,设备111可以向设备112发送第一队列的丢包参数。或者,设备111可以向设备112发送第i个周期内从第一队列调度出队的报文的字节总数和第i个周期内因无法加入第一队列被丢弃的报文的字节总数,以便设备112计算第一队列的丢包参数。相应地,第一设备可以是服务器或控制器,第一队列所属的设备可以是交换机等网络设备。
S202:第一设备判断第一队列的丢包参数是否大于第一丢包阈值。
在获取到第一队列的丢包参数之后,第一设备可以判断第一队列的丢包参数是否大于第一丢包阈值。其中,第一丢包阈值为调整第一队列的队列阈值的下限值。如果第一队列的丢包参数达到第一队列的队列阈值,说明第一队列的丢包参数较高,因无法加入第一队列而被第一设备丢弃的报文的数量较多。那么第一设备可以执行S203,通过增加第一缓存参数增加第一队列的队列阈值的上限值,从而提高第一队列的队列阈值。这样,第一队列可以容纳更多的报文,降低报文被丢弃的概率。相应地,如果第一队列的丢包参数小于或等于第一丢包阈值,第一设备可以不对第一缓存参数进行处理,或减小第一缓存参数。关于这部分内容的介绍可以参见下文,这里不再赘述。
根据前文介绍可知,第一队列在第i个周期内的丢包参数可以是第i个周期内因无法加入第一队列被丢弃的报文的字节总数。那么第一阈值可以是0字节(byte)。也就是说,如果在第i个周期内,第一设备因第一队列中缓存的报文达到第一队列的队列阈值丢弃了任意报文,第一设备可以调整第一缓存参数,以增加第i+1个周期内第一队列的队列阈值。
S203:当第一队列的丢包参数大于第一丢包阈值,第一设备增加第一缓存参数。
在确定第一队列的丢包参数大于第一丢包阈值之后,第一设备可以增加第一缓存参数,例如第一设备可以将第一缓存参数加一或翻倍,或者,第一设备也可以根据第一队列的丢包参数增加第一缓存参数。其中,第一缓存参数用于调整第一队列的队列阈值。例如,第一缓存参数可以用于增加第一队列的队列阈值。那么随着第一缓存参数的增加,第一队列的队列阈值也会相应地增加,即增加了第一设备允许第一队列缓存的报文的字节总数。这样,即使出现了流量突发,由于第一队列的队列阈值增加,第一队列能够容纳更多的报文,降低了报文被丢弃的概率。
下面介绍第一缓存参数。
在一种实现方式中,第一缓存参数表示第一队列可额外占用的缓存空间。那么,第一队列的队列阈值可以是第一缓存参数与第一队列已占用的缓存空间之和。
在另一种实现方式中,第一缓存参数表示第一队列可额外占用的缓存空间与第一端口的剩余缓存空间的比值。其中,剩余缓存空间为第一端口的总缓存空间中未被占用的缓存空间。第一端口的总缓存空间为第一端口对应的所有队列的缓存空间的总和,例如可以是第一端口对应的存储器的缓存空间。也就是说,第一队列的队列阈值为第一队列已占用的缓存空间与上述第一队列的队列阈值可以增加的值之和,第一队列的队列阈值可以增加的值等于第一缓存参数与第一端口在当前时刻的剩余缓存空间的乘积。可以理解的是,第一端口可以对应多条队列。那么,第一缓存参数可以表示第一队列能够从多条队列剩余的缓存空间中额外抢占的缓存空间。
举例说明。假设第一端口的总缓存空间为100兆字节(megabyte,MB),且第一端口在T时刻被占用了60MB的缓存空间,第一队列的第一缓存参数对应的比例为0.25,那么第一队列能够额外占用的缓存空间为(100-60)*0.25=10MB。如果T时刻第一端口的总缓存空间中有20MB被第一队列占用,那么第一队列在T时刻的队列阈值为10+20=30MB。这样,假设第一报文对应的数据流在T时刻附近出现了流量突发,由于第一队列的队列阈值为30MB,只要突发的流量小于30MB,第一设备就不会因无法将报文加入第一队列而丢 弃报文,降低了报文被丢弃的概率。
可选地,为了防止第一队列的队列阈值过大,从而影响第一端口对应的其他队列的报文调度,可以设置第一缓存参数的上限。第一缓存参数的上限可以被称为缓存参数上限。在为增加第一缓存参数之前,第一设备可以确定第一缓存参数小于缓存参数上限。如果第一缓存参数大于或等于缓存参数上限,第一设备可以不增加第一缓存参数。
在一些可能的实现方式中,上述第一缓存参数可以通过阿尔法(alpha,α)值表示。其中,α值可以与第一缓存参数相等,也可以与第一缓存参数相对应。例如,α值可以为自然数,不同的取值可以对应不同的第一缓存参数。例如,假设第一缓存参数表示第一队列能够额外占用的缓存空间占第一端口的剩余缓存空间的0.125,那么α值可以等于0.125,也可以等于4。可选地,在一些可能的实现方式中,2的α减7次方为第一队列能够额外占用的缓存量与第一端口的剩余缓存量的比值。也就是说,如果α的值为4,那么第一队列能够额外占用的缓存量与第一端口的剩余缓存量的比值为2^(4-7)=1/8。如果α的值为5,那么第一队列能够额外占用的缓存量与第一端口的剩余缓存量的比值为2^(5-7)=1/4。相应地,上述缓存参数上限可以为8。
根据前文介绍可知,第一设备可以周期性获取第一队列的丢包参数。相应地,第一设备根据第i个周期内第一队列的丢包参数调整第i+1个周期内的第一缓存参数。在第i+1个周期内,第一设备可以根据第i+1个周期的第一缓存参数确定第一队列的队列阈值,并根据第一队列的队列阈值控制报文加入第一队列。在第i+1个周期结束时,第一设备可以根据第i+1个周期内第一队列的丢包参数,计算得到第i+2个周期内的第一缓存参数。也就是说,第一设备可以根据上个周期内第一队列的丢包参数,确定第一队列在本周期内对应的第一缓存参数,进而根据本周期内的第一缓存参数控制报文加入第一队列。如此,通过第一队列的历史丢包数据指导第一队列的队列阈值的调整,提高了第一队列的队列阈值的调整的灵活性,提升了报文转发的可靠性。
S204:根据第一缓存参数确定第一队列的队列阈值,并根据第一队列的队列阈值控制报文加入第一队列。
在确定第一缓存参数之后,第一设备可以根据第一缓存参数确定第一队列的队列阈值,并根据第一队列的队列阈值控制报文加入第一队列。例如,在接收到待加入第一队列的第一报文之后,第一设备可以获取第一队列中缓存的报文的总字节数,并根据第一队列中缓存的报文的总字节数将第一报文加入第一队列或丢弃第一报文。如果第一队列中缓存的报文的总字节数等于第一队列的队列阈值,第一设备可以丢弃第一报文,拒绝第一报文加入第一队列。如果第一队列中缓存的报文的总字节数小于第一队列的队列阈值,第一设备可以将第一报文加入第一队列的尾部。
或者,第一设备也可以根据第一队列中缓存的报文的总字节数与第一报文的字节数之和判断是否允许第一报文加入第一队列。如果第一队列中缓存的报文的总字节数小于第一队列的队列阈值,但是第一队列中缓存的报文的总字节数与第一报文的字节数之和大于第一队列的队列阈值,第一设备也可以拒绝第一报文加入第一队列,丢弃第一报文。
可选地。在第一设备根据第一缓存参数确定第一队列的队列阈值之前,第一设备还可 以先对第一缓存参数进行置信度判断,以确定第一缓存参数是否能够用于确定第一队列的队列阈值。例如,第一设备可以通过上限置信区间(Upper Confidence bounds applied to Trees,UCT)算法对第一缓存参数进行可信度校验,并在校验通过后再根据第一缓存采纳数确定第一队列的队列阈值。
可选地,在第一队列中缓存的报文达到第一队列的队列阈值之后,第一设备可以再次获取第一队列所在的端口的剩余缓存空间,并根据第一缓存参数再次计算第一队列的队列阈值。
可以理解的是,在第一个周期中,第一设备可以根据预先配置的第一缓存参数计算第一队列的队列阈值。
在上述介绍中,第一队列为第一设备上出端口的队列。可以理解的是,如果第一队列不属于第一设备的出端口,第一设备可以在确定第一缓存参数后向第一队列所属的设备发送第一缓存参数。这种情况下,S204可以由第一队列所属的设备执行。
在本申请实施例中,第一设备还可以减小第一缓存参数,以降低第一队列的队列阈值能够增加的上限。如此,可以限制第一队列能够占用的最大缓存空间,以使第一端口对应的其他队列能够占用更多的缓存空间。
在一些可能的实现方式中,第一设备可以根据第一队列的丢包参数的大小判断是否需要调整第一缓存参数。
例如,在上述S202中,第一设备判断第一队列的丢包参数是否大于第一丢包阈值。如果第一队列的丢包参数小于或等于第一丢包阈值,第一设备可以进一步判断第一队列的丢包参数是否小于第二丢包阈值。如果第一队列的丢包参数小于第二丢包阈值,第一设备可以减小第一缓存参数,例如第一设备可以将第一缓存参数减一或除二,或者,第一设备也可以根据第一队列的丢包参数减小第一缓存参数。其中,第二丢包阈值可以小于第一丢包阈值,也可以等于第一丢包阈值。根据前文介绍可知,第一设备可以周期性获取第一队列的丢包参数。那么在一些其他的实现中,第一设备可以获取第一队列在当前周期的前M个周期内每个周期的丢包参数,并基于第一队列在当前周期的前M个周期内的丢包参数判断是否需要增加第一缓存参数,其中M为正整数。例如,第一设备可以获取在过去的20个周期存储的第一队列的丢包参数。如果在过去20个周期内每个周期中,第一队列的丢包参数均小于第二丢包阈值,第一设备可以减小第一缓存参数。
在一些可能的实现方式中,第一设备还可以进一步结合第一队列在周期结束时缓存的报文的字节总数判断是否需要减小第一缓存参数。例如,第一设备可以获取第一队列在当前周期的前K个周期中每个周期结束时缓存的报文的字节总数(K为正整数),并结合第一队列在当前周期的前K个周期中每个周期结束时缓存的报文的字节总数以及丢包参数确定是否需要减小第一丢包参数。
可选地,上述K和M可以相等。那么在第i个周期结束时,第一设备可以获取第i个周期的前M个周期内每个周期结束时第一队列缓存报文的情况,以及第i个周期的前M个周期内每个周期结束时每个周期内第一队列的丢包参数。如果第一队列在第i个周期的前M个周期内的每个周期的丢包参数均小于第二丢包阈值,且第一队列在第i个周期的前M 个周期内的每个周期结束时缓存的报文的字节总数小于或等于设定的阈值,第一设备可以减小第一设备的第一缓存参数。
在本申请实施例中,第一设备可以基于第一端口向第二设备发送一条或多条数据流。其中,第二设备可以是与第一设备连接的任意设备,且第一设备通过第一端口与第二设备连接。例如,如果第一设备为图1中的设备111,第一端口为设备111的出端口A,那么第二设备可以为图1中的设备112。
在本申请实施例中,数据流可以是设备通过端口连续发送的具有相同特征的多个报文。该特征例如可以是五元组(即源IP地址,目的IP地址,源端口,目的端口和协议号)中的一项或多项,或者是包括在报文中的流标识。具有相同的特征的两个报文的发送间隔超过设定的时间,该两个报文可以认为属于不同的数据流。
如果数据流基于传输控制协议(Transmission Control Protocol,TCP)传输,那么第一设备在向第二设备发送报文之前,可以先建立与第二设备之间的连接。接着,第一设备可以通过连接向第二设备发送一个或多个报文。在发送完报文之后,第一设备可以断开与第二设备之间的连接。在断开连接之后,如果第一设备获取到了新的需要向第二设备发送的报文,第一设备可以再次建立与第二设备之间的连接。相应地,从建立连接之后,到该连接被第一设备断开之前,第一设备发送的全部报文可以被视为同一条数据流中的报文。
在本申请实施例中,可以根据数据流所包括的报文的数量将数据流分为小流和大流。例如,包括的报文数小于等于N的数据流可以被称为小流,包括的报文数大于N的数据流可以被称为大流。小流用于承载小流业务,大流用于承载大流业务。其中,大流业务对有效吞吐量(goodput)等与吞吐量(throughput)相关的参数要求较高。小流业务对FCT和每秒查询率(queries per second,QPS)等参数要求较高。可选地,第一队列可以用于转发小流的报文,第二队列可以用于转发大流的报文。为了方便,本申请中小流业务的报文又可以被称为小流的报文,大流业务的报文又可以被称为大流的报文。
在一些可能的实现方式中,第一设备转发的数据流可以包括大流和小流。由于大流业务和小流业务的需求不同,通过一条队列同时调度大流和小流,可能无法保证小流业务的正常传输。在本申请实施例中,第一设备可以将每条数据流中前N个报文作为小流的报文加入第一队列,并将该数据流中除前N个报文以外的其他报文作为大流的报文加入第二队列。如果某条数据流的报文总数小于N,该数据流的全部报文进入第一队列。可以理解的是,大流的报文可以用于承载待传输的数据。因此一条数据流中大流的报文的数量较多,且每个大流的报文的字节数较多。其中,第二队列属于第一端口,例如第二队列可以是第一端口中标识为3的队列。可选地,第二队列的调度优先级低于第一队列的调度优先级。
但是,在DCN等网络中,流量突发的频率较高,且存在较多的微突发现象。在出现流量突发之后,第一设备可能在较短时间内接收到多条数据流。这样,如果第一设备将多条数据流中每条数据流的前N个报文作为小流的报文加入第一队列,导致第一队列中缓存的报文的字节总数达到第一队列的队列阈值。这样,第一设备可能会丢弃后续接收到的小流的报文,从而影响小流的报文的FCT等参数。
采用本申请实施例提供的队列控制的方法,第一设备可以根据第一队列的丢包参数调 整第一缓存参数。如果第一队列在上个周期内存在丢包,第一设备可以增加第一缓存参数。这样,在下一个周期内,如果小流的报文出现流量突发,第一设备接收到了较多的小流的报文,第一设备可以根据第一缓存参数确定第一队列能够额外占用的缓存空间,进而增加第一队列的队列阈值,使得第一队列能够容纳更多的小流的报文,避免因第一队列中缓存的报文达到第一队列的队列阈值而丢弃小流的报文。如此,第一设备可以根据第一队列的丢包情况调整第一队列的队列阈值,使得第一队列的队列阈值可以根据小流的报文的传输情况灵活调整,降低了小流的报文被丢弃的概率,提升了小流的报文转发的可靠性。
进一步地,如果网络设备按照固定的N确定每个数据流中加入第一队列的报文的数量,可能导致大流的报文被加入第一队列,或者导致小流的报文加入第二队列。在本申请实施例中,加入第一队列的报文被视为小流的报文,加入第二队列的报文被视为大流的报文。也就是说,如果大流业务的报文被加入了第一队列,那么第一设备会将其视为小流的报文进行调度;如果小流业务的报文被加入第二队列,第一设备会将小流业务的报文视为大流的报文进行调度。如此,混淆大流业务的报文与小流业务的报文,可能对小流的报文的传输产生影响。
以图1为例进行说明,假设设备111通过出端口A传输了数据流X和数据流Y两条数据流。其中,数据流X中包括10个报文,数据流Y中包括20个报文。如果设备111用于区分小流的报文和大流的报文的值为N=15,那么对于数据流X的10个报文全部被加入第一队列,数据流Y的15个报文也被加入第一队列,而第二队列中只加入了数据流Y的5个报文,这时,第一队列的调度更慢。可见,如果区分大流的报文和小流的报文时所使用的N值固定,可能影响小流的报文的正常传输。
为此,在调整第一缓存参数的基础上,本申请实施例提供的队列控制的方法还可以调整用于区分小流和大流的N。下面进行详细介绍。
参见图3,为本申请实施例提供的队列控制的方法的另一种流程示意图,包括步骤S301-S304。
S301:第一设备获取第一队列的转发参数和第二队列的转发参数。
为了判断用于区分大流和小流的N值是否合理,第一设备可以先获取第一队列的转发参数和第二队列的转发参数。其中,第一队列的转发参数可以包括第一队列的平均报文长度和/或第一队列的转发速率。相似地,第二队列的转发参数可以包括第二队列的平均报文长度和/或第二队列的转发速率。下面以第一队列为例,对平均报文长度和转发速率进行介绍。
其中,平均报文长度为被调度出队的报文的平均字节数。也就是说,第一队列的平均报文长度为从第一队列出队的报文的平均字节数。相应地,第一设备可以记录从第一队列出队的报文的数量,以及每个报文的字节数。接着,第一设备可以对多个报文的字节数求和,并将求和得到的结果除以从第一队列出队的报文数量,得到的结果即为第一报文的平均报文长度。
转发速率为设定时间内队列被调度出队的字节数。也就是说,第一队列的转发速率为设定时间内从第一队列出队的报文的字节数。相应地,第一设备可以记录从一段时间内从 第一队列出队的每个报文的字节数。接着,第一设备可以将这段时间内对多个报文的字节数求和,并将求和得到的结果除以这段时间,得到的结果即为第一报文的转发速率。
根据前文介绍可知,第一设备可以周期性获取第一队列的丢包参数。相似地,第一设备也可以周期性计算第一队列的转发参数。例如,第一设备可以记录周期内从第一队列被调度出队的报文的相关参数,并计算得到报文在该周期的转发参数。例如,第一设备可以记录第i个周期内从第一队列被调度出队的报文总数量,以及每个报文的字节数。基于此,第一设备可以计算得到第i个周期内第一队列的平均报文长度。结合周期的时长,第一设备也可以计算得到第i个周期内第一队列的转发速率。
关于第二队列的转发参数的计算方法可以参照上文第一队列的转发参数的计算方法,这里不再赘述。
可以理解的是,上述计算第一队列的转发参数和第二队列的转发参数的方法可以由第一设备执行,也可以由其他设备执行。如果上述计算方法由第三设备执行,第一设备获取第一队列的转发参数和第二队列的转发参数可以包括:第一设备接收第三设备发送的第一队列的转发参数和第二队列的转发参数。
S302:第一设备判断第一队列的转发参数和第二队列的转发参数的比值与期望比值是否匹配。
在获取到第一队列的转发参数和第二队列的转发参数之后,第一设备可以计算第一队列的转发参数与第二队列的转发参数之比,并判断第一队列的转发参数与第二队列的转发参数的比值与期望比值是否匹配。如果第一队列的转发参数与第二队列的转发参数的比值与期望比值相匹配,第一设备可以不调整所述N;如果第一队列的转发参数与第二队列的转发参数的比值与期望比值不匹配,第一设备可以执行S303以调整所述N。
可选地,所述第一队列的转发参数和所述第二队列的转发参数的比值与期望比值不匹配,可以包括所述第一队列的转发参数和所述第二队列的转发参数的比值超出期望比值的可信范围。其中,期望比值的可信范围是一个以期望比值为基准,上下小范围波动的范围。例如,假设期望比值为0.25,可信范围为4%,那么期望比值的可信范围可以是[0.24 0.26]。
如果第一队列的转发参数和所述第二队列的转发参数的比值小于期望比值的可信范围的上限值,且第一队列的转发参数和所述第二队列的转发参数的比值大于期望比值的可信范围的下限值,第一设备可以确定第一队列的转发参数和所述第二队列的转发参数的比值与期望比值相匹配。
如果第一队列的转发参数和所述第二队列的转发参数的比值大于期望比值的可信范围的上限值,或者第一队列的转发参数和所述第二队列的转发参数的比值小于期望比值的可信范围的下限值,第一设备可以确定第一队列的转发参数和所述第二队列的转发参数的比值与期望比值不匹配。
S303:当第一队列的转发参数和第二队列的转发参数的比值与期望比值不匹配,第一设备调整N。
根据S301中的介绍可知,转发参数可以包括平均报文长度和/或转发速率,下面分别进行介绍。
在第一种实现方式中,转发参数包括平均报文长度。那么第一设备可以计算第一队列的平均报文长度和第二队列的平均报文长度的比值。第一队列的平均报文长度和第二队列的平均报文长度的比值越高,说明第一队列中报文的平均字节数相对第二队列中报文的平均字节数越大。在实际应用场景中,小流的报文的长度往往远小于大流的报文的长度。如果第一队列只用于调度小流的报文,那么第一队列的平均报文长度应当远小于第二队列的平均报文长度。
因此,如果第一队列的平均报文长度和第二队列的平均报文长度的比值高于期望比值,说明第一队列的平均报文长度大于小流的报文的平均报文长度,第一队列中存在大流的报文。也就是说,第一设备将第一数据流中部分大流的报文加入了第一队列,N大于第一数据流中小流的报文的数量。那么第一设备可以减小N,以避免大流的报文加入第一队列。
相反地,如果第一队列的平均报文长度和第二队列的平均报文长度的比值小于期望比值,说明第二队列的平均报文长度小于大流的报文的平均报文长度,第二队列中存在小流的报文。也就是说,第一设备将第一数据流中部分小流的报文加入第二队列中,N小于第一数据流中小流的报文的数量。那么第一设备可以增加N,以避免小流的报文加入第二队列。
在第二种实现方式中,转发参数包括转发速率。那么第一设备可以计算第一队列的转发速率和第二队列的转发速率的比值。如果第一队列的转发速率和第二队列的转发速率的比值越高,说明第一队列中报文的转发速率相对第二队列中报文的转发速率越快。
在实际应用场景中,小流的报文的数量和字节总数往往远小于大流的报文的数量。因此,第一设备发送小流的报文所占用的带宽,应当小于第一设备发送大流的报文所占用的带宽。
如果第一队列的转发速率和第二队列的转发速率的比值高于期望比值,说明第一队列占用的带宽大于转发小流的报文所需占用的带宽,第一队列中存在大流的报文。也就是说,第一设备将部分大流的报文加入第一队列中,那么第一设备可以减小N,以减少加入第一队列的报文的数量,避免大流的报文加入第一队列。
如果第一队列的转发速率和第二队列的转发速率的比值小于期望比值,说明第二队列占用的带宽的小于转发大流的报文所需占用的带宽,第二队列中存在小流的报文。也就是说,第一设备将部分小流的报文加入第二队列中,N不能恰当地划分大流和小流。那么第一设备可以增加N,以增加加入第一队列的报文的数量,避免小流的报文加入第二队列。
根据前文介绍可知,所述第一队列的转发参数和所述第二队列的转发参数的比值与期望比值不匹配,可以包括所述第一队列的转发参数和所述第二队列的转发参数的比值超出期望比值的可信范围。相应地,上述第一队列的平均报文长度和第二队列的平均报文长度的比值大于期望比值,包括第一队列的平均报文长度和第二队列的平均报文长度的比值大于期望比值的可信范围的上限值;上述第一队列的平均报文长度和第二队列的平均报文长度的比值小于期望比值,包括第一队列的平均报文长度和第二队列的平均报文长度的比值小于期望比值的可信范围的下限值;上述第一队列的转发速率和第二队列的转发速率的比值大于期望比值,包括第一队列的转发速率和第二队列的转发速率的比值大于期望比值的 可信范围的上限值;上述第一队列的转发速率和第二队列的转发速率的比值小于期望比值,包括第一队列的转发速率和第二队列的转发速率的比值小于期望比值的可信范围的下限值。
与第一缓存参数类似,第一设备在计算得到N之后也可以对N进行可信度校验。
S304:第一设备根据N控制报文加入第一队列。
在确定所述N之后,第一设备可以根据N控制报文加入第一队列或第二队列。例如,第一设备接收到了新的需要通过第一端口发送的数据流,第一设备可以根据调整后的N,将数据流的前N个报文加入第一队列,并将数据流中除前N个报文以外的其他报文加入第二队列。
可以理解的是,在第一个周期中,第一设备可以根据预先配置的N控制数据流中的报文加入第一队列或第二队列。
如此,可以根据第一设备转发的数据流的情况,调整用于区分大流的报文和小流的报文的N的值,可以减少小流的报文被加入第二队列的概率,以及大流的报文被加入第一队列的概率,提升了报文转发的可靠性。
可以理解的是,上述调整N的技术方案可以在图2所示的调整第一缓存参数的技术方案的基础上实现,也可以独立实现。
在本申请实施例中,为了避免小流的报文因无法加入第一队列被丢弃,第一设备可以调整第一缓存参数。第一缓存参数为第一队列能够进一步占用的缓存空间,与第一端口的剩余缓存空间之间的比值。如此,第一队列可以在小流的报文出现流量突发之后占用更多的缓存空间,以容纳突发的小流的报文。
但是,如果第一端口的其他队列(例如第二队列)占用的缓存空间较多,第一端口的剩余缓存空间可能相对较少。那么即使第一设备增加了第一缓存参数,第一队列能够占用的剩余缓存空间有限,仍然存在第一设备因无法将小流的报文加入第一队列而丢弃小流的报文的可能。
根据前文介绍可知,第一设备可以在第一队列中缓存的报文的字节总数达到第一队列的队列阈值之后,丢弃新的待加入第一队列的报文。相似地,上述第二队列也可以具有队列阈值,第一设备可以在第二队列中缓存的报文的字节总数达到第二队列的队列阈值之后,丢弃新的待加入第二队列的报文。为了解决前述问题,在本申请实施例中,第一设备可以在第二队列中缓存的报文的字节总数达到第二队列的队列阈值之前,丢弃部分待加入第二队列的报文。这样,减少了第二队列占用的缓存空间,增加了第一端口的剩余缓存空间,从而增加了第一队列能够占用的缓存空间,提升了小流的报文转发的可靠性。
可选地,第一设备可以根据第二缓存参数确定丢弃概率,进而根据丢弃概率丢弃待加入第二队列的报文。
在一些可能的实现方式中,第一设备根据第一队列的丢包参数调整第二缓存参数。例如,第一设备可以比较第一队列的丢包参数和第三丢包阈值的大小。第三丢包阈值可以等于前述第一丢包阈值或第二丢包阈值。如果第一队列的丢包参数大于第三丢包阈值,第一 设备可以调整第二缓存参数,以增加第一设备丢弃待加入第二队列的报文的概率。
例如,第一设备可以采用WRED算法,概率丢弃部分待加入第二队列的报文。相应地,上述第二缓存参数可以包括启动阈值(又称低门限)和停止阈值(又称高门限)。可选地,第二缓存参数还可以包括最大丢弃概率。
例如,在第二队列中缓存的报文达到WRED算法的启动阈值,第一设备可以根据第二队列中缓存的报文的字节总数确定丢弃概率,并根据丢弃概率丢弃待加入第二队列的报文。随着报文加入第二队列,第二队列中缓存的报文的总字节数逐渐增加,第一设备丢弃报文的概率也逐渐增加。在第二队列缓存的报文的字节总数达到停止阈值之后,第一设备可以根据固定概率丢弃待加入第二队列的报文。随着第二队列中缓存的报文的字节总数进一步的增多,第二队列中缓存的报文的字节总数达到第二队列的队列阈值,第一设备可以丢弃全部待加入第二队列的报文。可选地,所述固定概率可以被称为最大丢弃概率。所述停止阈值可以等于第二的队列阈值。
相应地,如果第一队列的丢包参数大于第三丢包阈值,第一设备可以降低第二缓存参数中的启动阈值和/或停止阈值。这样,相较于降低前的第二缓存参数,第一设备可以在第二队列缓存的报文的字节总数更小的情况下开始丢弃待加入第二队列的报文,或者在第二队列缓存的报文的字节总数更小的情况下根据最大丢弃概率丢弃待加入第二队列的报文。第一设备也可以在第一队列的丢包参数大于第三丢包阈值时增加前述最大丢弃概率。如此,增加了待加入第二队列的报文被丢弃的概率,降低了第二队列占用的缓存空间,从而增加了第一端口的剩余缓存空间,使得第一队列能够占用更多的缓存空间,提升了小流的报文转发的可靠性。
在一些可能的实现方式中,可以配置多组第二缓存参数。不同组第二缓存参数的启动阈值和/或停止阈值可以不同。如果第一队列的丢包参数大于第三丢包阈值,第一设备可以选择启动阈值和/或停止阈值低于当前的第二缓存参数的第二缓存参数,作为下个周期的第二缓存参数。也就是说,第一设备可以具有多个等级的第二缓存参数,并根据第一队列的丢包参数在多个等级的第二缓存参数中进行调整。
可以理解的是,在第一个周期中,第一设备可以根据预先配置的第二缓存参数控制报文加入第二队列。可选地,所述预先配置的第二缓存参数的启动阈值可以是第二队列的队列阈值的三分之二,所述预先配置的第二缓存参数的停止阈值可以是第二队列的队列阈值。
在本申请实施例中,为了降低大流的报文被丢弃的概率,第一设备也可以调高第二缓存参数中的启动阈值和停止阈值。例如,第一设备可以判断在当前周期之前的K个周期内,第一队列的丢包参数是否大于第四丢包阈值。所述第四丢包阈值可以等于第三丢包阈值。如果在当前周期之前的K个周期内,第一队列的丢包参数均不大于第四丢包阈值,说明小流的报文在过去的K个周期内被丢弃的概率较小,第一设备可以增加启动阈值和/或停止阈值,以降低待加入第二队列的报文被丢弃的概率,提升大流的报文转发的可靠性。
与前述第一设备降低第一缓存参数的方法相似,第一设备也可以在确定当前周期之前的K个周期内,第一队列的丢包参数不大于第四丢包阈值,且第一队列在每个周期结束时缓存的报文的字节总数小于或等于设定的阈值之后,再增加启动阈值和/或停止阈值。关于 第一设备确定和调整的具体方法可以参见前文,这里不再赘述。
可以理解的是,上述调整第二缓存参数的技术方案可以在图2所示的调整第一缓存参数的技术方案和/或图3所示的调整N的技术方案的基础上实现,也可以独立实现。
参见图4,本申请实施例还提供了一种队列控制的装置400,该队列控制的装置400可以实现图2或图3所示实施例中第一设备的功能。该队列控制的装置400包括获取单元410、判断单元420和处理单元430。其中,获取单元410用于实现图2所示实施例中的S201或图3所示实施例中的S301,判断单元420用于实现图2所示实施例中的S202或图3所示实施例中的S302,处理单元430用于实现图2所示实施例中的S203和S204,或图3所示实施例中的S303和S304。
具体的,获取单元410,用于获取第一队列的丢包参数,所述第一队列的丢包参数根据因无法加入所述第一队列被丢弃的报文确定。
判断单元420,用于判断所述第一队列的丢包参数是否大于第一丢包阈值。
处理单元430,用于当所述第一队列的丢包参数大于所述第一丢包阈值时,增加第一缓存参数,所述第一缓存参数用于调整所述第一队列的队列阈值,所述第一队列的队列阈值表示允许所述第一队列缓存的报文的最大字节总数。
或者,获取单元410,用于确定第一队列的转发参数和第二队列的转发参数,所述第一队列和所述第二队列属于同一端口,所述第一队列中的报文包括所述第一设备转发的目标数据流中的前N个报文,所述目标数据流与所述第二队列相对应,所述N为正整数,所述转发参数包括平均报文长度和/或转发速率。
判断单元420,用于判断第一队列的转发参数和第二队列的转发参数的比值与期望比值是否匹配。
处理单元430,用于当第一队列的转发参数和第二队列的转发参数的比值与期望比值不同时,调整所述N。
或者,获取单元410,用于获取第一队列的丢包参数,所述第一队列的丢包参数根据因无法加入所述第一队列被丢弃的报文确定,所述第一队列和所述第二队列属于同一端口,所述第一队列中的报文包括所述第一设备转发的目标数据流中的前N个报文,所述目标数据流与所述第二队列相对应,所述N为正整数。
判断单元420,用于判断所述第一队列的丢包参数是否大于第四丢包阈值。
处理单元430,用于当所述第一队列的丢包参数大于所述第四丢包阈值时,调整第二缓存参数;根据所述第二缓存参数概率丢弃待加入所述第二队列的报文。
具体执行过程请参考上述图2或图3所示实施例中相应步骤的详细描述,这里不再一一赘述。
需要说明的是,本申请实施例中对单元的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。本申请实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。例如,上述实施例中,处理单元和发送单元可以是同一个单元,也不同的单元。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
图5是本申请实施例提供的一种设备500的结构示意图。上文中的队列控制的装置400可以通过图5所示的设备来实现。参见图5,该设备500包括至少一个处理器501,通信总线502以及至少一个通信接口504,可选地,该设备500还可以包括存储器503。
处理器501可以是一个通用中央处理单元(central processing unit,CPU)、特定应用集成电路(application-specific integrated circuit,ASIC)或一个或多个用于控制本申请方案程序执行的集成电路(integrated circuit,IC)。处理器501可以用于对报文或参数进行处理,以实现本申请实施例中提供的队列控制的方法。
比如,当图2中的第一设备通过图5所示的设备来实现时,该处理器可以用于:
获取第一队列的丢包参数,所述第一队列的丢包参数根据因无法加入所述第一队列被丢弃的报文确定;判断所述第一队列的丢包参数是否高于第一阈值;当所述第一队列的丢包参数高于所述第一阈值时,增加第一缓存参数,所述第一缓存参数用于调整所述第一队列的队列门限,所述第一队列的队列门限表示允许所述第一队列缓存的数据报文的最大字节总数。
通信总线502用于在处理器501、通信接口504和存储器503之间传送信息。
存储器503可以是只读存储器(read-only memory,ROM)或可存储静态信息和指令的其它类型的静态存储设备,存储器503还可以是随机存取存储器(random access memory,RAM)或者可存储信息和指令的其它类型的动态存储设备,也可以是只读光盘(compact disc read-only memory,CD-ROM)或其它光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘存储介质或者其它磁存储设备、或者能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其它介质,但不限于此。存储器503可以是独立存在,通过通信总线502与处理器501相连接。存储器503也可以和处理器501集成在一起。
可选地,存储器503用于存储执行本申请实施例提供的技术方案的程序代码或指令,并由处理器501来控制执行。处理器501用于执行存储器503中存储的程序代码或指令。程序代码中可以包括一个或多个软件模块。可选地,处理器501也可以存储执行本申请实施例提供的技术方案的程序代码或指令,在这种情况下处理器501不需要到存储器503中读取程序代码或指令。
通信接口504可以为收发器一类的装置,用于与其它设备或通信网络通信,通信网络可以为以太网、无线接入网(radio access network,RAN)或无线局域网(wireless local area networks,WLAN)等。通信接口504可以为以太接口(Ethernet)接口、快速以太(fast Ethernet,FE)接口或千兆以太(gigabit Ethernet,GE)接口等。
在具体实现中,作为一种实施例,设备500可以包括多个处理器,例如图5中所示的处理器501和处理器505。这些处理器中的每一个可以是一个单核(single-CPU)处理器,也可以是一个多核(multi-CPU)处理器。这里的处理器可以指一个或多个设备、电路、和/或用于处理数据(例如计算机程序指令)的处理核。
图6是本申请实施例提供的一种设备600的结构示意图。图2或图3中的第一设备可以通过图6所示的设备来实现。参见图6所示的设备结构示意图,设备600包括主控板和 一个或多个接口板。主控板与接口板通信连接。主控板也称为主处理单元(main processing unit,MPU)或路由处理卡(route processor card),主控板包括CPU和存储器,主控板负责对设备600中各个组件的控制和管理,包括路由计算、设备管理和维护功能。接口板也称为线处理单元(line processing unit,LPU)或线卡(line card),用于接收和发送报文。在一些实施例中,主控板与接口板之间或接口板与接口板之间通过总线通信。在一些实施例中,接口板之间通过交换网板通信,在这种情况下设备600也包括交换网板,交换网板与主控板、接口板通信连接,交换网板用于转发接口板之间的数据,交换网板也可以称为交换网板单元(switch fabric unit,SFU)。接口板包括CPU、存储器、转发引擎和接口卡(interface card,IC),其中接口卡可以包括一个或多个通信接口。通信接口可以为Ethernet接口、FE接口或GE接口等。CPU与存储器、转发引擎和接口卡分别通信连接。存储器用于存储转发表。转发引擎用于基于存储器中保存的转发表转发接收到的报文,如果接收到的报文的目的地址为设备600的IP地址,则将该报文发送给主控板或接口板的CPU进行处理;如果接收到的报文的目的地址不是设备600的IP地址,则根据该目的地查转发表,如果从转发表中查找到该目的地址对应的下一跳和出接口,将该报文转发到该目的地址对应的出接口。转发引擎可以是网络处理器(network processor,NP)。接口卡也称为子卡,可安装在接口板上,负责将光电信号转换为数据帧,并对数据帧进行合法性检查后转发给转发引擎处理或接口板CPU。在一些实施例中,CPU也可执行转发引擎的功能,比如基于通用CPU实现软转发,从而接口板中不需要转发引擎。在一些实施例中,转发引擎可以通过ASIC或现场可编程门阵列(field programmable gate array,FPGA)实现。在一些实施例中,存储转发表的存储器也可以集成到转发引擎中,作为转发引擎的一部分。
本申请实施例还提供一种芯片***,包括:处理器,所述处理器与存储器耦合,所述存储器用于存储程序或指令,当所述程序或指令被所述处理器执行时,使得该芯片***实现上述图2所示实施例中第一设备执行的队列控制的方法。
可选地,该芯片***中的处理器可以为一个或多个。该处理器可以通过硬件实现也可以通过软件实现。当通过硬件实现时,该处理器可以是逻辑电路、集成电路等。当通过软件实现时,该处理器可以是一个通用处理器,通过读取存储器中存储的软件代码来实现。
可选地,该芯片***中的存储器也可以为一个或多个。该存储器可以与处理器集成在一起,也可以和处理器分离设置,本申请并不限定。示例性的,存储器可以是非瞬时性处理器,例如只读存储器ROM,其可以与处理器集成在同一块芯片上,也可以分别设置在不同的芯片上,本申请对存储器的类型,以及存储器与处理器的设置方式不作具体限定。
示例性的,该芯片***可以是FPGA,可以是ASIC,还可以是***芯片(system on chip,SoC),还可以是CPU,还可以是NP,还可以是数字信号处理电路(digital signal processor,DSP),还可以是微控制单元(microcontroller unit,MCU),还可以是可编程逻辑器件(programmable logic device,PLD)或其他集成芯片。
应理解,上述方法实施例中的各步骤可以通过处理器中的硬件的集成逻辑电路或者软件形式的指令完成。结合本申请实施例所公开的方法步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。
本申请实施例还提供了一种计算机可读存储介质,包括指令,当其在计算机上运行时,使得计算机执行以上方法实施例提供的、由第一设备执行的队列控制的方法。
本申请实施例还提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行以上方法实施例提供的、由第一设备执行的队列控制的方法。
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的实施例能够以除了在这里图示或描述的内容以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、***、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的***,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的***,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑模块划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个***,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要获取其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各模块单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件模块单元的形式实现。
所述集成的单元如果以软件模块单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的范围。

Claims (26)

  1. 一种队列控制的方法,其特征在于,所述方法包括:
    第一设备获取第一队列的丢包参数,所述第一队列的丢包参数根据因无法加入所述第一队列被丢弃的报文确定;
    所述第一设备判断所述第一队列的丢包参数是否大于第一丢包阈值;
    当所述第一队列的丢包参数大于所述第一丢包阈值时,所述第一设备增加第一缓存参数,所述第一缓存参数用于调整所述第一队列的队列阈值,所述第一队列的队列阈值表示允许所述第一队列缓存的报文的最大字节总数。
  2. 根据权利要求1所述的方法,其特征在于,所述第一缓存参数表示所述第一队列可占用的缓存空间与所述第一队列所在的端口的剩余缓存空间之间的比例,所述剩余缓存空间为所述端口的总缓存空间中未被占用的缓存空间;
    所述方法还包括:
    所述第一设备根据所述第一队列的队列阈值控制报文加入所述第一队列。
  3. 根据权利要求1或2所述的方法,其特征在于,所述当所述第一队列的丢包参数大于所述第一丢包阈值时,第一设备增加第一缓存参数包括:
    当所述第一队列的丢包参数大于所述第一丢包阈值,且所述第一缓存参数小于缓存参数上限时,所述第一设备增加所述第一缓存参数。
  4. 根据权利要求1-3任一项所述的方法,其特征在于,当所述第一队列的丢包参数小于或等于所述第一丢包阈值时,所述方法还包括:
    所述第一设备判断所述第一队列的丢包参数是否小于第二丢包阈值,所述第二丢包阈值小于或等于所述第一丢包阈值;
    当所述第一队列的丢包参数小于所述第二丢包阈值时,所述第一设备减小所述第一缓存参数。
  5. 根据权利要求4所述的方法,其特征在于,所述第一队列的丢包参数为所述第一队列在第i个周期的丢包参数,所述i为正整数,在所述减小所述第一缓存参数之前,所述方法还包括:
    所述第一设备获取所述第一队列在所述第i个周期前的M个周期中每个周期的丢包参数,所述M为小于所述i的正整数;
    所述第一设备确定所述第一队列在所述第i个周期前的M个周期中每个周期的丢包参数均小于所述第二丢包阈值。
  6. 根据权利要求5所述的方法,其特征在于,所述方法还包括:
    所述第一设备确定在所述第i个周期前的M个周期中每个周期结束时,所述第一队列内缓存的报文的字节总数小于或等于设定的阈值。
  7. 根据权利要求4-6任一项所述的方法,其特征在于,所述方法还包括:
    所述第一设备存储所述第一队列在所述第i个周期的丢包参数。
  8. 根据权利要求1-7任一项所述的方法,其特征在于,所述第一队列用于转发小流的报文,所述小流包括的报文数小于等于N,N为正整数;
    所述方法还包括:
    所述第一设备确定所述第一队列的转发参数和第二队列的转发参数,所述第二队列属于所述第一队列所在的端口,所述第二队列用于转发大流的报文,所述转发参数包括平均报文长度和/或转发速率;
    当所述第一队列的转发参数和所述第二队列的转发参数的比值与期望比值不匹配时,所述第一设备调整所述N。
  9. 根据权利要求8所述的方法,其特征在于,所述当所述第一队列的转发参数和所述第二队列的转发参数的比值与期望比值不匹配时,所述第一设备调整所述N包括:
    当所述第一队列的转发参数和所述第二队列的转发参数的比值大于所述期望比值时,所述第一设备减小所述N;
    当所述第一队列的转发参数和所述第二队列的转发参数的比值小于所述期望比值时,所述第一设备增大所述N。
  10. 根据权利要求8或9所述的方法,其特征在于,所述方法还包括:
    当所述第一队列的丢包参数大于第三丢包阈值时,所述第一设备调整第二缓存参数;
    所述第一设备根据所述第二缓存参数概率丢弃待加入所述第二队列的报文。
  11. 根据权利要求10所述的方法,其特征在于,所述第二缓存参数包括启动阈值和停止阈值,所述第一设备调整第二缓存参数包括:
    所述第一设备降低所述启动阈值和/或所述停止阈值;
    所述第一设备根据所述第二缓存参数概率丢弃待加入所述第二队列的报文包括:
    当所述第二队列中缓存的报文的字节总数大于或等于启动阈值,且小于或等于停止阈值时,所述第一设备根据所述第二队列中缓存的报文的字节数、所述启动阈值和所述停止阈值确定所述丢包概率;
    所述第一设备根据所述丢包概率丢弃所述待加入所述第二队列的报文。
  12. 根据权利要求10或11所述的方法,其特征在于,所述第一队列的丢包参数包括所述第一队列在第j个周期的丢包参数,所述第一队列在第j个周期的丢包参数根据所述第j个周期内因无法加入所述第一队列被丢弃的报文确定,所述j为正整数,所述方法还包括:
    所述第一设备获取所述第一队列在所述第j个周期前的K个周期中每个周期的丢包参数,所述K为小于所述j的正整数;
    当所述第一队列在所述第j个周期前的K个周期中每个周期的丢包参数均小于第四丢包阈值,所述第一设备增加所述启动阈值和/或所述停止阈值。
  13. 一种队列控制的装置,其特征在于,所述装置应用于第一设备,包括:
    获取单元,用于获取第一队列的丢包参数,所述第一队列的丢包参数根据因无法加入所述第一队列被丢弃的报文确定;
    判断单元,用于判断所述第一队列的丢包参数是否大于第一丢包阈值;
    处理单元,用于当所述第一队列的丢包参数大于所述第一丢包阈值时,增加第一缓存参数,所述第一缓存参数用于调整所述第一队列的队列阈值,所述第一队列的队列阈值表示允许所述第一队列缓存的报文的最大字节总数。
  14. 根据权利要求13所述的装置,其特征在于,所述第一缓存参数表示所述第一队列可占用的缓存空间与所述第一队列所在的端口的剩余缓存空间之间的比例,所述剩余缓存空间为所述端口的总缓存空间中未被占用的缓存空间;
    所述处理单元,用于根据所述第一队列的队列阈值控制报文加入所述第一队列。
  15. 根据权利要求13或14所述的装置,其特征在于,
    所述处理单元,用于当所述第一队列的丢包参数大于所述第一丢包阈值,且所述第一缓存参数小于缓存参数上限时,增加所述第一缓存参数。
  16. 根据权利要求13-15任一项所述的装置,其特征在于,
    所述判断单元,还用于当所述第一队列的丢包参数小于或等于所述第一丢包阈值时,判断所述第一队列的丢包参数是否小于第二丢包阈值,所述第二丢包阈值小于或等于所述第一丢包阈值;
    所述处理单元,还用于当所述第一队列的丢包参数小于所述第二丢包阈值时,减小所述第一缓存参数。
  17. 根据权利要求16所述的装置,其特征在于,所述第一队列的丢包参数为所述第一队列在第i个周期的丢包参数,所述i为正整数,
    所述获取单元,还用于获取所述第一队列在所述第i个周期前的M个周期中每个周期的丢包参数,所述M为小于所述i的正整数;
    所述处理单元,还用于确定所述第一队列在所述第i个周期前的M个周期中每个周期的丢包参数均小于所述第二丢包阈值。
  18. 根据权利要求17所述的装置,其特征在于,
    所述处理单元,还用于确定在所述第i个周期前的M个周期中每个周期结束时,所述第一队列内缓存的报文的字节总数小于或等于设定的阈值。
  19. 根据权利要求16-18任一项所述的装置,其特征在于,
    所述处理单元,还用于存储所述第一队列在所述第i个周期的丢包参数。
  20. 根据权利要求13-19任一项所述的装置,其特征在于,所述第一队列用于转发小流的报文,所述小流包括的报文数小于等于N,N为正整数;
    所述处理单元,还用于确定所述第一队列的转发参数和第二队列的转发参数,所述第二队列属于所述第一队列所在的端口,所述第二队列用于转发大流的报文,所述转发参数包括平均报文长度和/或转发速率;当所述第一队列的转发参数和所述第二队列的转发参数的比值与期望比值不匹配时,调整所述N。
  21. 根据权利要求20所述的装置,其特征在于,
    所述处理单元,用于当所述第一队列的转发参数和所述第二队列的转发参数的比值大于所述期望比值时,减小所述N;当所述第一队列的转发参数和所述第二队列的转发参数的比值小于所述期望比值时,增大所述N。
  22. 根据权利要求8或9所述的方法,其特征在于,
    所述处理单元,还用于当所述第一队列的丢包参数大于第三丢包阈值时,调整第二缓存参数;根据所述第二缓存参数概率丢弃待加入所述第二队列的报文。
  23. 根据权利要求22所述的装置,其特征在于,所述第二缓存参数包括启动阈值和停止阈值,
    所述处理单元,用于降低所述启动阈值和/或所述停止阈值;当所述第二队列中缓存的报文的字节总数大于或等于启动阈值,且小于或等于停止阈值时,根据所述第二队列中缓存的报文的字节数、所述启动阈值和所述停止阈值确定所述丢包概率;根据所述丢包概率丢弃所述待加入所述第二队列的报文。
  24. 根据权利要求22或23所述的装置,其特征在于,所述第一队列的丢包参数包括所述第一队列在第j个周期的丢包参数,所述第一队列在第j个周期的丢包参数根据所述第j个周期内因无法加入所述第一队列被丢弃的报文确定,所述j为正整数,
    所述获取单元,还用于获取所述第一队列在所述第j个周期前的K个周期中每个周期的丢包参数,所述K为小于所述j的正整数;
    所述处理单元,还用于当所述第一队列在所述第j个周期前的K个周期中每个周期的丢包参数均小于第四丢包阈值,增加所述启动阈值和/或所述停止阈值。
  25. 一种设备,其特征在于,所述设备包括处理器和存储器,所述存储器用于存储指令或程序代码,所述处理器用于从所述存储器中调用并运行所述指令或程序代码,以执行如权利要求1-12任一项所述的队列控制的方法。
  26. 一种计算机可读存储介质,其特征在于,包括指令、程序或代码,当其在计算机上执行时,使得所述计算机执行如权利要求1-12任一项所述的队列控制的方法。
PCT/CN2022/139953 2021-12-21 2022-12-19 一种队列控制的方法及装置 WO2023116611A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111575784.7A CN116319590A (zh) 2021-12-21 2021-12-21 一种队列控制的方法及装置
CN202111575784.7 2021-12-21

Publications (1)

Publication Number Publication Date
WO2023116611A1 true WO2023116611A1 (zh) 2023-06-29

Family

ID=86826267

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/139953 WO2023116611A1 (zh) 2021-12-21 2022-12-19 一种队列控制的方法及装置

Country Status (2)

Country Link
CN (1) CN116319590A (zh)
WO (1) WO2023116611A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117971769B (zh) * 2024-03-29 2024-06-25 新华三半导体技术有限公司 芯片中缓存资源的管理方法及相关装置

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6219728B1 (en) * 1996-04-22 2001-04-17 Nortel Networks Limited Method and apparatus for allocating shared memory resources among a plurality of queues each having a threshold value therefor
CN1402472A (zh) * 2002-09-29 2003-03-12 清华大学 基于网络处理器平台实现的动态部分缓冲共享方法
US7369500B1 (en) * 2003-06-30 2008-05-06 Juniper Networks, Inc. Dynamic queue threshold extensions to random early detection
US20100195494A1 (en) * 2004-08-27 2010-08-05 Jinshen Sun Queue-based active queue management process
CN109660468A (zh) * 2017-10-12 2019-04-19 深圳市中兴微电子技术有限公司 一种端口拥塞管理方法、装置和设备
CN113064738A (zh) * 2021-03-29 2021-07-02 南京邮电大学 基于概要数据的主动队列管理方法

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6219728B1 (en) * 1996-04-22 2001-04-17 Nortel Networks Limited Method and apparatus for allocating shared memory resources among a plurality of queues each having a threshold value therefor
CN1402472A (zh) * 2002-09-29 2003-03-12 清华大学 基于网络处理器平台实现的动态部分缓冲共享方法
US7369500B1 (en) * 2003-06-30 2008-05-06 Juniper Networks, Inc. Dynamic queue threshold extensions to random early detection
US20100195494A1 (en) * 2004-08-27 2010-08-05 Jinshen Sun Queue-based active queue management process
CN109660468A (zh) * 2017-10-12 2019-04-19 深圳市中兴微电子技术有限公司 一种端口拥塞管理方法、装置和设备
CN113064738A (zh) * 2021-03-29 2021-07-02 南京邮电大学 基于概要数据的主动队列管理方法

Also Published As

Publication number Publication date
CN116319590A (zh) 2023-06-23

Similar Documents

Publication Publication Date Title
US8125904B2 (en) Method and system for adaptive queue and buffer control based on monitoring and active congestion avoidance in a packet network switch
US8665892B2 (en) Method and system for adaptive queue and buffer control based on monitoring in a packet network switch
WO2019033857A1 (zh) 报文控制方法及网络装置
US7573821B2 (en) Data packet rate control
US8274974B1 (en) Method and apparatus for providing quality of service across a switched backplane for multicast packets
US11968111B2 (en) Packet scheduling method, scheduler, network device, and network system
US7746778B2 (en) Resource based data rate control
US11782869B2 (en) Data transmission method and related device
JP2006506845A (ja) ルータにおけるパケットに対し論理リンクを選択する方法
US9614777B2 (en) Flow control in a network
US10728156B2 (en) Scalable, low latency, deep buffered switch architecture
WO2023116611A1 (zh) 一种队列控制的方法及装置
US20170195227A1 (en) Packet storing and forwarding method and circuit, and device
CN110868359B (zh) 一种网络拥塞控制方法
JP4652314B2 (ja) イーサoamスイッチ装置
CN114095448A (zh) 一种拥塞流的处理方法及设备
WO2023274165A1 (zh) 参数配置的方法、装置、控制器、通信设备和通信***
US20220124036A1 (en) Network congestion handling method and related apparatus
US20030142676A1 (en) Method and apparauts for admission control in packet switch
US11622028B2 (en) Explicit notification of operative conditions along a network path
CN117014384A (zh) 一种报文传输方法以及报文转发设备
CN112787919A (zh) 报文传输方法及设备、可读介质
WO2023207461A1 (zh) 拥塞流识别方法、装置、设备及计算机可读存储介质
WO2023072112A1 (zh) 一种报文调度的方法及装置
US20230171201A1 (en) Method for sending data packet and network device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22909924

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 2022909924

Country of ref document: EP

ENP Entry into the national phase

Ref document number: 2022909924

Country of ref document: EP

Effective date: 20240625