WO2019109902A1 - Queue scheduling method and apparatus, communication device, and storage medium - Google Patents

Queue scheduling method and apparatus, communication device, and storage medium Download PDF

Info

Publication number
WO2019109902A1
WO2019109902A1 PCT/CN2018/119110 CN2018119110W WO2019109902A1 WO 2019109902 A1 WO2019109902 A1 WO 2019109902A1 CN 2018119110 W CN2018119110 W CN 2018119110W WO 2019109902 A1 WO2019109902 A1 WO 2019109902A1
Authority
WO
WIPO (PCT)
Prior art keywords
queue
scheduling
difference
length
target probability
Prior art date
Application number
PCT/CN2018/119110
Other languages
French (fr)
Chinese (zh)
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 WO2019109902A1 publication Critical patent/WO2019109902A1/en

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
    • H04L47/62Queue scheduling characterised by scheduling criteria
    • H04L47/625Queue scheduling characterised by scheduling criteria for service slots or service orders
    • H04L47/6255Queue scheduling characterised by scheduling criteria for service slots or service orders queue load conditions, e.g. longest queue first
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling
    • H04L47/52Queue scheduling by attributing bandwidth to queues
    • H04L47/527Quantum based scheduling, e.g. credit or deficit based scheduling or token bank
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling
    • H04L47/62Queue scheduling characterised by scheduling criteria
    • H04L47/6215Individual queue per QOS, rate or priority

Definitions

  • the present invention relates to the field of data transmission technologies, and in particular, to a queue scheduling method and apparatus, a communication device, and a storage medium.
  • QoS Quality of Service
  • QoS Quality of Service
  • a communication device responsible for queue scheduling such as a router or a switch needs to schedule a data packet according to a certain rule, so that each queue in which the data packet is cached can obtain a fair scheduling opportunity, so that each queue is in a queue. Packets can be sent out.
  • a Queue Manager (QM) and a Queue SCheduler (QSC) are disposed in the communication device, and for each queue managed by the queue manager, the queue manager can use the data according to the queue.
  • the difference between the transmitted data amount (ie, the queue credit) and the queue length of the queue sends a scheduling request to the queue scheduler, so that the queue scheduler allocates the queue for data transmission.
  • the amount of data to achieve the transfer of packets in the queue.
  • the queue manager when the difference corresponding to any queue managed by the queue manager changes, the queue manager sends a scheduling request to the queue scheduler, so that when the queue manager manages When a multi-queue is used, the queue manager sends a scheduling request with a high frequency.
  • the queue scheduler has a large load and cannot process the scheduling request in a timely manner. As a result, the scheduling delay of the scheduling of the queue is large.
  • the application provides a queue scheduling method, device, system and computer readable storage medium, which can solve the problem that when the queue manager manages more queues, the queue manager sends a scheduling request with a higher frequency, and the queue scheduler has a larger load.
  • the problem that the scheduling request cannot be processed in time may result in a large scheduling delay for the scheduling of the queue.
  • the technical solution provided by the present application is as follows:
  • an exemplary embodiment of the present application provides a queue scheduling method, where the method is applied to a queue manager, and the method includes:
  • the scheduling request is sent to a queue scheduler
  • the first queue is any one of at least one queue managed by the queue manager, and the length difference is a current queue credit value of the first queue and a queue length of the first queue.
  • the difference between the current queue credits is the amount of data that the first queue is currently available for data transmission.
  • the random generation of the scheduling request is performed based on the target probability, so that the ratio of the probability of generating the scheduling request to the probability of not generating is the target probability.
  • the scheduling request is sent to the queue scheduler, which can effectively reduce the frequency at which the queue manager sends the scheduling request to the queue scheduler, thereby reducing the scheduling load of the queue scheduler. To reduce the probability that the queue scheduler has a large scheduling delay for the scheduling of the queue.
  • the determining the target probability based on the length difference of the first queue and the queue length of the first queue may include:
  • the target probability is determined based on at least one of the first difference and the second difference, and a queue length of the first queue.
  • the determining, according to at least one of the first difference value and the second difference value, and a queue length of the first queue, the target probability includes:
  • the target probability is determined based on the first difference and the scheduling granularity.
  • the first queue may request the queue scheduler to schedule them, but in order to prevent the queue manager from managing multiple queues to send scheduling requests to the queue scheduler, At this time, the target probability of generating the scheduling request may be determined, so that the scheduling request is randomly generated according to the target probability, so as to reduce the frequency at which the queue manager sends the scheduling request to the queue scheduler, and reduce the scheduling load of the queue scheduler, and further Ensure the effective dequeue of the data packet.
  • the determining the target probability based on the first difference value and the scheduling granularity including:
  • the target probability Determining, by the probability that the target difference is greater than the first random number, the target probability, where the target difference is a difference between the scheduling granularity and the first difference, the first random number is randomly generated and not A positive number greater than the scheduling granularity.
  • the determining the target probability based on at least one of the first difference value and the second difference value, and a queue length of the first queue includes:
  • the target probability of generating the scheduling request may be determined at this time, so as to facilitate A scheduling request is randomly generated according to the target probability, thereby ensuring effective dequeue of the data packet.
  • the determining the target probability based on the second difference and the target packet length including:
  • the probability that the target packet length is greater than the second random number is determined as the target probability, and the second random number is a positive number that is randomly generated and not greater than the second difference.
  • the determined target probability when the target probability is determined based on the second difference and the target packet length, the determined target probability exhibits a more uniform change, which can further reduce the frequency at which the queue manager sends the scheduling request to the queue scheduler, thereby reducing
  • the scheduling load of the small queue scheduler can further reduce the probability that the queue scheduler has a large scheduling delay for scheduling of the queue.
  • the determining the target probability based on at least one of the first difference value and the second difference value, and a queue length of the first queue includes:
  • the target packet length is the length of the data packet that changes the queue length of the first queue.
  • the target probability is determined based on the second difference and the target packet length
  • the queue manager can be further reduced to the queue according to the processing method for determining the target probability based on the first difference and the scheduling granularity.
  • the frequency at which the scheduler sends the scheduling request, thereby reducing the scheduling load of the queue scheduler, can further reduce the probability that the queue scheduler has a large scheduling delay for scheduling the queue.
  • the determining the target probability based on the second difference and the target packet length including:
  • a ratio of the target packet length to the second difference is determined as the target probability.
  • the determining the target probability based on at least one of the first difference value and the second difference value, and a queue length of the first queue includes:
  • the queue credit is deficit, but the deficit is not serious. At this time, it can be determined that the first queue does need the queue scheduler to schedule it. And in order to ensure the normal dequeue of the data packets in the first queue, the first queue needs the queue scheduler to schedule it at a relatively small rate. Therefore, when the first difference is greater than the first credit threshold and less than the reference credit threshold, the target probability may be determined to be one.
  • the determining the target probability based on at least one of the first difference value and the second difference value, and a queue length of the first queue includes:
  • the target probability is determined to be 1.
  • the queue credit of the first queue has a severe deficit, and the first queue urgently needs the queue scheduler to schedule it.
  • the first queue needs the queue scheduler to have a relatively large rate pair. It performs scheduling to ensure the normal dequeue of data packets in the first queue.
  • the target probability is determined based on the length difference of the first queue and the queue length of the first queue, including:
  • the target probability is determined according to the length difference.
  • the determining the target probability according to the length difference includes:
  • the target probability is determined based on the length difference and the scheduling granularity.
  • the target probability of generating the scheduling request may be determined to randomly generate the scheduling request, reduce the frequency at which the queue manager sends the scheduling request to the queue scheduler, and reduce the scheduling load of the queue scheduler, and further Ensure the effective dequeue of the data packet.
  • the determining the target probability based on the length difference and the scheduling granularity including:
  • Determining, by the probability that the length difference is smaller than the first random number, is the target probability, and the first random number is a positive number that is randomly generated and not greater than the scheduling granularity.
  • the determining the target probability according to the length difference includes:
  • the queue credit is deficit, but the deficit is not serious.
  • the first queue does need the queue scheduler to schedule it, and In order to ensure the normal dequeue of data packets in the first queue, the first queue needs the queue scheduler to schedule it at a relatively small rate. Therefore, when the length difference is greater than the first credit threshold and less than the reference credit threshold, the target probability may be determined to be one.
  • the determining the target probability according to the length difference includes:
  • the target probability is determined to be 1.
  • the queue credit of the first queue has a severe deficit, and the first queue urgently needs the queue scheduler to schedule it.
  • the performing random generation of the scheduling request based on the target probability includes:
  • the scheduling request is generated based on the target probability
  • the scheduling request is generated based on the selection result, where the scheduling request includes a first status identifier, where the first status identifier indicates that the queue scheduler performs queue scheduling
  • the first rate is less than a preset scheduling rate threshold.
  • the scheduling request is generated based on the target probability
  • the scheduling request is generated based on the selection result, where the scheduling request includes a second status identifier, where the second status identifier indicates that the queue scheduler performs queue scheduling
  • the second rate is greater than a preset scheduling rate threshold.
  • the queue manager is reduced based on the plurality of queues managed by the queue manager.
  • the number of scheduling requests is such that the number of scheduling requests generated by the queue manager is as uniformly distributed as possible, which reduces the frequency at which the queue manager sends scheduling requests to the queue scheduler, and can reduce the queue.
  • the scheduling load of the scheduler is such that the update rate of the scheduling state does not exceed the scheduling capability of the queue scheduler, thereby reducing the probability that the queue scheduler has a large scheduling delay for scheduling of the queue.
  • the number of scheduling requests generated by the queue manager can be uniformly distributed as shown in the queue manager, so that the current queue credits of all the queues are evenly distributed within the preset range corresponding to the scheduling granularity.
  • the sum of the credits is close to the total scheduling bandwidth that the queue scheduler can schedule, so that the actual total scheduling bandwidth is more accurate, and the scheduling bandwidth caused by the high frequency of sending the scheduling request and the scheduling bandwidth between the queues are not solved. Accurate and other issues.
  • the method further includes:
  • the scheduling response includes a scheduling granularity, where the scheduling granularity is a rated data amount allocated by the queue scheduler for the first queue for data transmission;
  • the queue scheduler may run a scheduling algorithm according to the scheduling state indicated by the scheduling request, allocate a rated data amount for data transmission to the first queue, and send the same to the queue manager.
  • a scheduling response of the amount of data so that the queue manager performs a queue credit update according to it, thereby performing a dequeuing operation on the data packets in the first queue.
  • the method further includes:
  • the dequeuing operation may be performed on the data packet of the corresponding length in the first queue to implement data transmission.
  • sending the scheduling request to the queue scheduler includes:
  • the scheduling request is sent to the queue scheduler.
  • the queue manager may compare the current scheduling state corresponding to the first queue with the scheduling state indicated by the scheduling request, when the scheduling state indicated by the scheduling request is the same as the current scheduling state corresponding to the first queue.
  • the queue scheduler can continue to schedule the first queue according to the current scheduling state. At this time, it is not necessary to send a scheduling request to the queue scheduler, which can save system resources; when the scheduling status indicated by the scheduling request is related to the current queue When the scheduling status is different, the scheduling request is sent to the queue scheduler to update the scheduling state of the queue queue to the first queue.
  • the method before the determining the target probability based on the difference between the length of the first queue and the queue length of the first queue, when the length difference of the first queue is changed, the method further includes:
  • an exemplary embodiment of the present application further provides a queue scheduling apparatus, where the apparatus includes:
  • a first determining module configured to determine a target probability based on a length difference of the first queue and a queue length of the first queue when a difference in length of the first queue changes
  • a generating module configured to perform random generation of the scheduling request based on the target probability, such that a ratio of a probability of generating the scheduling request to an ungenerated possibility is the target probability, and the scheduling request is used to indicate a target Decoding the scheduling state of the first queue;
  • a sending module configured to send the scheduling request to a queue scheduler when the scheduling request is generated
  • the first queue is any one of at least one queue managed by the queue manager, and the length difference is a current queue credit value of the first queue and a queue length of the first queue.
  • the difference between the current queue credits is the amount of data that the first queue is currently available for data transmission.
  • the first determining module includes:
  • Obtaining a sub-module configured to: when the queue length of the first queue changes, obtain a first difference after the length difference is changed, and a second difference before the change;
  • a first determining submodule configured to determine the target probability based on at least one of the first difference value and the second difference value, and a queue length of the first queue.
  • the first determining submodule includes:
  • a first comparing unit configured to compare the first difference with a reference credit threshold and a scheduling granularity, where the reference credit threshold is smaller than the scheduling granularity, and the scheduling granularity is that the queue scheduler pairs the first The rated data amount allocated for the first queue for data transmission when the queue is scheduled;
  • a first determining unit configured to determine the target probability based on the first difference value and the scheduling granularity when the first difference value is greater than the reference credit threshold and less than the scheduling granularity.
  • the first determining unit is configured to:
  • the target probability Determining, by the probability that the target difference is greater than the first random number, the target probability, where the target difference is a difference between the scheduling granularity and the first difference, the first random number is randomly generated and not A positive number greater than the scheduling granularity.
  • the first determining submodule includes:
  • a first comparing unit configured to compare the second difference with a reference credit threshold and a scheduling granularity, where the reference credit threshold is smaller than the scheduling granularity, and the scheduling granularity is that the queue scheduler pairs the first The rated data amount allocated for the first queue for data transmission when the queue is scheduled;
  • a first determining unit configured to determine, according to the second difference and a target packet length, the target probability, when the second difference is greater than the reference credit threshold and less than the scheduling granularity, the target packet length The length of the data packet for which the queue length of the first queue changes.
  • the first determining unit is configured to:
  • the probability that the target packet length is greater than the second random number is determined as the target probability, and the second random number is a positive number that is randomly generated and not greater than the second difference.
  • the first determining submodule includes:
  • a first comparing unit configured to compare the first difference value with a reference credit threshold and a scheduling granularity, where the reference credit threshold is smaller than the scheduling granularity, and the scheduling granularity is that the queue scheduler pairs the first The rated data amount allocated for the first queue for data transmission when the queue is scheduled;
  • the first comparing unit is configured to compare the second difference value with the reference credit threshold and the scheduling granularity respectively;
  • a first determining unit configured to determine, when the first difference value and the second difference value are greater than the reference credit threshold and less than the scheduling granularity, based on the second difference value and a target packet length
  • the target probability, the target packet length is a length of a data packet that changes a queue length of the first queue.
  • the first determining unit is configured to:
  • a ratio of the target packet length to the second difference is determined as the target probability.
  • the first determining submodule includes:
  • a first comparison unit configured to compare the first difference value with a reference credit threshold and a preset first credit threshold, where the first credit threshold is smaller than the reference credit threshold;
  • the first determining unit is configured to determine that the target probability is 1 when the first difference is greater than the first credit threshold and less than the reference credit threshold.
  • the first determining submodule includes:
  • a first comparing unit configured to compare the first difference with a preset first credit threshold
  • a first determining unit configured to determine that the target probability is 1 when the first difference is less than the first credit threshold.
  • the first determining module includes:
  • a second determining submodule configured to determine the target probability according to the length difference when a current queue credit value of the first queue changes.
  • the second determining submodule includes:
  • a second comparing unit configured to compare the length difference value with a reference credit threshold and a scheduling granularity, where the reference credit threshold is smaller than the scheduling granularity, where the scheduling granularity is that the queue scheduler is to the first queue The amount of rated data allocated for the first queue for data transmission when scheduling is performed;
  • a second determining unit configured to determine the target probability based on the length difference and the scheduling granularity when the length difference is greater than the reference credit threshold and less than the scheduling granularity.
  • the second determining unit is configured to:
  • Determining, by the probability that the length difference is smaller than the first random number, is the target probability, and the first random number is a positive number that is randomly generated and not greater than the scheduling granularity.
  • the second determining submodule includes:
  • a second comparing unit configured to compare the length difference value with a reference credit threshold and a preset first credit threshold, where the first credit threshold is smaller than the reference credit threshold;
  • a second determining unit configured to determine that the target probability is 1 when the length difference is greater than the first credit threshold and less than the reference credit threshold.
  • the second determining submodule includes:
  • a second comparing unit configured to compare the length difference with a preset first credit threshold
  • a second determining unit configured to determine that the target probability is 1 when the length difference is less than the first credit threshold.
  • the generating module is configured to:
  • the scheduling request is generated based on the target probability
  • the scheduling request is generated based on the selection result, where the scheduling request includes a first status identifier, where the first status identifier indicates that the queue scheduler performs queue scheduling
  • the first rate is less than a preset scheduling rate threshold.
  • the generating module is configured to:
  • the scheduling request is generated based on the target probability
  • the scheduling request is generated based on the selection result, where the scheduling request includes a second status identifier, where the second status identifier indicates that the queue scheduler performs queue scheduling
  • the second rate is greater than a preset scheduling rate threshold.
  • the device further includes:
  • a receiving module configured to receive a scheduling response sent by the queue scheduler, where the scheduling response includes a scheduling granularity, where the scheduling granularity is a rated data volume allocated by the queue scheduler for the first queue for data transmission ;
  • an update module configured to update a current queue credit value of the first queue based on the scheduling response.
  • the device further includes:
  • an execution module configured to perform a dequeuing operation on the data packet of the corresponding length in the first queue based on the updated current queue credit value.
  • the sending module is configured to:
  • the scheduling request is sent to the queue scheduler.
  • the device further includes:
  • a second determining module configured to determine, when the queue length of the first queue changes, a change in a length difference of the first queue
  • the second determining module is configured to determine that a difference in length of the first queue changes when a current queue credit value of the first queue changes.
  • an exemplary embodiment of the present application further provides a communication device, where the communication device includes: a queue scheduler and a queue manager;
  • the queue manager includes the queue scheduling device of any of the second aspects
  • the queue scheduler is configured to send a scheduling response to the queue manager after receiving the scheduling request sent by the queue manager, where the scheduling response is used to allocate rated data for data transmission based on the scheduling request. the amount.
  • an exemplary embodiment of the present application further provides a queue scheduling apparatus, where the apparatus includes:
  • a memory for storing executable instructions of the processing component
  • processing component is configured to:
  • the scheduling request is sent to a queue scheduler
  • the first queue is any one of at least one queue managed by the queue manager, and the length difference is a current queue credit value of the first queue and a queue length of the first queue.
  • the difference between the current queue credits is the amount of data that the first queue is currently available for data transmission.
  • the exemplary embodiment of the present application further provides a storage medium, when the instructions in the storage medium are executed by a processing component of the terminal, enabling the terminal to perform the queue scheduling according to any one of the first aspects. method.
  • the queue scheduling method and apparatus, the communication device, and the storage medium provided by the exemplary embodiments of the present application determine a target probability by changing a length difference of the first queue, and perform random generation of the scheduling request based on the target probability, so that the scheduling request is performed.
  • the ratio of the generated possibility to the ungenerated possibility is the target probability, and when the scheduling request is generated, the scheduling request is sent to the queue scheduler, which reduces the plurality of queue managers based on the related management techniques.
  • the number of scheduling requests generated by the queue is such that the number of scheduling requests generated by the queue manager is uniformly distributed as shown in the queue, which can effectively reduce the frequency at which the queue manager sends scheduling requests to the queue scheduler, thereby reducing
  • the scheduling load of the small queue scheduler reduces the probability that the queue scheduler has a large scheduling delay for the scheduling of the queue.
  • FIG. 1A is a schematic diagram of an implementation environment involved in a queue scheduling method according to an exemplary embodiment of the present disclosure.
  • FIG. 1B is a schematic diagram of a principle of queue scheduling provided by an exemplary embodiment of the present application.
  • FIG. 2 is a flowchart of a queue scheduling method provided by an exemplary embodiment of the present application.
  • FIG. 3 is a flowchart of a method for detecting whether a queue length of a first queue changes according to an exemplary embodiment of the present application.
  • FIG. 4 is a flowchart of a method for determining a target probability based on a target length difference of a first queue and a queue length of a first queue when a queue length of a first queue changes, according to an exemplary embodiment of the present application.
  • FIG. 5 is a flowchart of a method for determining a target probability based on at least one of a first difference value and a second difference value, and a queue length of a first queue, according to an exemplary embodiment of the present application.
  • FIG. 6 is a flowchart of a method for determining a target probability according to a length difference when a current queue credit value of a first queue changes according to an exemplary embodiment of the present application.
  • FIG. 7A is a block diagram of a queue scheduling apparatus provided by an exemplary embodiment of the present application.
  • FIG. 7B is a block diagram of a first determining module provided by an exemplary embodiment of the present application.
  • FIG. 7C is a block diagram of a first determining sub-module provided by an exemplary embodiment of the present application.
  • FIG. 7D is a block diagram of another first determining module provided by an exemplary embodiment of the present application.
  • FIG. 7E is a block diagram of a second determining sub-module provided by an exemplary embodiment of the present application.
  • FIG. 7F is a block diagram of another queue scheduling apparatus provided by an exemplary embodiment of the present application.
  • FIG. 8 is a schematic structural diagram of a queue scheduling apparatus according to an exemplary embodiment of the present application.
  • the implementation environment may include a communication device 110, a first terminal 120, and a second terminal 130.
  • the communication device 110 can be a router or a switch.
  • the first terminal 120 and the second terminal 130 can be a smart phone, a computer, a multimedia player, an e-reader, or a wearable device.
  • the communication device 110 and the first terminal 120 The connection between the communication device 110 and the second terminal 130 can be established through a wired network or a wireless network.
  • the communication device 110 can set the information of the first terminal 120. Forwarded to the second terminal 130. This information is usually transmitted in the form of a data packet.
  • the communication device 110 includes a queue manager 1101 and a queue scheduler 1102, and the queue manager 1101 and the queue scheduler 1102 can be connected by wire or wirelessly.
  • the queue manager 1101 manages a plurality of queues, and the plurality of queues are divided by the queue manager 1101 according to the description information of the received data packet (for example, output port, transmission priority, and user identity (ID), etc.)
  • the obtained, and the plurality of data packets in each queue are arranged in chronological order according to the queue manager 1101 receiving the data packets.
  • the queue manager 1101 manages a plurality of queues, which is actually a queue scheduling process.
  • the queue scheduling process mainly includes an enrollment management process and a dequeue management process. The following two aspects are described in the following embodiments:
  • the enqueue management process after receiving the data packet, the queue manager 1101 performs an enqueue operation on the data packet to add the data packet to the end of the queue.
  • the enqueue operation may be: adding the descriptor of the data packet to the end of the linked list corresponding to the queue.
  • the dequeue management process first, the queue manager 1101 sends a scheduling request to the queue scheduler 1102 according to the queue status of the queue it manages; then, the queue scheduler 1102 is configured according to the scheduling request sent by the queue manager 1101 and the user configuration.
  • the QoS policy generates a scheduling response and sends the scheduling response to the queue manager 1101.
  • the queue manager 1101 responds to the corresponding one of the queues managed by the queue based on the scheduling response.
  • the packet performs a dequeue operation.
  • the dequeue operation may be: reading the descriptor of the packet located at the beginning of the queue from the linked list.
  • the queue manager 1101 may include: an enqueue module, a queue management module, and a dequeue module.
  • the three modules cooperate to implement a queue scheduling process.
  • the specific process of the queue scheduling may refer to the following process:
  • the enqueue module may divide the data packet into a corresponding queue according to the description information of the certain data packet (ie, perform a queue operation), and then the queue management module The managed queue performs enqueue update. Then, the queue manager 1101 can perform queue status update according to the queue length of the queue it manages and the current queue credit value of the queue, and send a schedule to the queue scheduler 1102 based on the updated queue status.
  • a request the scheduling request indicates a target queue that needs to be scheduled, and a scheduling state of the target queue.
  • the queue scheduler 1102 may run a preset scheduling algorithm according to the scheduling state indicated by the scheduling request, where
  • the target queue provides a dequeue credit, which is usually equal to the scheduling granularity, and the scheduling granularity is the rated data amount allocated for the data transmission by the queue scheduler when scheduling the queue (for example, the scheduling granularity may be It is 1 kilobyte (KB)).
  • the queue management module updates the current queue credit value of the target queue according to the dequeue credit, and sends a dequeue request to the dequeue module to request the dequeue module pair.
  • the data packet performs the dequeue operation.
  • the dequeue module may dequeue the data packet of the head of the target queue based on the current queue credit value of the updated target queue, thereby implementing data transmission. Moreover, after the data packet is dequeued, the queue management module can dequeue the queue managed by the queue according to the dequeue operation of the data packet.
  • the current queue credit value is a data amount quota that the queue is currently available for data transmission.
  • the scheduling status is used to identify the rate at which the queue scheduler schedules queues.
  • the normal scheduling state has two states: a slow scheduling state and a fast scheduling state, where the slow scheduling state indicates the first rate, and the fast scheduling state indicates the second rate, where the first rate is smaller than the second rate.
  • the rate is less than the preset scheduling rate threshold, and the second rate is greater than the preset scheduling rate threshold.
  • the first rate may be: 200 clock cycles
  • the second rate may be: 10 clock cycles.
  • FIG. 2 is a flowchart of a queue scheduling method according to an exemplary embodiment of the present disclosure.
  • the queue scheduling method may be applied to the queue manager shown in FIG. 1A or FIG. 1B.
  • the queue scheduling method takes the first queue as an example.
  • the first queue is any one of at least one queue managed by the queue manager.
  • the queue scheduling method may include:
  • Step 201 When the length difference of the first queue changes, the target probability is determined based on the length difference of the first queue and the queue length of the first queue.
  • the length difference is the difference between the current queue credit value of the first queue and the queue length of the first queue.
  • the queue length of the first queue changes, for example, when a new data packet is added to the first queue, The queue length of the first queue is updated according to the length of the data packet and the historical length of the first queue.
  • the length difference of the first queue changes.
  • the current queue credit value of the first queue changes. For example, when the queue scheduler sends the scheduling result to the first queue, the queue manager updates the current queue credit value based on the scheduling result, and the current queue of the first queue. The credit value will change.
  • the difference in the length of the first queue will change.
  • the length difference of the first queue changes by detecting whether the queue length of the first queue and/or the current queue credit value changes, for example, in the queue length of the first queue and the current queue credit value. When at least one of the changes occurs, it is determined that the difference in length of the first queue changes.
  • the process of detecting whether the queue length of the first queue changes may include:
  • Step a Detect whether a new data packet is added to the first queue.
  • the implementation process of the step a may include: detecting whether the length of the linked list corresponding to the first queue is increased, and when the length of the linked list corresponding to the first queue is increased, determining that a descriptor of a new data packet is added to the linked list, That is, it can be determined that a new data packet is added to the first queue, and accordingly, it can be determined that the queue length of the first queue changes.
  • Step b When a new data packet is added to the first queue, it is determined that the queue length of the first queue changes.
  • the action of detecting the queue length of the first queue and determining that the queue length of the first queue changes may be performed by the queue management module in FIG. 1B, and in actual implementation, the queue management module may be configured with The module dedicated to detecting the length of the queue, or the queue management module may also determine that a new data packet is added to the first queue after receiving the enqueue update request sent to the enqueue module, and determine that the queue length of the first queue occurs.
  • the embodiment of the present invention does not specifically limit it.
  • the exemplary embodiments of the present application correspondingly provide the following two ways to determine the target probability:
  • the target probability is determined based on the target length difference of the first queue and the queue length of the first queue.
  • the target length difference may be at least one of a first difference value and a second difference value, where the first difference value is a difference between a current queue credit value of the first queue and a queue length of the first queue, where the The difference is the difference between the current queue credit value of the first queue and the queue length of the first queue.
  • the implementation process of the first implementation manner may include:
  • Step 2011 When the queue length of the first queue changes, the first difference after the change of the length difference is obtained, and the second difference before the change.
  • the current queue length of the first queue may be updated according to the length of the data packet and the historical length of the first queue, and the current queue length may be the length of the data packet and the first The sum of the historical lengths of the queues.
  • the first difference is the difference between the current queue credit value of the first queue and the current queue length of the first queue
  • the second difference is the difference between the current queue credit value of the first queue and the historical length of the first queue. value.
  • the size of the enqueue packet is 128 bytes (Byte, B), and the history queue length of the first queue before the packet is added to the first queue.
  • the current queue credit value is 1KB.
  • Step 2012 Determine a target probability based on at least one of the first difference and the second difference, and a queue length of the first queue.
  • the method for determining the target probability is different.
  • the step 2012 The implementation process can include the following situations:
  • the first difference is compared with the reference credit threshold and the scheduling granularity respectively.
  • the target probability is determined based on the first difference and the scheduling granularity.
  • the implementing method for determining the target probability based on the first difference value and the scheduling granularity may include: determining a probability that the target difference value is greater than the first random number as the target probability.
  • the target difference is a difference between the scheduling granularity and the first difference.
  • the first random number is a positive number that is randomly generated and is not greater than the scheduling granularity
  • the reference credit threshold is smaller than the scheduling granularity.
  • the reference credit threshold and the scheduling granularity may be set according to actual needs. For example, the reference credit threshold may be 0, and the scheduling granularity may be 1 KB.
  • the first queue when the first difference is greater than the reference credit threshold and less than the scheduling granularity, it may be determined that the first queue still has a certain queue credit, but the remaining queue credit is not enough for the first queue.
  • the data packet is dequeued.
  • the first queue in order to ensure the effective dequeue of the data packet in the first queue, the first queue can request the queue scheduler to schedule it, but in order to avoid multiple queues managed by the queue manager The scheduling request is sent to the queue scheduler.
  • the target probability of generating the scheduling request may be determined, so that the scheduling request is randomly generated according to the target probability, so as to reduce the frequency at which the queue manager sends the scheduling request to the queue scheduler, The scheduling load of the small queue scheduler, in order to ensure the effective dequeue of the data packet.
  • the second case comparing the second difference with the reference credit threshold and the scheduling granularity respectively, and when the second difference is greater than the reference credit threshold and less than the scheduling granularity, determining the target probability based on the second difference and the target packet length.
  • the method for determining the target probability based on the second difference and the target packet length may include: determining a probability that the target packet length is greater than the second random number as the target probability.
  • the second random number is a positive number that is randomly generated and is not greater than the second difference
  • the target packet length is a length of the data packet that changes the queue length of the first queue, that is, the target packet length is newly added. The length of a queue of packets.
  • the target probability of generating the scheduling request may be determined at this time, so that The scheduling request is randomly generated according to the target probability, thereby ensuring effective dequeue of the data packet.
  • the target packet length the length of the data packet newly added to the first queue (ie, the target packet length) is 128B
  • the second difference is 896B
  • the reference credit threshold is 0,
  • the scheduling granularity 1 KB.
  • the second difference is greater than the reference.
  • the credit threshold is less than the scheduling granularity
  • the target probability may be determined based on the second difference and the target packet length, and, since the second random number is randomly generated and not greater than the positive number of the second difference, the target packet length may be determined to be greater than
  • the target probability determined by the second case is used to determine the target probability, and the scheduling probability may not be generated based on the target probability determined multiple times.
  • the target probability determined multiple times will be incremented in order of time, and finally the target probability will be 1, and a scheduling request can be generated.
  • the scheduling request is not generated based on the second target probability, and a new data packet is added to the first queue, it is assumed that the length of the newly added data packet is 128B.
  • the second difference determined based on the first determining method is determined.
  • the fourth target probability is 1/4
  • the fifth target probability is 1/3
  • the sixth target probability is 1/2
  • the seventh target probability is 1, and the scheduling request can be generated once.
  • the determined target probability when the target probability is determined based on the second difference and the target packet length, the determined target probability exhibits a more uniform change, which can further reduce the queue manager sending the scheduling request to the queue scheduler.
  • the frequency, and thus the scheduling load of the queue scheduler can further reduce the probability that the queue scheduler has a large scheduling delay for scheduling of the queue.
  • the third case comparing the first difference with the reference credit threshold and the scheduling granularity respectively, comparing the second difference with the reference credit threshold and the scheduling granularity respectively, when the first difference and the second difference are both satisfied: greater than the reference
  • the target probability is determined based on the second difference and the target packet length.
  • the method for determining the target probability based on the second difference and the target packet length may include: determining a ratio of the target packet length to the second difference as the target probability.
  • the target probability is determined based on the second difference and the target packet length
  • the queue manager can be further reduced to the queue according to the processing method for determining the target probability based on the first difference and the scheduling granularity.
  • the frequency at which the scheduler sends the scheduling request, thereby reducing the scheduling load of the queue scheduler, can further reduce the probability that the queue scheduler has a large scheduling delay for scheduling the queue.
  • the first difference is compared with the reference credit threshold and the preset first credit threshold, and when the first difference is greater than the first credit threshold and less than the reference credit threshold, the target probability is determined to be 1.
  • the first credit threshold is less than a reference credit threshold, and the first credit threshold is a threshold corresponding to a serious deficit in the queue credit.
  • the first credit threshold may be a credit threshold corresponding to the fast dispatch waterline, when the first difference is When the value is less than the first credit threshold, the first queue urgently needs the queue scheduler to schedule it.
  • the first queue needs the queue scheduler to schedule it at a relatively large rate to ensure the normal data packets in the first queue. Departure.
  • the first credit threshold may be set according to actual needs, for example, the first credit threshold may be -10K.
  • the queue credit is deficit, but the deficit is not serious. At this time, it can be determined that the first queue does need the queue scheduler to schedule it. And in order to ensure the normal dequeue of the data packets in the first queue, the first queue needs the queue scheduler to schedule it at a relatively small rate. Therefore, when the first difference is greater than the first credit threshold and less than the reference credit threshold, the target probability may be determined to be one.
  • the target probability may be determined as 1, and the first queue requires the queue scheduler to schedule it at a relatively small rate.
  • the first difference is compared with a preset first credit threshold, and when the first difference is smaller than the first credit threshold, the target probability is determined to be 1.
  • the queue credit of the first queue has a severe deficit, and the first queue urgently needs the queue scheduler to schedule it.
  • the first queue needs the queue scheduler to have a relatively large rate pair. It performs scheduling to ensure the normal dequeue of data packets in the first queue.
  • the target probability is determined according to the length difference.
  • the implementation process of the second implementation manner may include the following situations:
  • the length difference is compared with the reference credit threshold and the scheduling granularity respectively.
  • the target probability is determined based on the length difference and the scheduling granularity.
  • the method for determining the target probability based on the length difference and the scheduling granularity may include: determining a probability that the length difference is smaller than the first random number as the target probability.
  • the length difference is the difference between the current queue credit value of the first queue and the queue length of the first queue after the length difference is changed.
  • the target probability of generating the scheduling request may be determined to randomly generate the scheduling request, reduce the frequency at which the queue manager sends the scheduling request to the queue scheduler, and reduce the scheduling load of the queue scheduler, and further Ensure the effective dequeue of the data packet.
  • the length difference is respectively compared with the reference credit threshold and the preset first credit threshold.
  • the target probability is determined to be 1.
  • the implementation process of the second case should be referred to according to the first difference and the second difference.
  • the size of the value determines the implementation of the fourth case of the target probability, and will not be described here.
  • the length difference is compared with a preset first credit threshold, and when the length difference is less than the first credit threshold, the target probability is determined to be 1.
  • the queue courier of the first queue has a severe deficit, and the first queue urgently needs the queue scheduler to schedule it.
  • the implementation process of the third case should be referred to according to the first difference sum.
  • the size of the second difference determines the implementation process of the fifth case of the target probability, and details are not described herein again.
  • the process of comparing the length difference with each range may be performed in parallel, or may be performed in series.
  • the execution of the line is not specifically limited in the exemplary embodiment of the present application.
  • the first difference when the process of comparing the length difference with each range is performed serially, the first difference may be compared with a preset first credit threshold.
  • the difference is not less than the first credit threshold
  • the first difference is compared with the reference credit threshold, and when the first difference does not satisfy the first credit threshold and is less than the reference credit threshold, the second difference and the scheduling granularity are used.
  • the second interpolation difference does not satisfy the reference credit threshold and is smaller than the scheduling granularity
  • the first difference is compared with the scheduling granularity, and then the target probability is determined according to the comparison result.
  • the length difference when the process of comparing the length difference with each range is serial execution, the length difference may be first compared with a preset first credit threshold, when the length difference is not less than When the first credit threshold is used, the length difference is compared with the reference credit threshold. When the length difference does not satisfy the first credit threshold and is less than the reference credit threshold, the length difference is compared with the scheduling granularity, and then determined according to the comparison result. Target probability.
  • the first credit threshold is a threshold corresponding to a serious deficit in the queue credit
  • the first difference (or the length difference) is first compared with a preset first credit threshold, when the first difference (or length)
  • the operation of generating the scheduling request may be performed according to the situation of the severe deficit in time, thereby timely alleviating the situation that the queue credit has a serious deficit, so as to ensure the normal dequeue of the data packet in the first queue.
  • Step 202 Perform random generation of the scheduling request based on the target probability, such that the ratio of the probability of generating the scheduling request to the probability of not being generated is the target probability.
  • the scheduling request is used to indicate a scheduling state for scheduling the first queue.
  • the implementable manner of performing the random generation of the scheduling request based on the target probability may include: when selecting the generating the scheduling request based on the target probability, A scheduling request is generated based on the selection result.
  • the scheduling request includes a first status identifier or a second status identifier, where the first status identifier indicates a first rate when the queue scheduler performs queue scheduling, and the second status identifier indicates a second time when the queue scheduler performs queue scheduling. rate.
  • the first rate is less than a preset scheduling rate threshold, and the second rate is greater than a preset scheduling rate threshold.
  • the first queue needs the queue scheduler to schedule it at a relatively small rate.
  • the generated scheduling request may include the first state identifier; when the target probability is based on the fifth case of the first implementable manner described above
  • the first queue needs the queue scheduler to schedule it at a relatively large rate.
  • the generated scheduling request may include the second status identifier.
  • the target probability determined in step 201 based on the first difference value and the scheduling granularity is 1/4, and at this time, when selecting whether to generate a scheduling request, scheduling The ratio of the probability of request generation to the probability of not being generated is 1/4, and when the scheduling request is generated, a scheduling request may be generated, and the generated scheduling request includes a first state identifier to request the queue scheduler to The first rate schedules the first queue.
  • the queue manager is reduced based on the plurality of queues managed by the queue manager.
  • the number of scheduling requests is such that the number of scheduling requests generated by the queue manager is as uniformly distributed as possible, which reduces the frequency at which the queue manager sends scheduling requests to the queue scheduler, and can reduce the queue.
  • the scheduling load of the scheduler is such that the update rate of the scheduling state does not exceed the scheduling capability of the queue scheduler, thereby reducing the probability that the queue scheduler has a large scheduling delay for scheduling of the queue.
  • the number of scheduling requests generated by the queue manager can be uniformly distributed as shown in the queue manager, so that the current queue credits of all the queues are evenly distributed within the preset range corresponding to the scheduling granularity, and the queue credits of all the queues are The sum of the sums is close to the total scheduling bandwidth that the queue scheduler can schedule, so that the actual total scheduling bandwidth is more accurate, and the scheduling bandwidth caused by the high frequency of sending scheduling requests and the scheduling bandwidth ratio between the queues are inaccurate. And other issues.
  • Step 203 When a scheduling request is generated, the scheduling request is sent to the queue scheduler.
  • the sending the scheduling request to the queue scheduler includes: determining whether the scheduling status indicated by the scheduling request is the same as the current scheduling status corresponding to the first queue, and the current status corresponding to the first queue when the scheduling status indicated by the scheduling request is When the scheduling status is different, the scheduling request is sent to the queue scheduler.
  • the queue manager may compare the current scheduling state corresponding to the first queue with the scheduling state indicated by the scheduling request, when the scheduling state indicated by the scheduling request is the same as the current scheduling state corresponding to the first queue.
  • the queue scheduler can continue to schedule the first queue according to the current scheduling state. At this time, it is not necessary to send a scheduling request to the queue scheduler, which can save system resources; when the scheduling status indicated by the scheduling request is related to the current queue When the scheduling status is different, the scheduling request is sent to the queue scheduler to update the scheduling state of the queue queue to the first queue.
  • Step 204 Receive a scheduling response sent by a queue scheduler.
  • the scheduling response includes scheduling granularity.
  • the queue scheduler may run a scheduling algorithm according to the scheduling state indicated by the scheduling request, allocate a rated data amount for data transmission to the first queue, and send the same to the queue manager.
  • a scheduling response of the amount of data so that the queue manager performs a dequeue operation on the packets in the first queue.
  • Step 205 Update a current queue credit value of the first queue based on the scheduling response.
  • the current queue credit value of the first queue may be updated based on the rated data amount carried in the scheduling response, and the updating method may include: the current queue credit value when the scheduling request is generated. The sum of the rated data amount is determined as the updated current queue credit value.
  • the length difference of the first queue also changes accordingly.
  • the changed length difference and the queue length of the first queue determine the target probability again, so as to more accurately determine the current scheduling state, so that the queue scheduler can more effectively schedule the first queue, thereby realizing efficient use of resources.
  • Step 206 Perform a dequeuing operation on the data packet of the corresponding length in the first queue based on the updated current queue credit value.
  • the dequeuing operation may be performed on the data packet of the corresponding length in the first queue to implement data transmission. Moreover, since the dequeued data packet consumes the queue credit of the same data amount in the dequeuing operation, the length difference of the first queue does not change after the operation dequeuing operation is performed, and there is no need to update the scheduling at this time. status.
  • an action action of determining a target probability based on a length difference of the first queue and a queue length of the first queue, and an action of step 202 to step 205 may be performed by the queue management module in FIG. 1B, where The actions of step 206 can all be performed by the dequeue module of Figure 1B.
  • the queue scheduling method determines the target probability by changing the length difference of the first queue, and performs random generation of the scheduling request based on the target probability, so that the scheduling request may be generated.
  • the ratio of the likelihood to the ungenerated probability is the target probability, and when the scheduling request is generated, the scheduling request is sent to the queue scheduler, and the queue manager is configured to generate a schedule based on the plurality of queues managed by the queue manager relative to the related art.
  • the number of requests is such that the number of scheduling requests generated by the queue manager is uniformly distributed as shown in the queue manager, which can effectively reduce the frequency at which the queue manager sends scheduling requests to the queue scheduler, thereby reducing queue scheduling.
  • the scheduling load of the device reduces the probability that the queue scheduler has a large scheduling delay for the scheduling of the queue.
  • FIG. 7A is a block diagram of a queue scheduling apparatus 700 provided by an exemplary embodiment of the present application.
  • the apparatus 700 may include:
  • the first determining module 701 is configured to determine a target probability based on a length difference of the first queue and a queue length of the first queue when the length difference of the first queue changes.
  • the generating module 702 is configured to perform random generation of the scheduling request based on the target probability, such that the ratio of the probability of generating the scheduling request to the probability of not being generated is a target probability, and the scheduling request is used to indicate a scheduling state for scheduling the first queue. .
  • the sending module 703 is configured to send a scheduling request to the queue scheduler when the scheduling request is generated.
  • the first queue is any one of the at least one queue managed by the queue manager, and the length difference is the difference between the current queue credit value of the first queue and the queue length of the first queue, and the current queue credit value is The amount of data that a queue currently has for data transmission.
  • the queue scheduling apparatus determines the target probability when the length difference of the first queue changes by the first determining module, and the generating module performs random generation of the scheduling request based on the target probability.
  • the ratio of the possibility of generating the scheduling request to the probability of not being generated is the target probability.
  • the sending module sends the scheduling request to the queue scheduler, which reduces the queue manager based on the related technology.
  • the number of scheduling requests generated by the plurality of queues is such that the number of scheduling requests generated by the queue manager is uniformly distributed, which can effectively reduce the queue manager sending scheduling requests to the queue scheduler.
  • the frequency reduces the scheduling load of the queue scheduler, and reduces the probability that the queue scheduler has a large scheduling delay for scheduling of the queue.
  • the first determining module 701 may include:
  • the obtaining sub-module 7011 is configured to: when the queue length of the first queue changes, obtain a first difference after the length difference is changed, and a second difference before the change.
  • the first determining sub-module 7012 is configured to determine a target probability based on at least one of the first difference value and the second difference value, and a queue length of the first queue.
  • the first determining submodule 7012 may include:
  • the first comparison unit 7012a is configured to compare the first difference value with the reference credit threshold and the scheduling granularity respectively, where the reference credit threshold is smaller than the scheduling granularity, and the scheduling granularity is allocated by the queue scheduler to the first queue when scheduling the first queue.
  • the first determining unit 7012b is configured to determine a target probability based on the first difference and the scheduling granularity when the first difference is greater than a reference credit threshold and less than a scheduling granularity.
  • the first determining unit 7012b is configured to:
  • the probability that the target difference is greater than the first random number is determined as the target probability, and the target difference is the difference between the scheduling granularity and the first difference, and the first random number is a positive number that is randomly generated and not greater than the scheduling granularity.
  • the first determining submodule 7012 may include:
  • the first comparing unit 7012a is configured to compare the second difference with the reference credit threshold and the scheduling granularity respectively, where the reference credit threshold is smaller than the scheduling granularity, and the scheduling granularity is allocated by the queue scheduler to the first queue when scheduling the first queue.
  • the first determining unit 7012b is configured to determine a target probability based on the second difference and the target packet length when the second difference is greater than the reference credit threshold and less than the scheduling granularity, and the target packet length is to change the queue length of the first queue. The length of the packet.
  • the first determining unit 7012b is configured to:
  • the probability that the target packet length is greater than the second random number is determined as the target probability, and the second random number is a positive number that is randomly generated and not greater than the second difference.
  • the first determining sub-module 7012 may include:
  • the first comparison unit 7012a is configured to compare the first difference value with the reference credit threshold and the scheduling granularity respectively, where the reference credit threshold is smaller than the scheduling granularity, and the scheduling granularity is allocated by the queue scheduler to the first queue when scheduling the first queue.
  • the first comparing unit 7012a is configured to compare the second difference value with the reference credit threshold and the scheduling granularity, respectively.
  • the first determining unit 7012b is configured to: when the first difference value and the second difference value are both greater than the reference credit threshold and less than the scheduling granularity, determine the target probability based on the second difference and the target packet length, and the target packet length is The length of a packet whose queue length changes.
  • the first determining unit 7012b is configured to:
  • the ratio of the target packet length to the second difference is determined as the target probability.
  • the first determining sub-module 7012 may include:
  • the first comparing unit 7012a is configured to compare the first difference value with the reference credit threshold and the preset first credit threshold, where the first credit threshold is smaller than the reference credit threshold.
  • the first determining unit 7012b is configured to determine that the target probability is 1 when the first difference is greater than the first credit threshold and less than the reference credit threshold.
  • the first determining submodule 7012 may include:
  • the first comparing unit 7012a is configured to compare the first difference with a preset first credit threshold.
  • the first determining unit 7012b is configured to determine that the target probability is 1 when the first difference is less than the first credit threshold.
  • the first determining module 701 may include:
  • the second determining sub-module 7013 is configured to determine a target probability according to the length difference when the current queue credit value of the first queue changes.
  • the second determining submodule 7013 may include:
  • the second comparison unit 7013a is configured to compare the length difference value with the reference credit threshold and the scheduling granularity respectively, and the reference credit threshold is smaller than the scheduling granularity, and the scheduling granularity is used by the queue scheduler to allocate the first queue. The amount of data that is rated for data transmission.
  • the second determining unit 7013b is configured to determine the target probability based on the length difference and the scheduling granularity when the length difference is greater than the reference credit threshold and less than the scheduling granularity.
  • the second determining unit 7013b is configured to:
  • the probability that the length difference is smaller than the first random number is determined as the target probability, and the first random number is a positive number that is randomly generated and not larger than the scheduling granularity.
  • the second determining submodule 7013 may include:
  • the second comparing unit 7013a is configured to compare the length difference value with the reference credit threshold and the preset first credit threshold, where the first credit threshold is smaller than the reference credit threshold.
  • the second determining unit 7013b is configured to determine that the target probability is 1 when the length difference is greater than the first credit threshold and less than the reference credit threshold.
  • the second determining submodule 7013 may include:
  • the second comparing unit 7013a is configured to compare the length difference with a preset first credit threshold.
  • the second determining unit 7013b is configured to determine that the target probability is 1 when the length difference is less than the first credit threshold.
  • the generating module 702 is configured to:
  • the scheduling request is generated based on the target probability, the scheduling request is generated according to the selection result, and the scheduling request may include a first state identifier, where the first state identifier indicates a first rate when the queue scheduler performs queue scheduling, and the first rate is less than a preset.
  • the scheduling rate threshold is a first state identifier, where the first state identifier indicates a first rate when the queue scheduler performs queue scheduling, and the first rate is less than a preset.
  • the generating module 702 is configured to:
  • the scheduling request When the scheduling request is generated based on the target probability, the scheduling request is generated based on the selection result, the scheduling request may include a second status identifier, where the second status identifier indicates a second rate when the queue scheduler performs the queue scheduling, and the second rate is greater than the preset.
  • the scheduling rate threshold When the scheduling request is generated based on the target probability, the scheduling request is generated based on the selection result, the scheduling request may include a second status identifier, where the second status identifier indicates a second rate when the queue scheduler performs the queue scheduling, and the second rate is greater than the preset.
  • the scheduling rate threshold The scheduling rate threshold.
  • the apparatus 700 may further include:
  • the receiving module 704 is configured to receive a scheduling response sent by the queue scheduler, where the scheduling response may include a scheduling granularity, where the scheduling granularity is a rated data amount allocated by the queue scheduler for the first queue for data transmission.
  • the update module 705 is configured to update the current queue credit value of the first queue based on the scheduling response.
  • the apparatus 700 may further include:
  • the executing module 706 is configured to perform a dequeuing operation on the data packet of the corresponding length in the first queue based on the updated current queue credit value.
  • the sending module 703 is configured to:
  • the scheduling request is sent to the queue scheduler.
  • the apparatus 700 may further include:
  • the second determining module 707 is configured to determine that the length difference of the first queue changes when the queue length of the first queue changes.
  • the second determining module 707 is configured to determine that the length difference of the first queue changes when the current queue credit value of the first queue changes.
  • the queue scheduling apparatus determines the target probability when the length difference of the first queue changes by the first determining module, and the generating module performs random generation of the scheduling request based on the target probability.
  • the ratio of the possibility of generating the scheduling request to the probability of not being generated is the target probability.
  • the sending module sends the scheduling request to the queue scheduler, which reduces the queue manager based on the related technology.
  • the number of scheduling requests generated by the plurality of queues is such that the number of scheduling requests generated by the queue manager is uniformly distributed, which can effectively reduce the queue manager sending scheduling requests to the queue scheduler.
  • the frequency reduces the scheduling load of the queue scheduler, and reduces the probability that the queue scheduler has a large scheduling delay for scheduling of the queue.
  • the exemplary embodiment of the present application further provides a communication device, where the communication device includes: a queue scheduler and a queue manager;
  • the queue manager includes a queue scheduling device as shown in FIG. 7A or 7F.
  • the queue scheduler is configured to send a scheduling response to the queue manager after receiving the scheduling request sent by the queue manager, where the scheduling response is used to allocate a nominal amount of data for data transmission based on the scheduling request.
  • the exemplary embodiment of the present application further provides a queue scheduling apparatus, where the apparatus includes:
  • a memory for storing executable instructions of the processing component
  • processing component is configured to:
  • the target probability is determined based on the length difference of the first queue and the queue length of the first queue;
  • the scheduling request is sent to the queue scheduler
  • the first queue is any one of the at least one queue managed by the queue manager, and the length difference is the difference between the current queue credit value of the first queue and the queue length of the first queue, and the current queue credit value is The amount of data that a queue currently has for data transmission.
  • the exemplary embodiment of the present application provides a queue scheduling apparatus 20, including a memory, a processor, and a computer program stored on the memory and operable on the processor.
  • a queue scheduling apparatus 20 including a memory, a processor, and a computer program stored on the memory and operable on the processor.
  • the processor executes the computer program, the foregoing embodiment of the present application is implemented. Any of the queue scheduling methods.
  • the terminal may be the queue scheduling device 20 as shown in FIG. 8 .
  • FIG. 8 is a schematic structural diagram of a queue scheduling device 20 according to an exemplary embodiment of the present application. It can include a processor 22 and a signal interface 24.
  • Processor 22 includes one or more processing cores.
  • the processor 22 executes various functional applications and data processing by running software programs and modules.
  • the queue scheduling device 20 further includes components such as a memory 26, a bus 28, and the like.
  • the memory 26 and the signal interface 24 are connected to the processor 22 via a bus 28, respectively.
  • Memory 26 can be used to store software programs as well as modules.
  • memory 26 may store application modules 262 required for at least one function.
  • the application module 262 can include:
  • the first determining unit 2621 has the same or similar function as the first determining module 701.
  • the generating unit 2622 has the same or similar function as the generating module 702.
  • the transmitting unit 2623 has the same or similar function as the transmitting module 703.
  • the exemplary embodiments of the present application also provide a storage medium, which may be a non-transitory computer readable storage medium, enabling a terminal to execute an example of the present application when instructions in the storage medium are executed by a processing component of the terminal
  • the queue scheduling method provided by the embodiment.
  • the exemplary embodiments of the present application also provide a computer program product comprising instructions that, when executed on a computer, cause the computer to perform the queue scheduling method provided by the exemplary embodiments of the present application.
  • the queue scheduling method provided in the foregoing embodiment can also be used in other scenarios that require a single individual to perform rounding up or rounding, so that the overall randomness of multiple individuals is uniform, and the overall remainder is as close as possible.
  • the default value is, for example, the multi-port concatenation at the interface needs to be sent to a fixed length, and needs to be randomly and uniformly transmitted to avoid bursts, which is not specifically limited in the exemplary embodiment of the present application.
  • a person skilled in the art may understand that all or part of the steps of implementing the above embodiments may be completed by hardware, or may be instructed by a program to execute related hardware, and the program may be stored in a computer readable storage medium.
  • the storage medium mentioned may be a read only memory, a magnetic disk or an optical disk or the like.

Abstract

The present application relates to the technical field of data transmission. Disclosed are a queue scheduling method and apparatus, a communication device, and a storage medium. The method comprises: when a length difference of a first queue changes, determining a target probability, based on the length difference of the first queue and a queue length of the first queue; randomly generating a scheduling request based on the target probability, so that a proportion of a possibility of generating the scheduling request to a possibility of not generating the scheduling request is the target probability, the scheduling request being used for indicating a scheduling state for scheduling a first queue; and when the scheduling request is generated, sending the scheduling request to a queue scheduler, the first queue being any one of at least one queue managed by the scheduler, the length difference being a difference between a current queue credit value of the first queue and the queue length of the first queue, and the current queue credit value being a data amount quota of the first queue, which can be used for transmitting data. By means of the present application, the probability of great scheduling delay in the scheduling of a queue by a scheduler is reduced.

Description

队列调度方法及装置、通信设备、存储介质Queue scheduling method and device, communication device, storage medium
本申请要求于2017年12月08日提交的申请号为201711298688.6、申请名称为“队列调度方法及装置、通信设备、存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。The present application claims priority to Chinese Patent Application No. PCT Application No. No. No. No. No. No. No. No. No. No. in.
技术领域Technical field
本发明涉及数据传输技术领域,尤其涉及一种队列调度方法及装置、通信设备、存储介质。The present invention relates to the field of data transmission technologies, and in particular, to a queue scheduling method and apparatus, a communication device, and a storage medium.
背景技术Background technique
服务质量(Quality ofService,QoS)是反映网络状态的指标,其可以反映网络延迟和阻塞等网络状态,并且,队列调度技术是保证QoS的关键技术。其中,在队列调度技术中,路由器或交换机等负责队列调度的通信设备需要按照一定的规则调度数据包,使得缓存有数据包的每个队列都能得到公平的调度机会,以便每个队列中的数据包能够被发送出去。Quality of Service (QoS) is an indicator that reflects the state of the network. It can reflect the network status such as network delay and congestion. Queue scheduling technology is the key technology to guarantee QoS. Among them, in the queue scheduling technology, a communication device responsible for queue scheduling such as a router or a switch needs to schedule a data packet according to a certain rule, so that each queue in which the data packet is cached can obtain a fair scheduling opportunity, so that each queue is in a queue. Packets can be sent out.
相关技术中,通信设备中设置有队列管理器(Queue Manager,QM)和队列调度器(Queue SCheduler,QSC),对于队列管理器所管理的每个队列,队列管理器可根据该队列可用于数据传输的数据量额度(即队列信用值(queue credit))与该队列的队列长度(queue length)的差值,向队列调度器发送调度请求,以便于队列调度器为该队列分配用于数据传输的数据量,以实现该队列中数据包的传输。In the related art, a Queue Manager (QM) and a Queue SCheduler (QSC) are disposed in the communication device, and for each queue managed by the queue manager, the queue manager can use the data according to the queue. The difference between the transmitted data amount (ie, the queue credit) and the queue length of the queue, sends a scheduling request to the queue scheduler, so that the queue scheduler allocates the queue for data transmission. The amount of data to achieve the transfer of packets in the queue.
但是,由于采用该方法进行队列调度时,当队列管理器所管理的任一队列对应的差值发生变化时,队列管理器就会向队列调度器发送调度请求,这样,当队列管理器管理较多队列时,队列管理器发送调度请求的频率较高,出现队列调度器负载较大,无法及时处理调度请求的问题,导致对队列的调度出现调度时延较大。However, when the queue scheduling is performed by this method, when the difference corresponding to any queue managed by the queue manager changes, the queue manager sends a scheduling request to the queue scheduler, so that when the queue manager manages When a multi-queue is used, the queue manager sends a scheduling request with a high frequency. The queue scheduler has a large load and cannot process the scheduling request in a timely manner. As a result, the scheduling delay of the scheduling of the queue is large.
发明内容Summary of the invention
本申请提供了一种队列调度方法、装置、系统及计算机可读存储介质,可以解决当队列管理器管理较多队列时,队列管理器发送调度请求的频率较高,出现队列调度器负载较大,无法及时处理调度请求的问题,导致对队列的调度出现调度时延较大的问题,本申请提供的技术方案如下:The application provides a queue scheduling method, device, system and computer readable storage medium, which can solve the problem that when the queue manager manages more queues, the queue manager sends a scheduling request with a higher frequency, and the queue scheduler has a larger load. The problem that the scheduling request cannot be processed in time may result in a large scheduling delay for the scheduling of the queue. The technical solution provided by the present application is as follows:
第一方面,本申请示例性实施例提供了一种队列调度方法,所述方法应用于队列管理器,所述方法包括:In a first aspect, an exemplary embodiment of the present application provides a queue scheduling method, where the method is applied to a queue manager, and the method includes:
当第一队列的长度差值发生变化时,基于所述第一队列的长度差值和所述第一队列的队列长度确定目标概率;Determining a target probability based on a length difference of the first queue and a queue length of the first queue, when a difference in length of the first queue changes;
基于所述目标概率,进行调度请求的随机生成,使得所述调度请求生成的可能性与未生成的可能性的比例为所述目标概率,所述调度请求用于指示对所述第一队列进行调度的调度状态;And performing, according to the target probability, a random generation of the scheduling request, such that a ratio of the possibility of generating the scheduling request to an ungenerated possibility is the target probability, where the scheduling request is used to indicate that the first queue is performed Scheduled scheduling status;
当生成了所述调度请求,将所述调度请求发送至队列调度器;When the scheduling request is generated, the scheduling request is sent to a queue scheduler;
其中,所述第一队列为所述队列管理器所管理的至少一个队列中的任一队列,所述长度差值为所述第一队列的当前队列信用值与所述第一队列的队列长度的差值,所述当前队列信用值为所述第一队列当前可用于数据传输的数据量额度。The first queue is any one of at least one queue managed by the queue manager, and the length difference is a current queue credit value of the first queue and a queue length of the first queue. The difference between the current queue credits is the amount of data that the first queue is currently available for data transmission.
需要说明的是,通过在第一队列的长度差值发生变化时确定目标概率,基于目标概率,进行调度请求的随机生成,使得调度请求生成的可能性与未生成的可能性的比例为目标概率,且当生成了调度请求时,将调度请求发送至队列调度器,相对于相关技术,能够有效地减小队列管理器向队列调度器发送调度请求的频率,进而减小队列调度器的调度负载,降低队列调度器对队列的调度出现调度时延较大的概率。It should be noted that, by determining the target probability when the length difference of the first queue changes, the random generation of the scheduling request is performed based on the target probability, so that the ratio of the probability of generating the scheduling request to the probability of not generating is the target probability. And when the scheduling request is generated, the scheduling request is sent to the queue scheduler, which can effectively reduce the frequency at which the queue manager sends the scheduling request to the queue scheduler, thereby reducing the scheduling load of the queue scheduler. To reduce the probability that the queue scheduler has a large scheduling delay for the scheduling of the queue.
当由第一队列的队列长度导致第一队列的长度差值发生变化时,所述基于所述第一队列的长度差值和所述第一队列的队列长度确定目标概率,可以包括:When the length difference of the first queue is changed by the queue length of the first queue, the determining the target probability based on the length difference of the first queue and the queue length of the first queue may include:
当所述第一队列的队列长度发生变化时,获取所述长度差值变化后的第一差值,和变化前的第二差值;And acquiring, when the queue length of the first queue changes, a first difference after the change in the length difference, and a second difference before the change;
基于所述第一差值和所述第二差值中的至少一个,以及所述第一队列的队列长度确定所述目标概率。The target probability is determined based on at least one of the first difference and the second difference, and a queue length of the first queue.
作为一种可实现方式,所述基于所述第一差值和所述第二差值中的至少一个,以及所述第一队列的队列长度确定所述目标概率,包括:As an implementation manner, the determining, according to at least one of the first difference value and the second difference value, and a queue length of the first queue, the target probability includes:
将所述第一差值分别与参考信用阈值以及调度粒度比较,所述参考信用阈值小于所述调度粒度,所述调度粒度为所述队列调度器对所述第一队列进行调度时,为所述第一队列分配的用于数据传输的额定数据量;Comparing the first difference with a reference credit threshold and a scheduling granularity, where the reference credit threshold is smaller than the scheduling granularity, where the scheduling granularity is that when the queue scheduler schedules the first queue, The nominal amount of data allocated for data transmission allocated by the first queue;
当所述第一差值大于所述参考信用阈值且小于所述调度粒度时,基于所述第一差值和所述调度粒度确定所述目标概率。When the first difference is greater than the reference credit threshold and less than the scheduling granularity, the target probability is determined based on the first difference and the scheduling granularity.
当第一差值大于参考信用阈值且小于调度粒度时,可以确定第一队列还剩余有一定的队列信用,但该剩余的队列信用还不足以用于第一队列中的数据包出队,此时,为了保证第一队列中的数据包的有效出队,第一队列可以请求队列调度器对其进行调度,但是,为了避免队列管理器所管理多个队列均向队列调度器发送调度请求,此时,可以确定生成调度请求的目标概率,以便于根据该目标概率随机地生成调度请求,以减小队列管理器向队列调度器发送调度请求的频率,减小队列调度器的调度负载,进而保证数据包的有效出队。When the first difference is greater than the reference credit threshold and less than the scheduling granularity, it may be determined that the first queue still has a certain queue credit, but the remaining queue credit is not enough for the data packet in the first queue to be dequeued. In order to ensure the effective dequeue of the data packets in the first queue, the first queue may request the queue scheduler to schedule them, but in order to prevent the queue manager from managing multiple queues to send scheduling requests to the queue scheduler, At this time, the target probability of generating the scheduling request may be determined, so that the scheduling request is randomly generated according to the target probability, so as to reduce the frequency at which the queue manager sends the scheduling request to the queue scheduler, and reduce the scheduling load of the queue scheduler, and further Ensure the effective dequeue of the data packet.
可选地,所述基于所述第一差值和所述调度粒度确定所述目标概率,包括:Optionally, the determining the target probability based on the first difference value and the scheduling granularity, including:
将目标差值大于第一随机数的概率确定为所述目标概率,所述目标差值为所述调度粒度与所述第一差值的差值,所述第一随机数为随机产生且不大于所述调度粒度的正数。Determining, by the probability that the target difference is greater than the first random number, the target probability, where the target difference is a difference between the scheduling granularity and the first difference, the first random number is randomly generated and not A positive number greater than the scheduling granularity.
作为另一种可实现方式,所述基于所述第一差值和所述第二差值中的至少一个,以及所述第一队列的队列长度确定所述目标概率,包括:In another implementation manner, the determining the target probability based on at least one of the first difference value and the second difference value, and a queue length of the first queue, includes:
将所述第二差值分别与参考信用阈值以及调度粒度比较,所述参考信用阈值小于所述调度粒度,所述调度粒度为所述队列调度器对所述第一队列进行调度时,为所述第一队列分配的用于数据传输的额定数据量;Comparing the second difference with a reference credit threshold and a scheduling granularity, where the reference credit threshold is smaller than the scheduling granularity, where the scheduling granularity is when the queue scheduler schedules the first queue, The nominal amount of data allocated for data transmission allocated by the first queue;
当所述第二差值大于所述参考信用阈值且小于所述调度粒度时,基于所述第二差值和目标包长确定所述目标概率,所述目标包长为使所述第一队列的队列长度发生变化的数据包的长度。Determining the target probability based on the second difference and a target packet length when the second difference is greater than the reference credit threshold and less than the scheduling granularity, where the target packet length is the first queue The length of the packet whose length has changed.
当第二差值大于参考信用阈值且小于调度粒度时,可以确定第一队列还剩余有一定的 队列信用,但该剩余的队列信用还不足以用于第一队列中的数据包出队,此时,为了保证第一队列中的数据包的有效出队,以及为了避免队列管理器所管理多个队列均向队列调度器发送调度请求,此时,可以确定生成调度请求的目标概率,以便于根据该目标概率随机地生成调度请求,进而保证数据包的有效出队。When the second difference is greater than the reference credit threshold and less than the scheduling granularity, it may be determined that the first queue still has a certain queue credit, but the remaining queue credit is not enough for the data packet in the first queue to be dequeued. In order to ensure the effective dequeue of the data packets in the first queue, and to prevent the queue manager from managing the multiple queues to send the scheduling request to the queue scheduler, the target probability of generating the scheduling request may be determined at this time, so as to facilitate A scheduling request is randomly generated according to the target probability, thereby ensuring effective dequeue of the data packet.
可选地,所述基于所述第二差值和目标包长确定所述目标概率,包括:Optionally, the determining the target probability based on the second difference and the target packet length, including:
将所述目标包长大于第二随机数的概率确定为所述目标概率,所述第二随机数为随机产生且不大于所述第二差值的正数。The probability that the target packet length is greater than the second random number is determined as the target probability, and the second random number is a positive number that is randomly generated and not greater than the second difference.
在该情况下,基于第二差值和目标包长确定目标概率时,确定的目标概率呈现出更均匀的变化,能够进一步地减小队列管理器向队列调度器发送调度请求的频率,进而减小队列调度器的调度负载,能够进一步地降低队列调度器对队列的调度出现调度时延较大的概率。In this case, when the target probability is determined based on the second difference and the target packet length, the determined target probability exhibits a more uniform change, which can further reduce the frequency at which the queue manager sends the scheduling request to the queue scheduler, thereby reducing The scheduling load of the small queue scheduler can further reduce the probability that the queue scheduler has a large scheduling delay for scheduling of the queue.
作为又一种可实现方式,所述基于所述第一差值和所述第二差值中的至少一个,以及所述第一队列的队列长度确定所述目标概率,包括:In another implementation manner, the determining the target probability based on at least one of the first difference value and the second difference value, and a queue length of the first queue, includes:
将所述第一差值与参考信用阈值以及调度粒度分别比较,所述参考信用阈值小于所述调度粒度,所述调度粒度为所述队列调度器对所述第一队列进行调度时,为所述第一队列分配的用于数据传输的额定数据量;Comparing the first difference with the reference credit threshold and the scheduling granularity, where the reference credit threshold is smaller than the scheduling granularity, and the scheduling granularity is that when the queue scheduler schedules the first queue, The nominal amount of data allocated for data transmission allocated by the first queue;
将所述第二差值分别与所述参考信用阈值以及所述调度粒度比较;Comparing the second difference with the reference credit threshold and the scheduling granularity, respectively;
当所述第一差值与所述第二差值均满足:大于所述参考信用阈值且小于所述调度粒度时,基于所述第二差值和目标包长确定所述目标概率,所述目标包长为使所述第一队列的队列长度发生变化的数据包的长度。And determining, when the first difference value and the second difference value are greater than the reference credit threshold and less than the scheduling granularity, determining the target probability based on the second difference value and a target packet length, The target packet length is the length of the data packet that changes the queue length of the first queue.
需要说明的是,在该情况下,基于第二差值和目标包长确定目标概率,相对于基于第一差值和调度粒度确定目标概率的处理方法,能够进一步地减小队列管理器向队列调度器发送调度请求的频率,进而减小队列调度器的调度负载,能够进一步地降低队列调度器对队列的调度出现调度时延较大的概率。It should be noted that, in this case, the target probability is determined based on the second difference and the target packet length, and the queue manager can be further reduced to the queue according to the processing method for determining the target probability based on the first difference and the scheduling granularity. The frequency at which the scheduler sends the scheduling request, thereby reducing the scheduling load of the queue scheduler, can further reduce the probability that the queue scheduler has a large scheduling delay for scheduling the queue.
可选地,所述基于所述第二差值和目标包长确定所述目标概率,包括:Optionally, the determining the target probability based on the second difference and the target packet length, including:
将所述目标包长与所述第二差值的比值确定为所述目标概率。A ratio of the target packet length to the second difference is determined as the target probability.
作为再一种可实现方式,所述基于所述第一差值和所述第二差值中的至少一个,以及所述第一队列的队列长度确定所述目标概率,包括:In another implementation manner, the determining the target probability based on at least one of the first difference value and the second difference value, and a queue length of the first queue, includes:
将所述第一差值分别与参考信用阈值以及预设的第一信用阈值进行比较,所述第一信用阈值小于所述参考信用阈值;Comparing the first difference with a reference credit threshold and a preset first credit threshold, where the first credit threshold is less than the reference credit threshold;
当所述第一差值大于所述第一信用阈值且小于所述参考信用阈值时,确定所述目标概率为1。When the first difference is greater than the first credit threshold and less than the reference credit threshold, determining that the target probability is 1.
当第一差值大于第一信用阈值且小于参考信用阈值时,队列信用虽然出现赤字,但且出现赤字的情况不严重,此时,可以确定第一队列确实需要队列调度器对其进行调度,且为了保证第一队列中数据包的正常出队,该第一队列需要队列调度器以相对较小的速率对其进行调度。因此,当第一差值大于第一信用阈值且小于参考信用阈值时,可以确定目标概率为1。When the first difference is greater than the first credit threshold and less than the reference credit threshold, the queue credit is deficit, but the deficit is not serious. At this time, it can be determined that the first queue does need the queue scheduler to schedule it. And in order to ensure the normal dequeue of the data packets in the first queue, the first queue needs the queue scheduler to schedule it at a relatively small rate. Therefore, when the first difference is greater than the first credit threshold and less than the reference credit threshold, the target probability may be determined to be one.
作为还一种可实现方式,所述基于所述第一差值和所述第二差值中的至少一个,以及所述第一队列的队列长度确定所述目标概率,包括:In another implementation manner, the determining the target probability based on at least one of the first difference value and the second difference value, and a queue length of the first queue, includes:
将所述第一差值与预设的第一信用阈值进行比较;Comparing the first difference with a preset first credit threshold;
当所述第一差值小于所述第一信用阈值时,确定所述目标概率为1。When the first difference is less than the first credit threshold, the target probability is determined to be 1.
当第一差值小于第一信用阈值时,第一队列的队列信用出现严重赤字,第一队列急需队列调度器对其进行调度,例如:第一队列需要队列调度器以相对较大的速率对其进行调度,以保证第一队列中数据包的正常出队。When the first difference is less than the first credit threshold, the queue credit of the first queue has a severe deficit, and the first queue urgently needs the queue scheduler to schedule it. For example, the first queue needs the queue scheduler to have a relatively large rate pair. It performs scheduling to ensure the normal dequeue of data packets in the first queue.
当由第一队列的当前队列信用值导致第一队列的长度差值发生变化时,所述基于所述第一队列的长度差值和所述第一队列的队列长度确定目标概率,包括:When the length difference of the first queue is changed by the current queue credit value of the first queue, the target probability is determined based on the length difference of the first queue and the queue length of the first queue, including:
当所述第一队列的当前队列信用值发生变化时,根据所述长度差值确定所述目标概率。When the current queue credit value of the first queue changes, the target probability is determined according to the length difference.
作为一种可实现方式,所述根据所述长度差值确定所述目标概率,包括:As an implementation manner, the determining the target probability according to the length difference includes:
将所述长度差值分别与参考信用阈值以及调度粒度比较,所述参考信用阈值小于所述调度粒度,所述调度粒度为所述队列调度器对所述第一队列进行调度时,为所述第一队列分配的用于数据传输的额定数据量;Comparing the length difference with the reference credit threshold and the scheduling granularity, where the reference credit threshold is smaller than the scheduling granularity, and the scheduling granularity is when the queue scheduler schedules the first queue, The nominal amount of data allocated for data transmission by the first queue;
当所述长度差值大于所述参考信用阈值且小于所述调度粒度时,基于所述长度差值和所述调度粒度确定所述目标概率。When the length difference is greater than the reference credit threshold and less than the scheduling granularity, the target probability is determined based on the length difference and the scheduling granularity.
在该第一种情况下,当长度差值大于参考信用阈值且小于调度粒度时,可以确定第一队列还剩余有一定的队列信用,但该剩余的队列信用还不足以用于第一队列中的数据包出队,此时,可以确定生成调度请求的目标概率,以随机地生成调度请求,减小队列管理器向队列调度器发送调度请求的频率,减小队列调度器的调度负载,进而保证数据包的有效出队。In the first case, when the length difference is greater than the reference credit threshold and less than the scheduling granularity, it may be determined that the first queue still has a certain queue credit, but the remaining queue credit is not enough for the first queue. The data packet is dequeued. At this time, the target probability of generating the scheduling request may be determined to randomly generate the scheduling request, reduce the frequency at which the queue manager sends the scheduling request to the queue scheduler, and reduce the scheduling load of the queue scheduler, and further Ensure the effective dequeue of the data packet.
可选地,所述基于所述长度差值和所述调度粒度确定所述目标概率,包括:Optionally, the determining the target probability based on the length difference and the scheduling granularity, including:
将所述长度差值小于第一随机数的概率确定为所述目标概率,所述第一随机数为随机产生且不大于所述调度粒度的正数。Determining, by the probability that the length difference is smaller than the first random number, is the target probability, and the first random number is a positive number that is randomly generated and not greater than the scheduling granularity.
作为另一种可实现方式,所述根据所述长度差值确定所述目标概率,包括:As another implementation manner, the determining the target probability according to the length difference includes:
将所述长度差值分别与参考信用阈值以及预设的第一信用阈值进行比较,所述第一信用阈值小于所述参考信用阈值;Comparing the length difference with a reference credit threshold and a preset first credit threshold, where the first credit threshold is less than the reference credit threshold;
当所述长度差值大于所述第一信用阈值且小于所述参考信用阈值时,确定所述目标概率为1。When the length difference is greater than the first credit threshold and less than the reference credit threshold, determining that the target probability is 1.
当长度差值大于第一信用阈值且小于参考信用阈值时,队列信用虽然出现赤字,但且出现赤字的情况不严重,此时,可以确定第一队列确实需要队列调度器对其进行调度,且为了保证第一队列中数据包的正常出队,该第一队列需要队列调度器以相对较小的速率对其进行调度。因此,当长度差值大于第一信用阈值且小于参考信用阈值时,可以确定目标概率为1。When the length difference is greater than the first credit threshold and less than the reference credit threshold, the queue credit is deficit, but the deficit is not serious. At this time, it can be determined that the first queue does need the queue scheduler to schedule it, and In order to ensure the normal dequeue of data packets in the first queue, the first queue needs the queue scheduler to schedule it at a relatively small rate. Therefore, when the length difference is greater than the first credit threshold and less than the reference credit threshold, the target probability may be determined to be one.
作为又一种可实现方式,所述根据所述长度差值确定所述目标概率,包括:In another implementation manner, the determining the target probability according to the length difference includes:
将所述长度差值与预设的第一信用阈值进行比较;Comparing the length difference with a preset first credit threshold;
当所述长度差值小于所述第一信用阈值时,确定所述目标概率为1。When the length difference is less than the first credit threshold, the target probability is determined to be 1.
当长度差值小于第一信用阈值时,第一队列的队列信用出现严重赤字,第一队列急需队列调度器对其进行调度。When the length difference is less than the first credit threshold, the queue credit of the first queue has a severe deficit, and the first queue urgently needs the queue scheduler to schedule it.
相应的,所述基于所述目标概率,进行所述调度请求的随机生成,包括:Correspondingly, the performing random generation of the scheduling request based on the target probability includes:
当基于所述目标概率,选择生成所述调度请求时,基于选择结果生成所述调度请求, 所述调度请求包括第一状态标识,所述第一状态标识指示所述队列调度器进行队列调度时的第一速率,所述第一速率小于预设的调度速率阈值。When the scheduling request is generated based on the target probability, the scheduling request is generated based on the selection result, where the scheduling request includes a first status identifier, where the first status identifier indicates that the queue scheduler performs queue scheduling The first rate, the first rate is less than a preset scheduling rate threshold.
或者,所述基于所述目标概率,进行所述调度请求的随机生成,包括:Or performing random generation of the scheduling request based on the target probability, including:
当基于所述目标概率,选择生成所述调度请求时,基于选择结果生成所述调度请求,所述调度请求包括第二状态标识,所述第二状态标识指示所述队列调度器进行队列调度时的第二速率,所述第二速率大于预设的调度速率阈值。When the scheduling request is generated based on the target probability, the scheduling request is generated based on the selection result, where the scheduling request includes a second status identifier, where the second status identifier indicates that the queue scheduler performs queue scheduling The second rate is greater than a preset scheduling rate threshold.
需要说明的是,当基于目标概率进行调度请求的随机生成时,由于调度请求生成的可能性与未生成的可能性的比例为目标概率,降低了队列管理器基于其所管理的多个队列生成调度请求的数量,使得队列管理器所管理的多个队列生成调度请求的数量尽量呈现出均匀分布的状态,相应的减小了队列管理器向队列调度器发送调度请求的频率,能够减小队列调度器的调度负载,使得调度状态的更新速率不超过队列调度器的调度能力,进而降低队列调度器对队列的调度出现调度时延较大的概率。并且,由于队列管理器所管理的多个队列生成调度请求的数量能够尽量呈现出均匀分布的状态,使得所有队列的当前队列信用均均匀分布在调度粒度对应的预设范围内,所有队列的队列信用的总和趋近于队列调度器能够调度的总调度带宽,使其实际的总调度带宽更准确,能够解决发送调度请求的频率较高时所引起的调度带宽过多和队列间调度带宽比例不准确等问题。It should be noted that when the random generation of the scheduling request is performed based on the target probability, since the ratio of the possibility of generating the scheduling request to the probability of not generating is the target probability, the queue manager is reduced based on the plurality of queues managed by the queue manager. The number of scheduling requests is such that the number of scheduling requests generated by the queue manager is as uniformly distributed as possible, which reduces the frequency at which the queue manager sends scheduling requests to the queue scheduler, and can reduce the queue. The scheduling load of the scheduler is such that the update rate of the scheduling state does not exceed the scheduling capability of the queue scheduler, thereby reducing the probability that the queue scheduler has a large scheduling delay for scheduling of the queue. In addition, the number of scheduling requests generated by the queue manager can be uniformly distributed as shown in the queue manager, so that the current queue credits of all the queues are evenly distributed within the preset range corresponding to the scheduling granularity. The sum of the credits is close to the total scheduling bandwidth that the queue scheduler can schedule, so that the actual total scheduling bandwidth is more accurate, and the scheduling bandwidth caused by the high frequency of sending the scheduling request and the scheduling bandwidth between the queues are not solved. Accurate and other issues.
进一步地,在将所述调度请求发送至队列调度器之后,所述方法还包括:Further, after the scheduling request is sent to the queue scheduler, the method further includes:
接收所述队列调度器发送的调度响应,所述调度响应包括调度粒度,所述调度粒度为所述队列调度器为所述第一队列分配的用于数据传输的额定数据量;Receiving a scheduling response sent by the queue scheduler, where the scheduling response includes a scheduling granularity, where the scheduling granularity is a rated data amount allocated by the queue scheduler for the first queue for data transmission;
基于所述调度响应更新所述第一队列的当前队列信用值。Updating the current queue credit value of the first queue based on the scheduling response.
队列调度器接收队列管理器发送的调度请求后,可以根据调度请求所指示的调度状态运行调度算法,为第一队列分配用于数据传输的额定数据量,并向队列管理器发送携带有该额定数据量的调度响应,以便于队列管理器根据其进行队列信用更新,进而对第一队列中的数据包执行出队操作。After receiving the scheduling request sent by the queue manager, the queue scheduler may run a scheduling algorithm according to the scheduling state indicated by the scheduling request, allocate a rated data amount for data transmission to the first queue, and send the same to the queue manager. A scheduling response of the amount of data, so that the queue manager performs a queue credit update according to it, thereby performing a dequeuing operation on the data packets in the first queue.
可选地,在所述基于所述调度响应更新所述第一队列的当前队列信用值之后,所述方法还包括:Optionally, after the updating the current queue credit value of the first queue based on the scheduling response, the method further includes:
基于更新后的当前队列信用值,对所述第一队列中相应长度的数据包执行出队操作。Dequeuing the data packet of the corresponding length in the first queue based on the updated current queue credit value.
在更新当前队列信用值后,若当前队列信用值满足第一队列中数据包的出队数据量,即可对第一队列中相应长度的数据包执行出队操作,以实现数据的传输。After updating the current queue credit value, if the current queue credit value satisfies the dequeue data volume of the data packet in the first queue, the dequeuing operation may be performed on the data packet of the corresponding length in the first queue to implement data transmission.
进一步地,所述将所述调度请求发送至队列调度器,包括:Further, the sending the scheduling request to the queue scheduler includes:
判断所述调度请求所指示的调度状态与所述第一队列对应的当前调度状态是否相同;Determining whether the scheduling state indicated by the scheduling request is the same as the current scheduling state corresponding to the first queue;
当所述调度请求所指示的调度状态与所述第一队列对应的当前调度状态不同时,将所述调度请求发送至所述队列调度器。And when the scheduling state indicated by the scheduling request is different from the current scheduling state corresponding to the first queue, the scheduling request is sent to the queue scheduler.
当生成了调度请求后,队列管理器可以将第一队列对应的当前调度状态与调度请求所指示的调度状态进行比较,当调度请求所指示的调度状态与第一队列对应的当前调度状态相同时,队列调度器可以继续按照当前调度状态对第一队列进行调度,此时,无需向队列调度器发送调度请求,这样可以节约系统资源;当调度请求所指示的调度状态与第一队列对应的当前调度状态不同时,将调度请求发送至队列调度器,以更新队列调度器对第一队列的调度状态。After the scheduling request is generated, the queue manager may compare the current scheduling state corresponding to the first queue with the scheduling state indicated by the scheduling request, when the scheduling state indicated by the scheduling request is the same as the current scheduling state corresponding to the first queue. The queue scheduler can continue to schedule the first queue according to the current scheduling state. At this time, it is not necessary to send a scheduling request to the queue scheduler, which can save system resources; when the scheduling status indicated by the scheduling request is related to the current queue When the scheduling status is different, the scheduling request is sent to the queue scheduler to update the scheduling state of the queue queue to the first queue.
可选地,在所述当第一队列的长度差值发生变化时,基于所述第一队列的长度差值和所述第一队列的队列长度确定目标概率之前,所述方法还包括:Optionally, before the determining the target probability based on the difference between the length of the first queue and the queue length of the first queue, when the length difference of the first queue is changed, the method further includes:
当所述第一队列的队列长度发生变化时,确定所述第一队列的长度差值发生变化;When the queue length of the first queue changes, determining that the length difference of the first queue changes;
和/或,当所述第一队列的当前队列信用值发生变化时,确定所述第一队列的长度差值发生变化。And/or, when the current queue credit value of the first queue changes, determining that the length difference of the first queue changes.
第二方面,本申请示例性实施例还提供了一种队列调度装置,所述装置包括:In a second aspect, an exemplary embodiment of the present application further provides a queue scheduling apparatus, where the apparatus includes:
第一确定模块,用于当第一队列的长度差值发生变化时,基于所述第一队列的长度差值和所述第一队列的队列长度确定目标概率;a first determining module, configured to determine a target probability based on a length difference of the first queue and a queue length of the first queue when a difference in length of the first queue changes;
生成模块,用于基于所述目标概率,进行调度请求的随机生成,使得所述调度请求生成的可能性与未生成的可能性的比例为所述目标概率,所述调度请求用于指示对所述第一队列进行调度的调度状态;a generating module, configured to perform random generation of the scheduling request based on the target probability, such that a ratio of a probability of generating the scheduling request to an ungenerated possibility is the target probability, and the scheduling request is used to indicate a target Decoding the scheduling state of the first queue;
发送模块,用于当生成了所述调度请求,将所述调度请求发送至队列调度器;a sending module, configured to send the scheduling request to a queue scheduler when the scheduling request is generated;
其中,所述第一队列为所述队列管理器所管理的至少一个队列中的任一队列,所述长度差值为所述第一队列的当前队列信用值与所述第一队列的队列长度的差值,所述当前队列信用值为所述第一队列当前可用于数据传输的数据量额度。The first queue is any one of at least one queue managed by the queue manager, and the length difference is a current queue credit value of the first queue and a queue length of the first queue. The difference between the current queue credits is the amount of data that the first queue is currently available for data transmission.
可选地,所述第一确定模块,包括:Optionally, the first determining module includes:
获取子模块,用于当所述第一队列的队列长度发生变化时,获取所述长度差值变化后的第一差值,和变化前的第二差值;Obtaining a sub-module, configured to: when the queue length of the first queue changes, obtain a first difference after the length difference is changed, and a second difference before the change;
第一确定子模块,用于基于所述第一差值和所述第二差值中的至少一个,以及所述第一队列的队列长度确定所述目标概率。a first determining submodule, configured to determine the target probability based on at least one of the first difference value and the second difference value, and a queue length of the first queue.
作为一种可实现方式,所述第一确定子模块,包括:As an implementation manner, the first determining submodule includes:
第一比较单元,用于将所述第一差值分别与参考信用阈值以及调度粒度比较,所述参考信用阈值小于所述调度粒度,所述调度粒度为所述队列调度器对所述第一队列进行调度时,为所述第一队列分配的用于数据传输的额定数据量;a first comparing unit, configured to compare the first difference with a reference credit threshold and a scheduling granularity, where the reference credit threshold is smaller than the scheduling granularity, and the scheduling granularity is that the queue scheduler pairs the first The rated data amount allocated for the first queue for data transmission when the queue is scheduled;
第一确定单元,用于当所述第一差值大于所述参考信用阈值且小于所述调度粒度时,基于所述第一差值和所述调度粒度确定所述目标概率。a first determining unit, configured to determine the target probability based on the first difference value and the scheduling granularity when the first difference value is greater than the reference credit threshold and less than the scheduling granularity.
其中,所述第一确定单元,用于:The first determining unit is configured to:
将目标差值大于第一随机数的概率确定为所述目标概率,所述目标差值为所述调度粒度与所述第一差值的差值,所述第一随机数为随机产生且不大于所述调度粒度的正数。Determining, by the probability that the target difference is greater than the first random number, the target probability, where the target difference is a difference between the scheduling granularity and the first difference, the first random number is randomly generated and not A positive number greater than the scheduling granularity.
作为另一种可实现方式,所述第一确定子模块,包括:As another implementation manner, the first determining submodule includes:
第一比较单元,用于将所述第二差值分别与参考信用阈值以及调度粒度比较,所述参考信用阈值小于所述调度粒度,所述调度粒度为所述队列调度器对所述第一队列进行调度时,为所述第一队列分配的用于数据传输的额定数据量;a first comparing unit, configured to compare the second difference with a reference credit threshold and a scheduling granularity, where the reference credit threshold is smaller than the scheduling granularity, and the scheduling granularity is that the queue scheduler pairs the first The rated data amount allocated for the first queue for data transmission when the queue is scheduled;
第一确定单元,用于当所述第二差值大于所述参考信用阈值且小于所述调度粒度时,基于所述第二差值和目标包长确定所述目标概率,所述目标包长为使所述第一队列的队列长度发生变化的数据包的长度。a first determining unit, configured to determine, according to the second difference and a target packet length, the target probability, when the second difference is greater than the reference credit threshold and less than the scheduling granularity, the target packet length The length of the data packet for which the queue length of the first queue changes.
其中,所述第一确定单元,用于:The first determining unit is configured to:
将所述目标包长大于第二随机数的概率确定为所述目标概率,所述第二随机数为随机产生且不大于所述第二差值的正数。The probability that the target packet length is greater than the second random number is determined as the target probability, and the second random number is a positive number that is randomly generated and not greater than the second difference.
作为又一种可实现方式,所述第一确定子模块,包括:In another implementation manner, the first determining submodule includes:
第一比较单元,用于将所述第一差值与参考信用阈值以及调度粒度分别比较,所述参考信用阈值小于所述调度粒度,所述调度粒度为所述队列调度器对所述第一队列进行调度时,为所述第一队列分配的用于数据传输的额定数据量;a first comparing unit, configured to compare the first difference value with a reference credit threshold and a scheduling granularity, where the reference credit threshold is smaller than the scheduling granularity, and the scheduling granularity is that the queue scheduler pairs the first The rated data amount allocated for the first queue for data transmission when the queue is scheduled;
所述第一比较单元,用于将所述第二差值分别与所述参考信用阈值以及所述调度粒度比较;The first comparing unit is configured to compare the second difference value with the reference credit threshold and the scheduling granularity respectively;
第一确定单元,用于当所述第一差值与所述第二差值均满足:大于所述参考信用阈值且小于所述调度粒度时,基于所述第二差值和目标包长确定所述目标概率,所述目标包长为使所述第一队列的队列长度发生变化的数据包的长度。a first determining unit, configured to determine, when the first difference value and the second difference value are greater than the reference credit threshold and less than the scheduling granularity, based on the second difference value and a target packet length The target probability, the target packet length is a length of a data packet that changes a queue length of the first queue.
其中,所述第一确定单元,用于:The first determining unit is configured to:
将所述目标包长与所述第二差值的比值确定为所述目标概率。A ratio of the target packet length to the second difference is determined as the target probability.
作为再一种可实现方式,所述第一确定子模块,包括:In another implementation manner, the first determining submodule includes:
第一比较单元,用于将所述第一差值分别与参考信用阈值以及预设的第一信用阈值进行比较,所述第一信用阈值小于所述参考信用阈值;a first comparison unit, configured to compare the first difference value with a reference credit threshold and a preset first credit threshold, where the first credit threshold is smaller than the reference credit threshold;
第一确定单元,用于当所述第一差值大于所述第一信用阈值且小于所述参考信用阈值时,确定所述目标概率为1。The first determining unit is configured to determine that the target probability is 1 when the first difference is greater than the first credit threshold and less than the reference credit threshold.
作为还一种可实现方式,所述第一确定子模块,包括:In another implementation manner, the first determining submodule includes:
第一比较单元,用于将所述第一差值与预设的第一信用阈值进行比较;a first comparing unit, configured to compare the first difference with a preset first credit threshold;
第一确定单元,用于当所述第一差值小于所述第一信用阈值时,确定所述目标概率为1。a first determining unit, configured to determine that the target probability is 1 when the first difference is less than the first credit threshold.
可选地,所述第一确定模块,包括:Optionally, the first determining module includes:
第二确定子模块,用于当所述第一队列的当前队列信用值发生变化时,根据所述长度差值确定所述目标概率。a second determining submodule, configured to determine the target probability according to the length difference when a current queue credit value of the first queue changes.
作为一种可实现方式,所述第二确定子模块,包括:As an implementation manner, the second determining submodule includes:
第二比较单元,用于将所述长度差值分别与参考信用阈值以及调度粒度比较,所述参考信用阈值小于所述调度粒度,所述调度粒度为所述队列调度器对所述第一队列进行调度时,为所述第一队列分配的用于数据传输的额定数据量;a second comparing unit, configured to compare the length difference value with a reference credit threshold and a scheduling granularity, where the reference credit threshold is smaller than the scheduling granularity, where the scheduling granularity is that the queue scheduler is to the first queue The amount of rated data allocated for the first queue for data transmission when scheduling is performed;
第二确定单元,用于当所述长度差值大于所述参考信用阈值且小于所述调度粒度时,基于所述长度差值和所述调度粒度确定所述目标概率。a second determining unit, configured to determine the target probability based on the length difference and the scheduling granularity when the length difference is greater than the reference credit threshold and less than the scheduling granularity.
其中,所述第二确定单元,用于:The second determining unit is configured to:
将所述长度差值小于第一随机数的概率确定为所述目标概率,所述第一随机数为随机产生且不大于所述调度粒度的正数。Determining, by the probability that the length difference is smaller than the first random number, is the target probability, and the first random number is a positive number that is randomly generated and not greater than the scheduling granularity.
作为另一种可实现方式,所述第二确定子模块,包括:As another implementation manner, the second determining submodule includes:
第二比较单元,用于将所述长度差值分别与参考信用阈值以及预设的第一信用阈值进行比较,所述第一信用阈值小于所述参考信用阈值;a second comparing unit, configured to compare the length difference value with a reference credit threshold and a preset first credit threshold, where the first credit threshold is smaller than the reference credit threshold;
第二确定单元,用于当所述长度差值大于所述第一信用阈值且小于所述参考信用阈值时,确定所述目标概率为1。And a second determining unit, configured to determine that the target probability is 1 when the length difference is greater than the first credit threshold and less than the reference credit threshold.
作为又一种可实现方式,所述第二确定子模块,包括:In another implementation manner, the second determining submodule includes:
第二比较单元,用于将所述长度差值与预设的第一信用阈值进行比较;a second comparing unit, configured to compare the length difference with a preset first credit threshold;
第二确定单元,用于当所述长度差值小于所述第一信用阈值时,确定所述目标概率为1。a second determining unit, configured to determine that the target probability is 1 when the length difference is less than the first credit threshold.
可选地,所述生成模块,用于:Optionally, the generating module is configured to:
当基于所述目标概率,选择生成所述调度请求时,基于选择结果生成所述调度请求,所述调度请求包括第一状态标识,所述第一状态标识指示所述队列调度器进行队列调度时的第一速率,所述第一速率小于预设的调度速率阈值。When the scheduling request is generated based on the target probability, the scheduling request is generated based on the selection result, where the scheduling request includes a first status identifier, where the first status identifier indicates that the queue scheduler performs queue scheduling The first rate, the first rate is less than a preset scheduling rate threshold.
可选地,所述生成模块,用于:Optionally, the generating module is configured to:
当基于所述目标概率,选择生成所述调度请求时,基于选择结果生成所述调度请求,所述调度请求包括第二状态标识,所述第二状态标识指示所述队列调度器进行队列调度时的第二速率,所述第二速率大于预设的调度速率阈值。When the scheduling request is generated based on the target probability, the scheduling request is generated based on the selection result, where the scheduling request includes a second status identifier, where the second status identifier indicates that the queue scheduler performs queue scheduling The second rate is greater than a preset scheduling rate threshold.
进一步地,所述装置还包括:Further, the device further includes:
接收模块,用于接收所述队列调度器发送的调度响应,所述调度响应包括调度粒度,所述调度粒度为所述队列调度器为所述第一队列分配的用于数据传输的额定数据量;a receiving module, configured to receive a scheduling response sent by the queue scheduler, where the scheduling response includes a scheduling granularity, where the scheduling granularity is a rated data volume allocated by the queue scheduler for the first queue for data transmission ;
更新模块,用于基于所述调度响应更新所述第一队列的当前队列信用值。And an update module, configured to update a current queue credit value of the first queue based on the scheduling response.
可选地,所述装置还包括:Optionally, the device further includes:
执行模块,用于基于更新后的当前队列信用值,对所述第一队列中相应长度的数据包执行出队操作。And an execution module, configured to perform a dequeuing operation on the data packet of the corresponding length in the first queue based on the updated current queue credit value.
其中,所述发送模块,用于:The sending module is configured to:
判断所述调度请求所指示的调度状态与所述第一队列对应的当前调度状态是否相同;Determining whether the scheduling state indicated by the scheduling request is the same as the current scheduling state corresponding to the first queue;
当所述调度请求所指示的调度状态与所述第一队列对应的当前调度状态不同时,将所述调度请求发送至所述队列调度器。And when the scheduling state indicated by the scheduling request is different from the current scheduling state corresponding to the first queue, the scheduling request is sent to the queue scheduler.
可选地,所述装置还包括:Optionally, the device further includes:
第二确定模块,用于当所述第一队列的队列长度发生变化时,确定所述第一队列的长度差值发生变化;a second determining module, configured to determine, when the queue length of the first queue changes, a change in a length difference of the first queue;
和/或,所述第二确定模块,用于当所述第一队列的当前队列信用值发生变化时,确定所述第一队列的长度差值发生变化。And/or, the second determining module is configured to determine that a difference in length of the first queue changes when a current queue credit value of the first queue changes.
第三方面,本申请示例性实施例还提供了一种通信设备,所述通信设备包括:队列调度器和队列管理器;In a third aspect, an exemplary embodiment of the present application further provides a communication device, where the communication device includes: a queue scheduler and a queue manager;
所述队列管理器包括如第二方面任一所述的队列调度装置;The queue manager includes the queue scheduling device of any of the second aspects;
所述队列调度器用于在接收到所述队列管理器发送的调度请求后,向所述队列管理器发送调度响应,所述调度响应用于为基于所述调度请求分配用于数据传输的额定数据量。The queue scheduler is configured to send a scheduling response to the queue manager after receiving the scheduling request sent by the queue manager, where the scheduling response is used to allocate rated data for data transmission based on the scheduling request. the amount.
第四方面,本申请示例性实施例还提供了一种队列调度装置,所述装置包括:In a fourth aspect, an exemplary embodiment of the present application further provides a queue scheduling apparatus, where the apparatus includes:
处理组件;Processing component
用于存储所述处理组件的可执行指令的存储器;a memory for storing executable instructions of the processing component;
其中,所述处理组件被配置为:Wherein the processing component is configured to:
当第一队列的长度差值发生变化时,基于所述第一队列的长度差值和所述第一队列的队列长度确定目标概率;Determining a target probability based on a length difference of the first queue and a queue length of the first queue, when a difference in length of the first queue changes;
基于所述目标概率,进行调度请求的随机生成,使得所述调度请求生成的可能性与未生成的可能性的比例为所述目标概率,所述调度请求用于指示对所述第一队列进行调度的调度状态;And performing, according to the target probability, a random generation of the scheduling request, such that a ratio of the possibility of generating the scheduling request to an ungenerated possibility is the target probability, where the scheduling request is used to indicate that the first queue is performed Scheduled scheduling status;
当生成了所述调度请求,将所述调度请求发送至队列调度器;When the scheduling request is generated, the scheduling request is sent to a queue scheduler;
其中,所述第一队列为所述队列管理器所管理的至少一个队列中的任一队列,所述长度差值为所述第一队列的当前队列信用值与所述第一队列的队列长度的差值,所述当前队列信用值为所述第一队列当前可用于数据传输的数据量额度。The first queue is any one of at least one queue managed by the queue manager, and the length difference is a current queue credit value of the first queue and a queue length of the first queue. The difference between the current queue credits is the amount of data that the first queue is currently available for data transmission.
第五方面,本申请示例性实施例还提供了一种存储介质,当所述存储介质中的指令由终端的处理组件执行时,使得所述终端能够执行第一方面任一所述的队列调度方法。In a fifth aspect, the exemplary embodiment of the present application further provides a storage medium, when the instructions in the storage medium are executed by a processing component of the terminal, enabling the terminal to perform the queue scheduling according to any one of the first aspects. method.
本申请示例性实施例提供的技术方案带来的有益效果是:The technical solutions provided by the exemplary embodiments of the present application have the following beneficial effects:
本申请示例性实施例提供的队列调度方法及装置、通信设备、存储介质,通过在第一队列的长度差值发生变化时确定目标概率,基于目标概率,进行调度请求的随机生成,使得调度请求生成的可能性与未生成的可能性的比例为目标概率,且当生成了调度请求时,将调度请求发送至队列调度器,相对于相关技术,降低了队列管理器基于其所管理的多个队列生成调度请求的数量,使得队列管理器所管理的多个队列生成调度请求的数量尽量呈现出均匀分布的状态,能够有效地减小队列管理器向队列调度器发送调度请求的频率,进而减小队列调度器的调度负载,降低队列调度器对队列的调度出现调度时延较大的概率。The queue scheduling method and apparatus, the communication device, and the storage medium provided by the exemplary embodiments of the present application determine a target probability by changing a length difference of the first queue, and perform random generation of the scheduling request based on the target probability, so that the scheduling request is performed. The ratio of the generated possibility to the ungenerated possibility is the target probability, and when the scheduling request is generated, the scheduling request is sent to the queue scheduler, which reduces the plurality of queue managers based on the related management techniques. The number of scheduling requests generated by the queue is such that the number of scheduling requests generated by the queue manager is uniformly distributed as shown in the queue, which can effectively reduce the frequency at which the queue manager sends scheduling requests to the queue scheduler, thereby reducing The scheduling load of the small queue scheduler reduces the probability that the queue scheduler has a large scheduling delay for the scheduling of the queue.
附图说明DRAWINGS
图1A是本申请示例性实施例提供的一种队列调度方法所涉及的实施环境的示意图。FIG. 1A is a schematic diagram of an implementation environment involved in a queue scheduling method according to an exemplary embodiment of the present disclosure.
图1B是本申请示例性实施例提供的一种队列调度的原理示意图。FIG. 1B is a schematic diagram of a principle of queue scheduling provided by an exemplary embodiment of the present application.
图2是本申请示例性实施例提供的一种队列调度方法的流程图。FIG. 2 is a flowchart of a queue scheduling method provided by an exemplary embodiment of the present application.
图3是本申请示例性实施例提供的一种检测第一队列的队列长度是否发生变化的方法流程图。FIG. 3 is a flowchart of a method for detecting whether a queue length of a first queue changes according to an exemplary embodiment of the present application.
图4是本申请示例性实施例提供的一种当第一队列的队列长度发生变化时,基于第一队列的目标长度差值和第一队列的队列长度确定目标概率的方法流程图。FIG. 4 is a flowchart of a method for determining a target probability based on a target length difference of a first queue and a queue length of a first queue when a queue length of a first queue changes, according to an exemplary embodiment of the present application.
图5是本申请示例性实施例提供的一种基于第一差值和第二差值中的至少一个,以及第一队列的队列长度确定目标概率的方法流程图。FIG. 5 is a flowchart of a method for determining a target probability based on at least one of a first difference value and a second difference value, and a queue length of a first queue, according to an exemplary embodiment of the present application.
图6是本申请示例性实施例提供的一种当第一队列的当前队列信用值发生变化时,根据长度差值确定目标概率的方法流程图。FIG. 6 is a flowchart of a method for determining a target probability according to a length difference when a current queue credit value of a first queue changes according to an exemplary embodiment of the present application.
图7A是本申请示例性实施例提供的一种队列调度装置的框图。FIG. 7A is a block diagram of a queue scheduling apparatus provided by an exemplary embodiment of the present application.
图7B是本申请示例性实施例提供的一种第一确定模块的框图。FIG. 7B is a block diagram of a first determining module provided by an exemplary embodiment of the present application.
图7C是本申请示例性实施例提供的一种第一确定子模块的框图。FIG. 7C is a block diagram of a first determining sub-module provided by an exemplary embodiment of the present application.
图7D是本申请示例性实施例提供的另一种第一确定模块的框图。FIG. 7D is a block diagram of another first determining module provided by an exemplary embodiment of the present application.
图7E是本申请示例性实施例提供的一种第二确定子模块的框图。FIG. 7E is a block diagram of a second determining sub-module provided by an exemplary embodiment of the present application.
图7F是本申请示例性实施例提供的另一种队列调度装置的框图。FIG. 7F is a block diagram of another queue scheduling apparatus provided by an exemplary embodiment of the present application.
图8是本申请示例性实施例提供的一种队列调度装置的结构示意图。FIG. 8 is a schematic structural diagram of a queue scheduling apparatus according to an exemplary embodiment of the present application.
具体实施方式Detailed ways
为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施方式作进一步地详细描述。In order to make the objects, technical solutions and advantages of the present application more clear, the embodiments of the present application will be further described in detail below with reference to the accompanying drawings.
请参见图1A,其示出了本申请示例性实施例中提供的一种队列调度方法所涉及的实施环境的示意图。如图1A所示,该实施环境可以包括:通信设备110、第一终端120和第二 终端130。Referring to FIG. 1A, a schematic diagram of an implementation environment involved in a queue scheduling method provided in an exemplary embodiment of the present application is shown. As shown in FIG. 1A, the implementation environment may include a communication device 110, a first terminal 120, and a second terminal 130.
其中,通信设备110可以为路由器或交换机等,第一终端120和第二终端130可以为智能手机、电脑、多媒体播放器、电子阅读器或可穿戴式设备等,通信设备110与第一终端120之间,以及通信设备110与第二终端130之间均可以通过有线网络或无线网络建立连接,在第一终端120与第二终端130通信过程中,通信设备110可以将第一终端120的信息转发至第二终端130。该信息通常以数据包的形式传输。The communication device 110 can be a router or a switch. The first terminal 120 and the second terminal 130 can be a smart phone, a computer, a multimedia player, an e-reader, or a wearable device. The communication device 110 and the first terminal 120 The connection between the communication device 110 and the second terminal 130 can be established through a wired network or a wireless network. During communication between the first terminal 120 and the second terminal 130, the communication device 110 can set the information of the first terminal 120. Forwarded to the second terminal 130. This information is usually transmitted in the form of a data packet.
一般地,该通信设备110包括:队列管理器1101和队列调度器1102,该队列管理器1101和该队列调度器1102之间可以通过有线方式或无线方式连接。Generally, the communication device 110 includes a queue manager 1101 and a queue scheduler 1102, and the queue manager 1101 and the queue scheduler 1102 can be connected by wire or wirelessly.
该队列管理器1101管理多个队列,该多个队列是队列管理器1101根据接收到的数据包的描述信息(例如:输出端口、发送优先级和用户身份标识(Identity,ID)等信息)划分得到的,且每个队列中的多个数据包是按照队列管理器1101接收数据包的时间先后顺序排列的。The queue manager 1101 manages a plurality of queues, and the plurality of queues are divided by the queue manager 1101 according to the description information of the received data packet (for example, output port, transmission priority, and user identity (ID), etc.) The obtained, and the plurality of data packets in each queue are arranged in chronological order according to the queue manager 1101 receiving the data packets.
该队列管理器1101管理多个队列的过程,实际为队列调度过程,该队列调度过程主要包括入队管理过程和出队管理过程,本申请实施例以以下两方面为例进行说明:The queue manager 1101 manages a plurality of queues, which is actually a queue scheduling process. The queue scheduling process mainly includes an enrollment management process and a dequeue management process. The following two aspects are described in the following embodiments:
第一,入队管理过程:队列管理器1101在接收到数据包后,对数据包执行入队操作以将数据包加入队尾。该入队操作可以为:将该数据包的描述符添加至队列对应的链表的末尾。First, the enqueue management process: after receiving the data packet, the queue manager 1101 performs an enqueue operation on the data packet to add the data packet to the end of the queue. The enqueue operation may be: adding the descriptor of the data packet to the end of the linked list corresponding to the queue.
第二,出队管理过程:首先,队列管理器1101根据其管理的队列的队列状态向队列调度器1102发送调度请求;然后,队列调度器1102根据队列管理器1101发送的调度请求以及用户配置的QoS策略产生调度响应,并将该调度响应发送至队列管理器1101;最后,队列管理器1101在接收到队列调度器1102发送的调度响应后,基于该调度响应对其管理的队列中的相应的数据包执行出队操作。该出队操作可以为:将位于队首的数据包的描述符从链表中读出。Second, the dequeue management process: first, the queue manager 1101 sends a scheduling request to the queue scheduler 1102 according to the queue status of the queue it manages; then, the queue scheduler 1102 is configured according to the scheduling request sent by the queue manager 1101 and the user configuration. The QoS policy generates a scheduling response and sends the scheduling response to the queue manager 1101. Finally, after receiving the scheduling response sent by the queue scheduler 1102, the queue manager 1101 responds to the corresponding one of the queues managed by the queue based on the scheduling response. The packet performs a dequeue operation. The dequeue operation may be: reading the descriptor of the packet located at the beginning of the queue from the linked list.
进一步的,请参见图1B,队列管理器1101通常可以包括:入队模块、队列管理模块和出队模块,该三个模块配合实现队列调度过程,该队列调度的具体过程可以参考下述过程:Further, referring to FIG. 1B, the queue manager 1101 may include: an enqueue module, a queue management module, and a dequeue module. The three modules cooperate to implement a queue scheduling process. The specific process of the queue scheduling may refer to the following process:
当队列管理器1101接收到某个数据包后,入队模块可按照该某个数据包的描述信息将该数据包划分至相应的队列(即执行入队操作),然后队列管理模块对其所管理的队列进行入队更新,接着,队列管理器1101可以根据其所管理的队列的队列长度和队列的当前队列信用值进行队列状态更新,并基于更新后的队列状态向队列调度器1102发送调度请求,该调度请求指示需要进行调度的目标队列,以及该目标队列的调度状态,队列调度器1102在接收该调度请求后,可根据该调度请求所指示的调度状态运行预设的调度算法,为该目标队列提供出队信用,该出队信用通常等于调度粒度,该调度粒度为队列调度器对队列进行调度时,为该队列分配的用于数据传输的额定数据量(例如:该调度粒度可以为1千字节(KB))。队列管理模块在接收队列调度器返回的带有出队信用的调度响应后,根据该出队信用更新目标队列的当前队列信用值,并向出队模块发送出队请求,以请求出队模块对数据包执行出队操作,出队模块接收到该出队请求后,可基于该更新后的目标队列的当前队列信用值将位于目标队列的队首的数据包出队,进而实现数据的发送。并且,在数据包出队后,队列管理模块可根据数据包的出队操作对其所管理的队列的进行出队更新。After the queue manager 1101 receives a certain data packet, the enqueue module may divide the data packet into a corresponding queue according to the description information of the certain data packet (ie, perform a queue operation), and then the queue management module The managed queue performs enqueue update. Then, the queue manager 1101 can perform queue status update according to the queue length of the queue it manages and the current queue credit value of the queue, and send a schedule to the queue scheduler 1102 based on the updated queue status. a request, the scheduling request indicates a target queue that needs to be scheduled, and a scheduling state of the target queue. After receiving the scheduling request, the queue scheduler 1102 may run a preset scheduling algorithm according to the scheduling state indicated by the scheduling request, where The target queue provides a dequeue credit, which is usually equal to the scheduling granularity, and the scheduling granularity is the rated data amount allocated for the data transmission by the queue scheduler when scheduling the queue (for example, the scheduling granularity may be It is 1 kilobyte (KB)). After receiving the scheduling response with the dequeue credit returned by the queue scheduler, the queue management module updates the current queue credit value of the target queue according to the dequeue credit, and sends a dequeue request to the dequeue module to request the dequeue module pair. The data packet performs the dequeue operation. After receiving the dequeue request, the dequeue module may dequeue the data packet of the head of the target queue based on the current queue credit value of the updated target queue, thereby implementing data transmission. Moreover, after the data packet is dequeued, the queue management module can dequeue the queue managed by the queue according to the dequeue operation of the data packet.
其中,当前队列信用值为队列当前可用于数据传输的数据量额度。调度状态用于标识 队列调度器对队列进行调度的速率。通常的调度状态有慢调度状态和快调度状态两种状态,其中,慢调度状态指示第一速率,快调度状态指示第二速率,该第一速率小于第二速率,实际实现时,该第一速率小于预设的调度速率阈值,该第二速率大于预设的调度速率阈值,示例地,第一速率可以为:200个时钟周期一次,第二速率可以为:10个时钟周期一次。The current queue credit value is a data amount quota that the queue is currently available for data transmission. The scheduling status is used to identify the rate at which the queue scheduler schedules queues. The normal scheduling state has two states: a slow scheduling state and a fast scheduling state, where the slow scheduling state indicates the first rate, and the fast scheduling state indicates the second rate, where the first rate is smaller than the second rate. The rate is less than the preset scheduling rate threshold, and the second rate is greater than the preset scheduling rate threshold. For example, the first rate may be: 200 clock cycles, and the second rate may be: 10 clock cycles.
图2为本申请示例性实施例提供的一种队列调度方法的流程图,该队列调度方法可以应用于图1A或图1B所示的队列管理器中,该队列调度方法以第一队列为例进行说明,该第一队列为队列管理器所管理的至少一个队列中的任一队列。如图2所示,该队列调度方法可以包括:FIG. 2 is a flowchart of a queue scheduling method according to an exemplary embodiment of the present disclosure. The queue scheduling method may be applied to the queue manager shown in FIG. 1A or FIG. 1B. The queue scheduling method takes the first queue as an example. To illustrate, the first queue is any one of at least one queue managed by the queue manager. As shown in FIG. 2, the queue scheduling method may include:
步骤201、当第一队列的长度差值发生变化时,基于第一队列的长度差值和第一队列的队列长度确定目标概率。Step 201: When the length difference of the first queue changes, the target probability is determined based on the length difference of the first queue and the queue length of the first queue.
其中,长度差值为第一队列的当前队列信用值与第一队列的队列长度的差值。并且,导致第一队列的长度差值发生变化的因素有很多,例如以下两种因素:第一,第一队列的队列长度发生变化,例如,当有新的数据包加入第一队列时,可以根据该数据包的长度和第一队列的历史长度更新第一队列的队列长度,相应的,该第一队列的长度差值会发生变化。第二,第一队列的当前队列信用值发生变化,例如,当队列调度器向第一队列发送调度结果时,队列管理器基于该调度结果更新当前队列信用值后,该第一队列的当前队列信用值会发生变化,相应的,该第一队列的长度差值会发生变化。The length difference is the difference between the current queue credit value of the first queue and the queue length of the first queue. Moreover, there are many factors that cause the difference in the length of the first queue to change, for example, the following two factors: First, the queue length of the first queue changes, for example, when a new data packet is added to the first queue, The queue length of the first queue is updated according to the length of the data packet and the historical length of the first queue. Correspondingly, the length difference of the first queue changes. Second, the current queue credit value of the first queue changes. For example, when the queue scheduler sends the scheduling result to the first queue, the queue manager updates the current queue credit value based on the scheduling result, and the current queue of the first queue. The credit value will change. Correspondingly, the difference in the length of the first queue will change.
因此,可以通过检测第一队列的队列长度和/或当前队列信用值是否发生变化,来确定第一队列的长度差值是否发生变化,例如,在第一队列的队列长度和当前队列信用值中的至少一个发生变化时,确定第一队列的长度差值发生变化。Therefore, it can be determined whether the length difference of the first queue changes by detecting whether the queue length of the first queue and/or the current queue credit value changes, for example, in the queue length of the first queue and the current queue credit value. When at least one of the changes occurs, it is determined that the difference in length of the first queue changes.
可选地,如图3所示,检测第一队列的队列长度是否发生变化的过程,可以包括:Optionally, as shown in FIG. 3, the process of detecting whether the queue length of the first queue changes may include:
步骤a、检测是否有新的数据包加入第一队列。Step a: Detect whether a new data packet is added to the first queue.
该步骤a的实现过程可以包括:检测第一队列对应的链表的长度是否变大,当第一队列对应的链表的长度增加时,可以确定有新的数据包的描述符添加至该链表中,也即是,可以确定有新的数据包加入第一队列,相应的,可以确定第一队列的队列长度发生变化。The implementation process of the step a may include: detecting whether the length of the linked list corresponding to the first queue is increased, and when the length of the linked list corresponding to the first queue is increased, determining that a descriptor of a new data packet is added to the linked list, That is, it can be determined that a new data packet is added to the first queue, and accordingly, it can be determined that the queue length of the first queue changes.
步骤b、当有新的数据包加入第一队列时,确定第一队列的队列长度发生变化。Step b: When a new data packet is added to the first queue, it is determined that the queue length of the first queue changes.
需要说明的是,该检测第一队列的队列长度并确定第一队列的队列长度发生变化的动作可以由图1B中的队列管理模块执行,且在实际实现时,该队列管理模块中可以设置有专用于检测队列长度的模块,或者,队列管理模块也可以在接收入队模块向其发送的入队更新请求后,确定有新的数据包加入第一队列,并确定第一队列的队列长度发生变化,本发明实施例对其不做具体限定。It should be noted that the action of detecting the queue length of the first queue and determining that the queue length of the first queue changes may be performed by the queue management module in FIG. 1B, and in actual implementation, the queue management module may be configured with The module dedicated to detecting the length of the queue, or the queue management module may also determine that a new data packet is added to the first queue after receiving the enqueue update request sent to the enqueue module, and determine that the queue length of the first queue occurs. The embodiment of the present invention does not specifically limit it.
对于上述两种导致第一队列的长度差值发生变化的因素,本申请示例性实施例一一对应地提供以下两种确定目标概率的可实现方式:For the above two factors that cause the difference in the length of the first queue to change, the exemplary embodiments of the present application correspondingly provide the following two ways to determine the target probability:
第一种可实现方式,当第一队列的队列长度发生变化时,基于第一队列的目标长度差值和第一队列的队列长度确定目标概率。In the first implementation manner, when the queue length of the first queue changes, the target probability is determined based on the target length difference of the first queue and the queue length of the first queue.
该目标长度差值可以为第一差值和第二差值中的至少一个,该第一差值为第一队列的当前队列信用值与第一队列的队列长度变化后的差值,该第二差值为第一队列的当前队列 信用值与第一队列的队列长度变化前的差值。The target length difference may be at least one of a first difference value and a second difference value, where the first difference value is a difference between a current queue credit value of the first queue and a queue length of the first queue, where the The difference is the difference between the current queue credit value of the first queue and the queue length of the first queue.
可选地,请参考图4,该第一种可实现方式的实现过程可以包括:Optionally, referring to FIG. 4, the implementation process of the first implementation manner may include:
步骤2011、当第一队列的队列长度发生变化时,获取长度差值变化后的第一差值,和变化前的第二差值。Step 2011: When the queue length of the first queue changes, the first difference after the change of the length difference is obtained, and the second difference before the change.
当有新的数据包加入第一队列时,可以根据该数据包的长度和第一队列的历史长度更新第一队列的当前队列长度,且该当前队列长度可以为该数据包的长度与第一队列的历史长度之和。相应的,第一差值为第一队列的当前队列信用值与第一队列的当前队列长度的差值,第二差值为第一队列的当前队列信用值与第一队列的历史长度的差值。When a new data packet is added to the first queue, the current queue length of the first queue may be updated according to the length of the data packet and the historical length of the first queue, and the current queue length may be the length of the data packet and the first The sum of the historical lengths of the queues. Correspondingly, the first difference is the difference between the current queue credit value of the first queue and the current queue length of the first queue, and the second difference is the difference between the current queue credit value of the first queue and the historical length of the first queue. value.
示例地,假设在某时刻有数据包加入第一队列,该入队的数据包的大小为128字节(Byte,B),在该数据包加入第一队列之前,第一队列的历史队列长度为128B,当前队列信用值为1KB,那么,在该数据包加入之后,第一队列的当前队列长度=128B+128B=256B,第一差值=1KB-256B=768B,第二差值=1KB-128B=896B。For example, suppose that a packet is added to the first queue at a certain time, the size of the enqueue packet is 128 bytes (Byte, B), and the history queue length of the first queue before the packet is added to the first queue. For 128B, the current queue credit value is 1KB. Then, after the data packet is added, the current queue length of the first queue is 128B+128B=256B, the first difference is 1KB-256B=768B, and the second difference is 1KB. -128B=896B.
步骤2012、基于第一差值和第二差值中的至少一个,以及第一队列的队列长度确定目标概率。Step 2012: Determine a target probability based on at least one of the first difference and the second difference, and a queue length of the first queue.
实际应用中,当第一差值和第二差值的大小不同时,根据其确定目标概率的方法不同,如图5所示,根据第一差值和第二差值的大小,该步骤2012的实现过程可以包括以下几种情况:In practical applications, when the sizes of the first difference and the second difference are different, the method for determining the target probability is different. As shown in FIG. 5, according to the size of the first difference and the second difference, the step 2012 The implementation process can include the following situations:
第一种情况:将第一差值分别与参考信用阈值以及调度粒度比较,当第一差值大于参考信用阈值且小于调度粒度时,基于第一差值和调度粒度确定目标概率。In the first case, the first difference is compared with the reference credit threshold and the scheduling granularity respectively. When the first difference is greater than the reference credit threshold and less than the scheduling granularity, the target probability is determined based on the first difference and the scheduling granularity.
可选地,该基于第一差值和调度粒度确定目标概率的实现方法可以包括:将目标差值大于第一随机数的概率确定为目标概率。Optionally, the implementing method for determining the target probability based on the first difference value and the scheduling granularity may include: determining a probability that the target difference value is greater than the first random number as the target probability.
其中,目标差值为调度粒度与第一差值的差值,第一随机数为随机产生且不大于调度粒度的正数,且参考信用阈值小于调度粒度。该参考信用阈值和该调度粒度可以根据实际需要进行设置,例如:该参考信用阈值可以为0,调度粒度可以为1KB。The target difference is a difference between the scheduling granularity and the first difference. The first random number is a positive number that is randomly generated and is not greater than the scheduling granularity, and the reference credit threshold is smaller than the scheduling granularity. The reference credit threshold and the scheduling granularity may be set according to actual needs. For example, the reference credit threshold may be 0, and the scheduling granularity may be 1 KB.
在该第一种情况下,当第一差值大于参考信用阈值且小于调度粒度时,可以确定第一队列还剩余有一定的队列信用,但该剩余的队列信用还不足以用于第一队列中的数据包出队,此时,为了保证第一队列中的数据包的有效出队,第一队列可以请求队列调度器对其进行调度,但是,为了避免队列管理器所管理的多个队列均向队列调度器发送调度请求,此时,可以确定生成调度请求的目标概率,以便于根据该目标概率随机地生成调度请求,以减小队列管理器向队列调度器发送调度请求的频率,减小队列调度器的调度负载,进而保证数据包的有效出队。In the first case, when the first difference is greater than the reference credit threshold and less than the scheduling granularity, it may be determined that the first queue still has a certain queue credit, but the remaining queue credit is not enough for the first queue. The data packet is dequeued. At this time, in order to ensure the effective dequeue of the data packet in the first queue, the first queue can request the queue scheduler to schedule it, but in order to avoid multiple queues managed by the queue manager The scheduling request is sent to the queue scheduler. At this time, the target probability of generating the scheduling request may be determined, so that the scheduling request is randomly generated according to the target probability, so as to reduce the frequency at which the queue manager sends the scheduling request to the queue scheduler, The scheduling load of the small queue scheduler, in order to ensure the effective dequeue of the data packet.
示例地,假设第一差值为768B,参考信用阈值为0,调度粒度为1KB,此时,第一差值大于参考信用阈值且小于调度粒度,则可以基于第一差值和调度粒度确定目标概率,并且,目标差值=1KB-768B=256B,由于第一随机数为随机产生且不大于调度粒度的正数,则可以确定目标差值大于第一随机数的概率=256B/1KB=1/4,即目标概率为1/4。For example, assuming that the first difference is 768B, the reference credit threshold is 0, and the scheduling granularity is 1 KB. At this time, if the first difference is greater than the reference credit threshold and less than the scheduling granularity, the target may be determined based on the first difference and the scheduling granularity. Probability, and the target difference value is 1KB-768B=256B. Since the first random number is randomly generated and is not greater than the positive number of the scheduling granularity, the probability that the target difference value is greater than the first random number can be determined=256B/1KB=1 /4, the target probability is 1/4.
第二种情况:将第二差值分别与参考信用阈值以及调度粒度比较,当第二差值大于参考信用阈值且小于调度粒度时,基于第二差值和目标包长确定目标概率。The second case: comparing the second difference with the reference credit threshold and the scheduling granularity respectively, and when the second difference is greater than the reference credit threshold and less than the scheduling granularity, determining the target probability based on the second difference and the target packet length.
可选地,基于第二差值和目标包长确定目标概率的实现方法可以包括:将目标包长大于第二随机数的概率确定为目标概率。Optionally, the method for determining the target probability based on the second difference and the target packet length may include: determining a probability that the target packet length is greater than the second random number as the target probability.
其中,第二随机数为随机产生且不大于第二差值的正数,目标包长为使第一队列的队列长度发生变化的数据包的长度,也即是,目标包长为新加入第一队列的数据包的长度。The second random number is a positive number that is randomly generated and is not greater than the second difference, and the target packet length is a length of the data packet that changes the queue length of the first queue, that is, the target packet length is newly added. The length of a queue of packets.
当第二差值大于参考信用阈值且小于调度粒度时,可以确定第一队列还剩余有一定的队列信用,但该剩余的队列信用还不足以用于第一队列中的数据包出队,此时,为了保证第一队列中的数据包的有效出队,以及为了避免队列管理器所管理的多个队列均向队列调度器发送调度请求,此时,可以确定生成调度请求的目标概率,以便于根据该目标概率随机地生成调度请求,进而保证数据包的有效出队。When the second difference is greater than the reference credit threshold and less than the scheduling granularity, it may be determined that the first queue still has a certain queue credit, but the remaining queue credit is not enough for the data packet in the first queue to be dequeued. In order to ensure the effective dequeue of the data packets in the first queue, and to avoid sending a scheduling request to the queue scheduler by multiple queues managed by the queue manager, the target probability of generating the scheduling request may be determined at this time, so that The scheduling request is randomly generated according to the target probability, thereby ensuring effective dequeue of the data packet.
示例地,假设新加入第一队列的数据包的长度(即目标包长)为128B,第二差值为896B,参考信用阈值为0,调度粒度为1KB,此时,第二差值大于参考信用阈值且小于调度粒度,则可以基于第二差值和目标包长确定目标概率,并且,由于第二随机数为随机产生且不大于第二差值的正数,则可以确定目标包长大于第二随机数的概率=128B/896B=1/7,即目标概率为1/7。For example, it is assumed that the length of the data packet newly added to the first queue (ie, the target packet length) is 128B, the second difference is 896B, the reference credit threshold is 0, and the scheduling granularity is 1 KB. At this time, the second difference is greater than the reference. The credit threshold is less than the scheduling granularity, and the target probability may be determined based on the second difference and the target packet length, and, since the second random number is randomly generated and not greater than the positive number of the second difference, the target packet length may be determined to be greater than The probability of the second random number = 128B/896B = 1/7, that is, the target probability is 1/7.
并且,当每次第一队列的队列长度发生变化时,均采用该第二种情况所提供的目标概率的确定方法来确定目标概率,可能出现基于多次确定的目标概率均无法生成调度请求的情况,但是,该多次确定的目标概率会按照时间的先后顺序依次递增,最终会出现目标概率为1的情况,此时可以生成调度请求。Moreover, each time the queue length of the first queue changes, the target probability determined by the second case is used to determine the target probability, and the scheduling probability may not be generated based on the target probability determined multiple times. The situation, however, the target probability determined multiple times will be incremented in order of time, and finally the target probability will be 1, and a scheduling request can be generated.
为了描述的简洁,将上述第二种情况所提供的目标概率的确定方法简称为第一确定方法,将采用第一确定方法第i次确定的目标概率称为第i目标概率,该i为正整数。则若基于第1目标概率未生成调度请求,且又有新的数据包加入第一队列时,假设该新加入的数据包的长度为128B,此时,基于上述第一确定方法确定的第二差值=1KB-128B-128B=768B,目标包长大于第二随机数的概率=128B/768B=1/6,得到了第2目标概率为1/6。For the sake of brevity of description, the method for determining the target probability provided by the second case is simply referred to as the first determining method, and the target probability determined by the first determining method is referred to as the i-th target probability, and the i is positive. Integer. If the scheduling request is not generated based on the first target probability, and a new data packet is added to the first queue, the length of the newly added data packet is assumed to be 128B. In this case, the second determined by the first determining method is used. The difference = 1 KB - 128 B - 128 B = 768 B, the probability that the target packet length is greater than the second random number = 128 B / 768 B = 1 / 6, and the second target probability is 1/6.
若基于第2目标概率未生成调度请求,且又有新的数据包加入第一队列时,假设该新加入的数据包的长度为128B,此时,基于上述第一确定方法确定的第二差值=1KB-128B-128B-128B=640B,目标包长大于第二随机数的概率=128B/640B=1/5,即第3目标概率为1/5。If the scheduling request is not generated based on the second target probability, and a new data packet is added to the first queue, it is assumed that the length of the newly added data packet is 128B. At this time, the second difference determined based on the first determining method is determined. The value=1KB-128B-128B-128B=640B, the probability that the target packet length is greater than the second random number=128B/640B=1/5, that is, the third target probability is 1/5.
以此类推可得:第4目标概率为1/4,第5目标概率为1/3,第6目标概率为1/2,第7目标概率为1,则终有一次能够生成调度请求。By analogy, the fourth target probability is 1/4, the fifth target probability is 1/3, the sixth target probability is 1/2, and the seventh target probability is 1, and the scheduling request can be generated once.
由此可见,在该情况下,基于第二差值和目标包长确定目标概率时,确定的目标概率呈现出更均匀的变化,能够进一步地减小队列管理器向队列调度器发送调度请求的频率,进而减小队列调度器的调度负载,能够进一步地降低队列调度器对队列的调度出现调度时延较大的概率。It can be seen that, in this case, when the target probability is determined based on the second difference and the target packet length, the determined target probability exhibits a more uniform change, which can further reduce the queue manager sending the scheduling request to the queue scheduler. The frequency, and thus the scheduling load of the queue scheduler, can further reduce the probability that the queue scheduler has a large scheduling delay for scheduling of the queue.
第三种情况:将第一差值与参考信用阈值以及调度粒度分别比较,将第二差值分别与参考信用阈值以及调度粒度比较,当第一差值与第二差值均满足:大于参考信用阈值且小于调度粒度时,基于第二差值和目标包长确定目标概率。The third case: comparing the first difference with the reference credit threshold and the scheduling granularity respectively, comparing the second difference with the reference credit threshold and the scheduling granularity respectively, when the first difference and the second difference are both satisfied: greater than the reference When the credit threshold is less than the scheduling granularity, the target probability is determined based on the second difference and the target packet length.
可选地,基于第二差值和目标包长确定目标概率的实现方法可以包括:将目标包长与第二差值的比值确定为目标概率。Optionally, the method for determining the target probability based on the second difference and the target packet length may include: determining a ratio of the target packet length to the second difference as the target probability.
示例地,假设新加入第一队列的数据包的长度(即目标包长)为128B,第一差值为768B,第二差值为896B,参考信用阈值为0,调度粒度为1KB,此时,第一差值与第二差值均满足:大于参考信用阈值且小于调度粒度,则可以基于第二差值和目标包长确定目标概率, 并且,目标包长与第二差值的比值=128B/896B=1/7,可以确定目标概率为1/7。For example, assume that the length of the data packet newly added to the first queue (ie, the target packet length) is 128B, the first difference is 768B, the second difference is 896B, the reference credit threshold is 0, and the scheduling granularity is 1 KB. And the first difference value and the second difference value both satisfy: greater than the reference credit threshold and less than the scheduling granularity, the target probability may be determined based on the second difference value and the target packet length, and the ratio of the target packet length to the second difference value is= 128B/896B=1/7, the target probability can be determined to be 1/7.
需要说明的是,在该情况下,基于第二差值和目标包长确定目标概率,相对于基于第一差值和调度粒度确定目标概率的处理方法,能够进一步地减小队列管理器向队列调度器发送调度请求的频率,进而减小队列调度器的调度负载,能够进一步地降低队列调度器对队列的调度出现调度时延较大的概率。It should be noted that, in this case, the target probability is determined based on the second difference and the target packet length, and the queue manager can be further reduced to the queue according to the processing method for determining the target probability based on the first difference and the scheduling granularity. The frequency at which the scheduler sends the scheduling request, thereby reducing the scheduling load of the queue scheduler, can further reduce the probability that the queue scheduler has a large scheduling delay for scheduling the queue.
第四种情况:将第一差值分别与参考信用阈值以及预设的第一信用阈值进行比较,当第一差值大于第一信用阈值且小于参考信用阈值时,确定目标概率为1。In the fourth case, the first difference is compared with the reference credit threshold and the preset first credit threshold, and when the first difference is greater than the first credit threshold and less than the reference credit threshold, the target probability is determined to be 1.
其中,第一信用阈值小于参考信用阈值,该第一信用阈值为对应于队列信用出现严重赤字时的阈值,例如:该第一信用阈值可以为快调度水线对应的信用阈值,当第一差值小于第一信用阈值时,第一队列急需队列调度器对其进行调度,例如:第一队列需要队列调度器以相对较大的速率对其进行调度,以保证第一队列中数据包的正常出队。并且,该第一信用阈值可以根据实际需要进行设置,例如:该第一信用阈值可以为-10K。The first credit threshold is less than a reference credit threshold, and the first credit threshold is a threshold corresponding to a serious deficit in the queue credit. For example, the first credit threshold may be a credit threshold corresponding to the fast dispatch waterline, when the first difference is When the value is less than the first credit threshold, the first queue urgently needs the queue scheduler to schedule it. For example, the first queue needs the queue scheduler to schedule it at a relatively large rate to ensure the normal data packets in the first queue. Departure. Moreover, the first credit threshold may be set according to actual needs, for example, the first credit threshold may be -10K.
当第一差值大于第一信用阈值且小于参考信用阈值时,队列信用虽然出现赤字,但且出现赤字的情况不严重,此时,可以确定第一队列确实需要队列调度器对其进行调度,且为了保证第一队列中数据包的正常出队,该第一队列需要队列调度器以相对较小的速率对其进行调度。因此,当第一差值大于第一信用阈值且小于参考信用阈值时,可以确定目标概率为1。When the first difference is greater than the first credit threshold and less than the reference credit threshold, the queue credit is deficit, but the deficit is not serious. At this time, it can be determined that the first queue does need the queue scheduler to schedule it. And in order to ensure the normal dequeue of the data packets in the first queue, the first queue needs the queue scheduler to schedule it at a relatively small rate. Therefore, when the first difference is greater than the first credit threshold and less than the reference credit threshold, the target probability may be determined to be one.
示例地,假设第一差值为-768B,参考信用阈值为0,第一信用阈值为-10KB,此时,第一差值大于第一信用阈值且小于参考信用阈值,则可以确定目标概率为1,且该第一队列需要队列调度器以相对较小的速率对其进行调度。For example, assuming that the first difference is -768B, the reference credit threshold is 0, and the first credit threshold is -10 KB. At this time, if the first difference is greater than the first credit threshold and less than the reference credit threshold, the target probability may be determined as 1, and the first queue requires the queue scheduler to schedule it at a relatively small rate.
第五种情况:将第一差值与预设的第一信用阈值进行比较,当第一差值小于第一信用阈值时,确定目标概率为1。In the fifth case, the first difference is compared with a preset first credit threshold, and when the first difference is smaller than the first credit threshold, the target probability is determined to be 1.
当第一差值小于第一信用阈值时,第一队列的队列信用出现严重赤字,第一队列急需队列调度器对其进行调度,例如:第一队列需要队列调度器以相对较大的速率对其进行调度,以保证第一队列中数据包的正常出队。When the first difference is less than the first credit threshold, the queue credit of the first queue has a severe deficit, and the first queue urgently needs the queue scheduler to schedule it. For example, the first queue needs the queue scheduler to have a relatively large rate pair. It performs scheduling to ensure the normal dequeue of data packets in the first queue.
需要说明的是,当将第一差值和第二差值中的至少一个按照上述五种情况进行比较时,当第一差值和第二差值中的至少一个均不满足上述五种情况中的比较结果时,可以确定无需对第一队列进行调度。It should be noted that when at least one of the first difference value and the second difference value is compared according to the above five cases, when at least one of the first difference value and the second difference value does not satisfy the above five cases In the comparison result, it can be determined that the first queue does not need to be scheduled.
第二种可实现方式,当第一队列的当前队列信用值发生变化时,根据长度差值确定目标概率。In a second implementation manner, when the current queue credit value of the first queue changes, the target probability is determined according to the length difference.
可选地,请参考图6,该第二种可实现方式的实现过程可以包括以下几种情况:Optionally, referring to FIG. 6, the implementation process of the second implementation manner may include the following situations:
第一种情况:将长度差值分别与参考信用阈值以及调度粒度比较,当长度差值大于参考信用阈值且小于调度粒度时,基于长度差值和调度粒度确定目标概率。In the first case, the length difference is compared with the reference credit threshold and the scheduling granularity respectively. When the length difference is greater than the reference credit threshold and less than the scheduling granularity, the target probability is determined based on the length difference and the scheduling granularity.
可选地,基于长度差值和调度粒度确定目标概率的实现方法可以包括:将长度差值小于第一随机数的概率确定为目标概率。Optionally, the method for determining the target probability based on the length difference and the scheduling granularity may include: determining a probability that the length difference is smaller than the first random number as the target probability.
其中,该长度差值为长度差值变化后第一队列的当前队列信用值与第一队列的队列长度的差值。The length difference is the difference between the current queue credit value of the first queue and the queue length of the first queue after the length difference is changed.
在该第一种情况下,当长度差值大于参考信用阈值且小于调度粒度时,可以确定第一队列还剩余有一定的队列信用,但该剩余的队列信用还不足以用于第一队列中的数据包出 队,此时,可以确定生成调度请求的目标概率,以随机地生成调度请求,减小队列管理器向队列调度器发送调度请求的频率,减小队列调度器的调度负载,进而保证数据包的有效出队。In the first case, when the length difference is greater than the reference credit threshold and less than the scheduling granularity, it may be determined that the first queue still has a certain queue credit, but the remaining queue credit is not enough for the first queue. The data packet is dequeued. At this time, the target probability of generating the scheduling request may be determined to randomly generate the scheduling request, reduce the frequency at which the queue manager sends the scheduling request to the queue scheduler, and reduce the scheduling load of the queue scheduler, and further Ensure the effective dequeue of the data packet.
示例地,假设长度差值为768B,参考信用阈值为0,调度粒度为1KB,此时,长度差值大于参考信用阈值且小于调度粒度,则可以基于长度差值和调度粒度确定目标概率,并且,由于第一随机数为随机产生且不大于调度粒度的正数,则可以确定长度差值小于第一随机数的概率=768B/1KB=1/4,即目标概率为3/4。For example, assuming that the length difference is 768B, the reference credit threshold is 0, and the scheduling granularity is 1 KB. At this time, if the length difference is greater than the reference credit threshold and less than the scheduling granularity, the target probability may be determined based on the length difference and the scheduling granularity, and Since the first random number is randomly generated and is not greater than the positive number of the scheduling granularity, it may be determined that the probability that the length difference is smaller than the first random number=768B/1KB=1/4, that is, the target probability is 3/4.
第二种情况:将长度差值分别与参考信用阈值以及预设的第一信用阈值进行比较,当长度差值大于第一信用阈值且小于参考信用阈值时,确定目标概率为1。In the second case, the length difference is respectively compared with the reference credit threshold and the preset first credit threshold. When the length difference is greater than the first credit threshold and less than the reference credit threshold, the target probability is determined to be 1.
在该第二种情况中,第一队列的队列信用虽然出现赤字,但且出现赤字的情况不严重,此时,该第二种情况的实现过程请相应参考根据第一差值和第二差值的大小确定目标概率的第四种情况的实现过程,此处不再赘述。In the second case, although the queue credit of the first queue has a deficit, but the deficit is not serious, at this time, the implementation process of the second case should be referred to according to the first difference and the second difference. The size of the value determines the implementation of the fourth case of the target probability, and will not be described here.
第三种情况:将长度差值与预设的第一信用阈值进行比较,当长度差值小于第一信用阈值时,确定目标概率为1。In the third case, the length difference is compared with a preset first credit threshold, and when the length difference is less than the first credit threshold, the target probability is determined to be 1.
在该第三种情况中,第一队列的队列信用出现严重赤字,第一队列急需队列调度器对其进行调度,此时,该第三种情况的实现过程请相应参考根据第一差值和第二差值的大小确定目标概率的第五种情况的实现过程,此处不再赘述。In the third case, the queue courier of the first queue has a severe deficit, and the first queue urgently needs the queue scheduler to schedule it. At this time, the implementation process of the third case should be referred to according to the first difference sum. The size of the second difference determines the implementation process of the fifth case of the target probability, and details are not described herein again.
需要说明的是,当长度差值均不满足上述五种情况中的比较结果时,可以确定无需对第一队列进行调度。It should be noted that when the length difference does not satisfy the comparison result in the above five cases, it may be determined that the first queue does not need to be scheduled.
实际应用中,在上述第一种可实现方式的五种情况中,以及在第二种可实现方式的三种情况中,将长度差值与各个范围进行比较的过程可以并行执行,也可以串行执行,本申请示例性实施例对其不做具体限定。In practical applications, in the five cases of the first implementable manner described above, and in the three cases of the second implementable manner, the process of comparing the length difference with each range may be performed in parallel, or may be performed in series. The execution of the line is not specifically limited in the exemplary embodiment of the present application.
示例地,在第一种可实现方式中,当将长度差值与各个范围进行比较的过程为串行执行时,可以先将第一差值与预设的第一信用阈值进行比较,当第一差值不小于第一信用阈值时,将第一差值与参考信用阈值进行比较,当第一差值不满足大于第一信用阈值且小于参考信用阈值时,将第二差值与调度粒度比较,当第二插值差值不满足大于参考信用阈值且小于调度粒度时,再将第一差值与调度粒度比较,然后再根据比较结果确定目标概率。For example, in the first implementation manner, when the process of comparing the length difference with each range is performed serially, the first difference may be compared with a preset first credit threshold. When the difference is not less than the first credit threshold, the first difference is compared with the reference credit threshold, and when the first difference does not satisfy the first credit threshold and is less than the reference credit threshold, the second difference and the scheduling granularity are used. For comparison, when the second interpolation difference does not satisfy the reference credit threshold and is smaller than the scheduling granularity, the first difference is compared with the scheduling granularity, and then the target probability is determined according to the comparison result.
在第二种可实现方式中,当将长度差值与各个范围进行比较的过程为串行执行时,可以先将长度差值与预设的第一信用阈值进行比较,当长度差值不小于第一信用阈值时,将长度差值与参考信用阈值进行比较,当长度差值不满足大于第一信用阈值且小于参考信用阈值时,将长度差值与调度粒度比较,然后再根据比较结果确定目标概率。In the second implementation manner, when the process of comparing the length difference with each range is serial execution, the length difference may be first compared with a preset first credit threshold, when the length difference is not less than When the first credit threshold is used, the length difference is compared with the reference credit threshold. When the length difference does not satisfy the first credit threshold and is less than the reference credit threshold, the length difference is compared with the scheduling granularity, and then determined according to the comparison result. Target probability.
并且,由于第一信用阈值为对应于队列信用出现严重赤字时的阈值,先将第一差值(或长度差值)与预设的第一信用阈值进行比较,当第一差值(或长度差值)小于第一信用阈值时,可以及时地根据该严重赤字的情况执行生成调度请求的操作,进而及时地缓解队列信用出现严重赤字的情况,以保证第一队列中数据包的正常出队。And, since the first credit threshold is a threshold corresponding to a serious deficit in the queue credit, the first difference (or the length difference) is first compared with a preset first credit threshold, when the first difference (or length) When the difference is less than the first credit threshold, the operation of generating the scheduling request may be performed according to the situation of the severe deficit in time, thereby timely alleviating the situation that the queue credit has a serious deficit, so as to ensure the normal dequeue of the data packet in the first queue. .
步骤202、基于目标概率,进行调度请求的随机生成,使得调度请求生成的可能性与未生成的可能性的比例为目标概率。Step 202: Perform random generation of the scheduling request based on the target probability, such that the ratio of the probability of generating the scheduling request to the probability of not being generated is the target probability.
其中,调度请求用于指示对第一队列进行调度的调度状态。The scheduling request is used to indicate a scheduling state for scheduling the first queue.
相应的,基于上述第一种可实现方式和第二种可实现方式的不同情况,基于目标概率, 进行调度请求的随机生成的可实现方式可以包括:当基于目标概率,选择生成调度请求时,基于选择结果生成调度请求。其中,该调度请求包括第一状态标识或第二状态标识,该第一状态标识指示队列调度器进行队列调度时的第一速率,该第二状态标识指示队列调度器进行队列调度时的第二速率。该第一速率小于预设的调度速率阈值,该第二速率大于预设的调度速率阈值。Correspondingly, based on the different situations of the foregoing first implementable manner and the second implementable manner, the implementable manner of performing the random generation of the scheduling request based on the target probability may include: when selecting the generating the scheduling request based on the target probability, A scheduling request is generated based on the selection result. The scheduling request includes a first status identifier or a second status identifier, where the first status identifier indicates a first rate when the queue scheduler performs queue scheduling, and the second status identifier indicates a second time when the queue scheduler performs queue scheduling. rate. The first rate is less than a preset scheduling rate threshold, and the second rate is greater than a preset scheduling rate threshold.
并且,请参考图5和图6,当目标概率为基于上述第一种可实现方式中的第一至四种情况和第二种可实现方式中的第一种和第二种情况时,该第一队列需要队列调度器以相对较小的速率对其进行调度,此时,生成的调度请求可以包括第一状态标识;当目标概率为基于上述第一种可实现方式中的第五种情况,和第二种可实现方式中的第三种情况时,第一队列需要队列调度器以相对较大的速率对其进行调度,此时,生成的调度请求可以包括第二状态标识。And, referring to FIG. 5 and FIG. 6, when the target probability is based on the first one and the second case in the first to fourth cases and the second achievable manner in the first implementable manner, The first queue needs the queue scheduler to schedule it at a relatively small rate. At this time, the generated scheduling request may include the first state identifier; when the target probability is based on the fifth case of the first implementable manner described above In the third case of the second implementation, the first queue needs the queue scheduler to schedule it at a relatively large rate. In this case, the generated scheduling request may include the second status identifier.
示例地,假设步骤201中基于第一差值和调度粒度(即第一种可实现方式的第一种情况)确定的目标概率为1/4,此时,在选择是否生成调度请求时,调度请求生成的可能性与未生成的可能性的比例为1/4,并且,当选择生成调度请求时,可以生成调度请求,并且生成的调度请求中包括第一状态标识,以请求队列调度器以第一速率对第一队列进行调度。For example, it is assumed that the target probability determined in step 201 based on the first difference value and the scheduling granularity (ie, the first case of the first implementable mode) is 1/4, and at this time, when selecting whether to generate a scheduling request, scheduling The ratio of the probability of request generation to the probability of not being generated is 1/4, and when the scheduling request is generated, a scheduling request may be generated, and the generated scheduling request includes a first state identifier to request the queue scheduler to The first rate schedules the first queue.
需要说明的是,当基于目标概率进行调度请求的随机生成时,由于调度请求生成的可能性与未生成的可能性的比例为目标概率,降低了队列管理器基于其所管理的多个队列生成调度请求的数量,使得队列管理器所管理的多个队列生成调度请求的数量尽量呈现出均匀分布的状态,相应的减小了队列管理器向队列调度器发送调度请求的频率,能够减小队列调度器的调度负载,使得调度状态的更新速率不超过队列调度器的调度能力,进而降低队列调度器对队列的调度出现调度时延较大的概率。It should be noted that when the random generation of the scheduling request is performed based on the target probability, since the ratio of the possibility of generating the scheduling request to the probability of not generating is the target probability, the queue manager is reduced based on the plurality of queues managed by the queue manager. The number of scheduling requests is such that the number of scheduling requests generated by the queue manager is as uniformly distributed as possible, which reduces the frequency at which the queue manager sends scheduling requests to the queue scheduler, and can reduce the queue. The scheduling load of the scheduler is such that the update rate of the scheduling state does not exceed the scheduling capability of the queue scheduler, thereby reducing the probability that the queue scheduler has a large scheduling delay for scheduling of the queue.
并且,由于队列管理器所管理的多个队列生成调度请求的数量能够尽量呈现出均匀分布的状态,使得所有队列的当前队列信用均匀分布在调度粒度对应的预设范围内,所有队列的队列信用的总和趋近于队列调度器能够调度的总调度带宽,使其实际的总调度带宽更准确,能够解决发送调度请求的频率较高时所引起的调度带宽过多和队列间调度带宽比例不准确等问题。In addition, the number of scheduling requests generated by the queue manager can be uniformly distributed as shown in the queue manager, so that the current queue credits of all the queues are evenly distributed within the preset range corresponding to the scheduling granularity, and the queue credits of all the queues are The sum of the sums is close to the total scheduling bandwidth that the queue scheduler can schedule, so that the actual total scheduling bandwidth is more accurate, and the scheduling bandwidth caused by the high frequency of sending scheduling requests and the scheduling bandwidth ratio between the queues are inaccurate. And other issues.
步骤203、当生成了调度请求,将调度请求发送至队列调度器。Step 203: When a scheduling request is generated, the scheduling request is sent to the queue scheduler.
可选地,将调度请求发送至队列调度器,包括:判断调度请求所指示的调度状态与第一队列对应的当前调度状态是否相同,当调度请求所指示的调度状态与第一队列对应的当前调度状态不同时,将调度请求发送至队列调度器。Optionally, the sending the scheduling request to the queue scheduler includes: determining whether the scheduling status indicated by the scheduling request is the same as the current scheduling status corresponding to the first queue, and the current status corresponding to the first queue when the scheduling status indicated by the scheduling request is When the scheduling status is different, the scheduling request is sent to the queue scheduler.
当生成了调度请求后,队列管理器可以将第一队列对应的当前调度状态与调度请求所指示的调度状态进行比较,当调度请求所指示的调度状态与第一队列对应的当前调度状态相同时,队列调度器可以继续按照当前调度状态对第一队列进行调度,此时,无需向队列调度器发送调度请求,这样可以节约系统资源;当调度请求所指示的调度状态与第一队列对应的当前调度状态不同时,将调度请求发送至队列调度器,以更新队列调度器对第一队列的调度状态。After the scheduling request is generated, the queue manager may compare the current scheduling state corresponding to the first queue with the scheduling state indicated by the scheduling request, when the scheduling state indicated by the scheduling request is the same as the current scheduling state corresponding to the first queue. The queue scheduler can continue to schedule the first queue according to the current scheduling state. At this time, it is not necessary to send a scheduling request to the queue scheduler, which can save system resources; when the scheduling status indicated by the scheduling request is related to the current queue When the scheduling status is different, the scheduling request is sent to the queue scheduler to update the scheduling state of the queue queue to the first queue.
步骤204、接收队列调度器发送的调度响应。Step 204: Receive a scheduling response sent by a queue scheduler.
其中,调度响应包括调度粒度。The scheduling response includes scheduling granularity.
队列调度器接收队列管理器发送的调度请求后,可以根据调度请求所指示的调度状态 运行调度算法,为第一队列分配用于数据传输的额定数据量,并向队列管理器发送携带有该额定数据量的调度响应,以便于队列管理器对第一队列中的数据包执行出队操作。After receiving the scheduling request sent by the queue manager, the queue scheduler may run a scheduling algorithm according to the scheduling state indicated by the scheduling request, allocate a rated data amount for data transmission to the first queue, and send the same to the queue manager. A scheduling response of the amount of data so that the queue manager performs a dequeue operation on the packets in the first queue.
步骤205、基于调度响应更新第一队列的当前队列信用值。Step 205: Update a current queue credit value of the first queue based on the scheduling response.
在队列管理器接收队列调度器发送的调度响应后,可以基于调度响应中携带的额定数据量更新第一队列的当前队列信用值,其更新方法可以包括:将生成调度请求时的当前队列信用值与额定数据量之和确定为更新后的当前队列信用值。After the queue manager receives the scheduling response sent by the queue scheduler, the current queue credit value of the first queue may be updated based on the rated data amount carried in the scheduling response, and the updating method may include: the current queue credit value when the scheduling request is generated. The sum of the rated data amount is determined as the updated current queue credit value.
需要说明的是,在更新第一队列的当前队列信用值后,由于第一队列的当前队列信用值发生了变化,该第一队列的长度差值也会相应发生变化,此时,可以基于该变化后的长度差值和第一队列的队列长度再次确定目标概率,以便于更准确地确定当前的调度状态,使队列调度器更有效地对第一队列进行调度,进而实现资源的有效利用。It should be noted that, after updating the current queue credit value of the first queue, since the current queue credit value of the first queue changes, the length difference of the first queue also changes accordingly. The changed length difference and the queue length of the first queue determine the target probability again, so as to more accurately determine the current scheduling state, so that the queue scheduler can more effectively schedule the first queue, thereby realizing efficient use of resources.
步骤206、基于更新后的当前队列信用值,对第一队列中相应长度的数据包执行出队操作。Step 206: Perform a dequeuing operation on the data packet of the corresponding length in the first queue based on the updated current queue credit value.
在更新当前队列信用值后,若当前队列信用值满足第一队列中数据包的出队数据量,即可对第一队列中相应长度的数据包执行出队操作,以实现数据的传输。并且,由于在出队操作中,出队的数据包会消耗相同数据量的队列信用,因此,在执行操作出队操作之后,第一队列的长度差值不会发生变化,此时无需更新调度状态。After updating the current queue credit value, if the current queue credit value satisfies the dequeue data volume of the data packet in the first queue, the dequeuing operation may be performed on the data packet of the corresponding length in the first queue to implement data transmission. Moreover, since the dequeued data packet consumes the queue credit of the same data amount in the dequeuing operation, the length difference of the first queue does not change after the operation dequeuing operation is performed, and there is no need to update the scheduling at this time. status.
可选地,上述步骤201中基于第一队列的长度差值和第一队列的队列长度确定目标概率的动作动作,以及步骤202至步骤205的动作均可由图1B中的队列管理模块执行,上述步骤206的动作均可由图1B中的出队模块执行。Optionally, in the foregoing step 201, an action action of determining a target probability based on a length difference of the first queue and a queue length of the first queue, and an action of step 202 to step 205 may be performed by the queue management module in FIG. 1B, where The actions of step 206 can all be performed by the dequeue module of Figure 1B.
需要说明的是,在实际实现中上述过程可以通过简单的代码实现,例如,其可以采用if语句编写的代码实现,此处对其不做具体限定。It should be noted that, in the actual implementation, the foregoing process may be implemented by simple code, for example, it may be implemented by using an code written by an if statement, which is not specifically limited herein.
综上所述,本申请示例性实施例提供的队列调度方法,通过在第一队列的长度差值发生变化时确定目标概率,基于目标概率,进行调度请求的随机生成,使得调度请求生成的可能性与未生成的可能性的比例为目标概率,且当生成了调度请求时,将调度请求发送至队列调度器,相对于相关技术,降低了队列管理器基于其所管理的多个队列生成调度请求的数量,使得队列管理器所管理的多个队列生成调度请求的数量尽量呈现出均匀分布的状态,能够有效地减小队列管理器向队列调度器发送调度请求的频率,进而减小队列调度器的调度负载,降低队列调度器对队列的调度出现调度时延较大的概率。In summary, the queue scheduling method provided by the exemplary embodiment of the present application determines the target probability by changing the length difference of the first queue, and performs random generation of the scheduling request based on the target probability, so that the scheduling request may be generated. The ratio of the likelihood to the ungenerated probability is the target probability, and when the scheduling request is generated, the scheduling request is sent to the queue scheduler, and the queue manager is configured to generate a schedule based on the plurality of queues managed by the queue manager relative to the related art. The number of requests is such that the number of scheduling requests generated by the queue manager is uniformly distributed as shown in the queue manager, which can effectively reduce the frequency at which the queue manager sends scheduling requests to the queue scheduler, thereby reducing queue scheduling. The scheduling load of the device reduces the probability that the queue scheduler has a large scheduling delay for the scheduling of the queue.
需要说明的是,本发明实施例提供的队列调度方法步骤的先后顺序可以进行适当调整,步骤也可以根据情况进行相应增减,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化的方法,都应涵盖在本发明的保护范围之内,因此不再赘述。It should be noted that the sequence of the steps of the queue scheduling method provided by the embodiment of the present invention may be appropriately adjusted, and the steps may also be correspondingly increased or decreased according to the situation. Anyone skilled in the art may be within the technical scope disclosed by the present invention. Methods that can be easily conceived of variations are encompassed within the scope of the present invention and therefore will not be described again.
下述为本申请的装置实施例,可以用于执行本申请的方法实施例。对于本申请装置实施例中未披露的细节,请参照本申请方法实施例。The following is an apparatus embodiment of the present application, which can be used to implement the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.
请参考图7A,其示出了本申请示例性实施例提供的一种队列调度装置700的框图,如图7A所示,装置700可以包括:Please refer to FIG. 7A, which is a block diagram of a queue scheduling apparatus 700 provided by an exemplary embodiment of the present application. As shown in FIG. 7A, the apparatus 700 may include:
第一确定模块701,用于当第一队列的长度差值发生变化时,基于第一队列的长度差值和第一队列的队列长度确定目标概率。The first determining module 701 is configured to determine a target probability based on a length difference of the first queue and a queue length of the first queue when the length difference of the first queue changes.
生成模块702,用于基于目标概率,进行调度请求的随机生成,使得调度请求生成的可能性与未生成的可能性的比例为目标概率,调度请求用于指示对第一队列进行调度的调度状态。The generating module 702 is configured to perform random generation of the scheduling request based on the target probability, such that the ratio of the probability of generating the scheduling request to the probability of not being generated is a target probability, and the scheduling request is used to indicate a scheduling state for scheduling the first queue. .
发送模块703,用于当生成了调度请求,将调度请求发送至队列调度器。The sending module 703 is configured to send a scheduling request to the queue scheduler when the scheduling request is generated.
其中,第一队列为队列管理器所管理的至少一个队列中的任一队列,长度差值为第一队列的当前队列信用值与第一队列的队列长度的差值,当前队列信用值为第一队列当前可用于数据传输的数据量额度。The first queue is any one of the at least one queue managed by the queue manager, and the length difference is the difference between the current queue credit value of the first queue and the queue length of the first queue, and the current queue credit value is The amount of data that a queue currently has for data transmission.
综上所述,本申请示例性实施例提供的队列调度装置,通过第一确定模块在第一队列的长度差值发生变化时确定目标概率,生成模块基于目标概率,进行调度请求的随机生成,使得调度请求生成的可能性与未生成的可能性的比例为目标概率,发送模块当生成了调度请求时,将调度请求发送至队列调度器,相对于相关技术,降低了队列管理器基于其所管理的多个队列生成调度请求的数量,使得队列管理器所管理的多个队列生成调度请求的数量尽量呈现出均匀分布的状态,能够有效地减小队列管理器向队列调度器发送调度请求的频率,进而减小队列调度器的调度负载,降低队列调度器对队列的调度出现调度时延较大的概率。In summary, the queue scheduling apparatus provided by the exemplary embodiment of the present application determines the target probability when the length difference of the first queue changes by the first determining module, and the generating module performs random generation of the scheduling request based on the target probability. The ratio of the possibility of generating the scheduling request to the probability of not being generated is the target probability. When the sending module generates the scheduling request, the sending module sends the scheduling request to the queue scheduler, which reduces the queue manager based on the related technology. The number of scheduling requests generated by the plurality of queues is such that the number of scheduling requests generated by the queue manager is uniformly distributed, which can effectively reduce the queue manager sending scheduling requests to the queue scheduler. The frequency, in turn, reduces the scheduling load of the queue scheduler, and reduces the probability that the queue scheduler has a large scheduling delay for scheduling of the queue.
如图7B所示,第一确定模块701,可以包括:As shown in FIG. 7B, the first determining module 701 may include:
获取子模块7011,用于当第一队列的队列长度发生变化时,获取长度差值变化后的第一差值,和变化前的第二差值。The obtaining sub-module 7011 is configured to: when the queue length of the first queue changes, obtain a first difference after the length difference is changed, and a second difference before the change.
第一确定子模块7012,用于基于第一差值和第二差值中的至少一个,以及第一队列的队列长度确定目标概率。The first determining sub-module 7012 is configured to determine a target probability based on at least one of the first difference value and the second difference value, and a queue length of the first queue.
在一种可实现方式中,如图7C所示,第一确定子模块7012,可以包括:In an implementation manner, as shown in FIG. 7C, the first determining submodule 7012 may include:
第一比较单元7012a,用于将第一差值分别与参考信用阈值以及调度粒度比较,参考信用阈值小于调度粒度,调度粒度为队列调度器对第一队列进行调度时,为第一队列分配的用于数据传输的额定数据量。The first comparison unit 7012a is configured to compare the first difference value with the reference credit threshold and the scheduling granularity respectively, where the reference credit threshold is smaller than the scheduling granularity, and the scheduling granularity is allocated by the queue scheduler to the first queue when scheduling the first queue. The nominal amount of data used for data transmission.
第一确定单元7012b,用于当第一差值大于参考信用阈值且小于调度粒度时,基于第一差值和调度粒度确定目标概率。The first determining unit 7012b is configured to determine a target probability based on the first difference and the scheduling granularity when the first difference is greater than a reference credit threshold and less than a scheduling granularity.
可选地,第一确定单元7012b,用于:Optionally, the first determining unit 7012b is configured to:
将目标差值大于第一随机数的概率确定为目标概率,目标差值为调度粒度与第一差值的差值,第一随机数为随机产生且不大于调度粒度的正数。The probability that the target difference is greater than the first random number is determined as the target probability, and the target difference is the difference between the scheduling granularity and the first difference, and the first random number is a positive number that is randomly generated and not greater than the scheduling granularity.
在另一种可实现方式中,如图7C所示,第一确定子模块7012,可以包括:In another implementation manner, as shown in FIG. 7C, the first determining submodule 7012 may include:
第一比较单元7012a,用于将第二差值分别与参考信用阈值以及调度粒度比较,参考信用阈值小于调度粒度,调度粒度为队列调度器对第一队列进行调度时,为第一队列分配的用于数据传输的额定数据量。The first comparing unit 7012a is configured to compare the second difference with the reference credit threshold and the scheduling granularity respectively, where the reference credit threshold is smaller than the scheduling granularity, and the scheduling granularity is allocated by the queue scheduler to the first queue when scheduling the first queue. The nominal amount of data used for data transmission.
第一确定单元7012b,用于当第二差值大于参考信用阈值且小于调度粒度时,基于第二差值和目标包长确定目标概率,目标包长为使第一队列的队列长度发生变化的数据包的长度。The first determining unit 7012b is configured to determine a target probability based on the second difference and the target packet length when the second difference is greater than the reference credit threshold and less than the scheduling granularity, and the target packet length is to change the queue length of the first queue. The length of the packet.
可选地,第一确定单元7012b,用于:Optionally, the first determining unit 7012b is configured to:
将目标包长大于第二随机数的概率确定为目标概率,第二随机数为随机产生且不大于第二差值的正数。The probability that the target packet length is greater than the second random number is determined as the target probability, and the second random number is a positive number that is randomly generated and not greater than the second difference.
在又一种可实现方式中,如图7C所示,第一确定子模块7012,可以包括:In another implementation manner, as shown in FIG. 7C, the first determining sub-module 7012 may include:
第一比较单元7012a,用于将第一差值与参考信用阈值以及调度粒度分别比较,参考信用阈值小于调度粒度,调度粒度为队列调度器对第一队列进行调度时,为第一队列分配的用于数据传输的额定数据量。The first comparison unit 7012a is configured to compare the first difference value with the reference credit threshold and the scheduling granularity respectively, where the reference credit threshold is smaller than the scheduling granularity, and the scheduling granularity is allocated by the queue scheduler to the first queue when scheduling the first queue. The nominal amount of data used for data transmission.
第一比较单元7012a,用于将第二差值分别与参考信用阈值以及调度粒度比较。The first comparing unit 7012a is configured to compare the second difference value with the reference credit threshold and the scheduling granularity, respectively.
第一确定单元7012b,用于当第一差值与第二差值均满足:大于参考信用阈值且小于调度粒度时,基于第二差值和目标包长确定目标概率,目标包长为使第一队列的队列长度发生变化的数据包的长度。The first determining unit 7012b is configured to: when the first difference value and the second difference value are both greater than the reference credit threshold and less than the scheduling granularity, determine the target probability based on the second difference and the target packet length, and the target packet length is The length of a packet whose queue length changes.
可选地,第一确定单元7012b,用于:Optionally, the first determining unit 7012b is configured to:
将目标包长与第二差值的比值确定为目标概率。The ratio of the target packet length to the second difference is determined as the target probability.
在再一种可实现方式中,如图7C所示,第一确定子模块7012,可以包括:In a further implementation manner, as shown in FIG. 7C, the first determining sub-module 7012 may include:
第一比较单元7012a,用于将第一差值分别与参考信用阈值以及预设的第一信用阈值进行比较,第一信用阈值小于参考信用阈值。The first comparing unit 7012a is configured to compare the first difference value with the reference credit threshold and the preset first credit threshold, where the first credit threshold is smaller than the reference credit threshold.
第一确定单元7012b,用于当第一差值大于第一信用阈值且小于参考信用阈值时,确定目标概率为1。The first determining unit 7012b is configured to determine that the target probability is 1 when the first difference is greater than the first credit threshold and less than the reference credit threshold.
在还一种可实现方式中,如图7C所示,第一确定子模块7012,可以包括:In a further implementation manner, as shown in FIG. 7C, the first determining submodule 7012 may include:
第一比较单元7012a,用于将第一差值与预设的第一信用阈值进行比较。The first comparing unit 7012a is configured to compare the first difference with a preset first credit threshold.
第一确定单元7012b,用于当第一差值小于第一信用阈值时,确定目标概率为1。The first determining unit 7012b is configured to determine that the target probability is 1 when the first difference is less than the first credit threshold.
如图7D所示,第一确定模块701,可以包括:As shown in FIG. 7D, the first determining module 701 may include:
第二确定子模块7013,用于当第一队列的当前队列信用值发生变化时,根据长度差值确定目标概率。The second determining sub-module 7013 is configured to determine a target probability according to the length difference when the current queue credit value of the first queue changes.
如图7E所示,第二确定子模块7013,可以包括:As shown in FIG. 7E, the second determining submodule 7013 may include:
第二比较单元7013a,用于将长度差值分别与参考信用阈值以及调度粒度比较,参考信用阈值小于调度粒度,调度粒度为队列调度器对第一队列进行调度时,为第一队列分配的用于数据传输的额定数据量。The second comparison unit 7013a is configured to compare the length difference value with the reference credit threshold and the scheduling granularity respectively, and the reference credit threshold is smaller than the scheduling granularity, and the scheduling granularity is used by the queue scheduler to allocate the first queue. The amount of data that is rated for data transmission.
第二确定单元7013b,用于当长度差值大于参考信用阈值且小于调度粒度时,基于长度差值和调度粒度确定目标概率。The second determining unit 7013b is configured to determine the target probability based on the length difference and the scheduling granularity when the length difference is greater than the reference credit threshold and less than the scheduling granularity.
可选地,第二确定单元7013b,用于:Optionally, the second determining unit 7013b is configured to:
将长度差值小于第一随机数的概率确定为目标概率,第一随机数为随机产生且不大于调度粒度的正数。The probability that the length difference is smaller than the first random number is determined as the target probability, and the first random number is a positive number that is randomly generated and not larger than the scheduling granularity.
如图7E所示,第二确定子模块7013,可以包括:As shown in FIG. 7E, the second determining submodule 7013 may include:
第二比较单元7013a,用于将长度差值分别与参考信用阈值以及预设的第一信用阈值进行比较,第一信用阈值小于参考信用阈值。The second comparing unit 7013a is configured to compare the length difference value with the reference credit threshold and the preset first credit threshold, where the first credit threshold is smaller than the reference credit threshold.
第二确定单元7013b,用于当长度差值大于第一信用阈值且小于参考信用阈值时,确定目标概率为1。The second determining unit 7013b is configured to determine that the target probability is 1 when the length difference is greater than the first credit threshold and less than the reference credit threshold.
如图7E所示,第二确定子模块7013,可以包括:As shown in FIG. 7E, the second determining submodule 7013 may include:
第二比较单元7013a,用于将长度差值与预设的第一信用阈值进行比较。The second comparing unit 7013a is configured to compare the length difference with a preset first credit threshold.
第二确定单元7013b,用于当长度差值小于第一信用阈值时,确定目标概率为1。The second determining unit 7013b is configured to determine that the target probability is 1 when the length difference is less than the first credit threshold.
可选地,生成模块702,用于:Optionally, the generating module 702 is configured to:
当基于目标概率,选择生成调度请求时,基于选择结果生成调度请求,调度请求可以包括第一状态标识,第一状态标识指示队列调度器进行队列调度时的第一速率,第一速率小于预设的调度速率阈值。When the scheduling request is generated based on the target probability, the scheduling request is generated according to the selection result, and the scheduling request may include a first state identifier, where the first state identifier indicates a first rate when the queue scheduler performs queue scheduling, and the first rate is less than a preset. The scheduling rate threshold.
可选地,生成模块702,用于:Optionally, the generating module 702 is configured to:
当基于目标概率,选择生成调度请求时,基于选择结果生成调度请求,调度请求可以包括第二状态标识,第二状态标识指示队列调度器进行队列调度时的第二速率,第二速率大于预设的调度速率阈值。When the scheduling request is generated based on the target probability, the scheduling request is generated based on the selection result, the scheduling request may include a second status identifier, where the second status identifier indicates a second rate when the queue scheduler performs the queue scheduling, and the second rate is greater than the preset. The scheduling rate threshold.
可选地,如图7F所示,装置700还可以包括:Optionally, as shown in FIG. 7F, the apparatus 700 may further include:
接收模块704,用于接收队列调度器发送的调度响应,调度响应可以包括调度粒度,调度粒度为队列调度器为第一队列分配的用于数据传输的额定数据量。The receiving module 704 is configured to receive a scheduling response sent by the queue scheduler, where the scheduling response may include a scheduling granularity, where the scheduling granularity is a rated data amount allocated by the queue scheduler for the first queue for data transmission.
更新模块705,用于基于调度响应更新第一队列的当前队列信用值。The update module 705 is configured to update the current queue credit value of the first queue based on the scheduling response.
可选地,如图7F所示,装置700还可以包括:Optionally, as shown in FIG. 7F, the apparatus 700 may further include:
执行模块706,用于基于更新后的当前队列信用值,对第一队列中相应长度的数据包执行出队操作。The executing module 706 is configured to perform a dequeuing operation on the data packet of the corresponding length in the first queue based on the updated current queue credit value.
可选地,发送模块703,用于:Optionally, the sending module 703 is configured to:
判断调度请求所指示的调度状态与第一队列对应的当前调度状态是否相同。It is determined whether the scheduling state indicated by the scheduling request is the same as the current scheduling state corresponding to the first queue.
当调度请求所指示的调度状态与第一队列对应的当前调度状态不同时,将调度请求发送至队列调度器。When the scheduling status indicated by the scheduling request is different from the current scheduling status corresponding to the first queue, the scheduling request is sent to the queue scheduler.
可选地,如图7F所示,装置700装置还可以包括:Optionally, as shown in FIG. 7F, the apparatus 700 may further include:
第二确定模块707,用于当第一队列的队列长度发生变化时,确定第一队列的长度差值发生变化。The second determining module 707 is configured to determine that the length difference of the first queue changes when the queue length of the first queue changes.
和/或,第二确定模块707,用于当第一队列的当前队列信用值发生变化时,确定第一队列的长度差值发生变化。And/or, the second determining module 707 is configured to determine that the length difference of the first queue changes when the current queue credit value of the first queue changes.
综上所述,本申请示例性实施例提供的队列调度装置,通过第一确定模块在第一队列的长度差值发生变化时确定目标概率,生成模块基于目标概率,进行调度请求的随机生成,使得调度请求生成的可能性与未生成的可能性的比例为目标概率,发送模块当生成了调度请求时,将调度请求发送至队列调度器,相对于相关技术,降低了队列管理器基于其所管理的多个队列生成调度请求的数量,使得队列管理器所管理的多个队列生成调度请求的数量尽量呈现出均匀分布的状态,能够有效地减小队列管理器向队列调度器发送调度请求的频率,进而减小队列调度器的调度负载,降低队列调度器对队列的调度出现调度时延较大的概率。In summary, the queue scheduling apparatus provided by the exemplary embodiment of the present application determines the target probability when the length difference of the first queue changes by the first determining module, and the generating module performs random generation of the scheduling request based on the target probability. The ratio of the possibility of generating the scheduling request to the probability of not being generated is the target probability. When the sending module generates the scheduling request, the sending module sends the scheduling request to the queue scheduler, which reduces the queue manager based on the related technology. The number of scheduling requests generated by the plurality of queues is such that the number of scheduling requests generated by the queue manager is uniformly distributed, which can effectively reduce the queue manager sending scheduling requests to the queue scheduler. The frequency, in turn, reduces the scheduling load of the queue scheduler, and reduces the probability that the queue scheduler has a large scheduling delay for scheduling of the queue.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的装置、模块和子模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。A person skilled in the art can clearly understand that, for the convenience and brevity of the description, the specific working process of the device, the module and the sub-module described above can refer to the corresponding process in the foregoing method embodiment, and details are not described herein again.
本申请示例性实施例还提供了一种通信设备,通信设备包括:队列调度器和队列管理器;The exemplary embodiment of the present application further provides a communication device, where the communication device includes: a queue scheduler and a queue manager;
该队列管理器包括如图7A或图7F所示的队列调度装置。The queue manager includes a queue scheduling device as shown in FIG. 7A or 7F.
该队列调度器用于在接收到队列管理器发送的调度请求后,向队列管理器发送调度响应,调度响应用于为基于调度请求分配用于数据传输的额定数据量。The queue scheduler is configured to send a scheduling response to the queue manager after receiving the scheduling request sent by the queue manager, where the scheduling response is used to allocate a nominal amount of data for data transmission based on the scheduling request.
本申请示例性实施例还提供了一种队列调度装置,装置包括:The exemplary embodiment of the present application further provides a queue scheduling apparatus, where the apparatus includes:
处理组件;Processing component
用于存储处理组件的可执行指令的存储器;a memory for storing executable instructions of the processing component;
其中,处理组件被配置为:Wherein the processing component is configured to:
当第一队列的长度差值发生变化时,基于第一队列的长度差值和第一队列的队列长度确定目标概率;When the length difference of the first queue changes, the target probability is determined based on the length difference of the first queue and the queue length of the first queue;
基于目标概率,进行调度请求的随机生成,使得调度请求生成的可能性与未生成的可能性的比例为目标概率,调度请求用于指示对第一队列进行调度的调度状态;Performing a random generation of the scheduling request based on the target probability, such that the ratio of the probability of generating the scheduling request to the probability of not being generated is a target probability, and the scheduling request is used to indicate a scheduling state for scheduling the first queue;
当生成了调度请求,将调度请求发送至队列调度器;When a scheduling request is generated, the scheduling request is sent to the queue scheduler;
其中,第一队列为队列管理器所管理的至少一个队列中的任一队列,长度差值为第一队列的当前队列信用值与第一队列的队列长度的差值,当前队列信用值为第一队列当前可用于数据传输的数据量额度。The first queue is any one of the at least one queue managed by the queue manager, and the length difference is the difference between the current queue credit value of the first queue and the queue length of the first queue, and the current queue credit value is The amount of data that a queue currently has for data transmission.
本申请示例性实施例提供了一种队列调度装置20,包括存储器,处理器及存储在存储器上并可在处理器上运行的计算机程序,处理器执行计算机程序时,实现本申请上述实施例提供的任一的队列调度方法。The exemplary embodiment of the present application provides a queue scheduling apparatus 20, including a memory, a processor, and a computer program stored on the memory and operable on the processor. When the processor executes the computer program, the foregoing embodiment of the present application is implemented. Any of the queue scheduling methods.
具体地,该终端可以为如图8所示的队列调度装置20,请参考图8,其示出了本申请示例性实施例涉及的一种队列调度装置20的结构示意图,该队列调度装置20可以包括:处理器22和信号接口24。Specifically, the terminal may be the queue scheduling device 20 as shown in FIG. 8 . Please refer to FIG. 8 , which is a schematic structural diagram of a queue scheduling device 20 according to an exemplary embodiment of the present application. It can include a processor 22 and a signal interface 24.
处理器22包括一个或者一个以上处理核心。处理器22通过运行软件程序以及模块,从而执行各种功能应用以及数据处理。 Processor 22 includes one or more processing cores. The processor 22 executes various functional applications and data processing by running software programs and modules.
信号接口24可以为多个,该信号接口24用于与其它装置或模块建立连接,例如:可以通过该信号接口24与扬声器或耳机进行连接。There may be a plurality of signal interfaces 24 for establishing connections with other devices or modules, for example, through which the speakers or headphones may be connected.
可选的,队列调度装置20还包括存储器26、总线28等部件。其中,存储器26与信号接口24分别通过总线28与处理器22相连。Optionally, the queue scheduling device 20 further includes components such as a memory 26, a bus 28, and the like. The memory 26 and the signal interface 24 are connected to the processor 22 via a bus 28, respectively.
存储器26可用于存储软件程序以及模块。具体的,存储器26可存储至少一个功能所需的应用程序模块262。 Memory 26 can be used to store software programs as well as modules. In particular, memory 26 may store application modules 262 required for at least one function.
其中,该应用程序模块262可以包括:The application module 262 can include:
第一确定单元2621,具有与第一确定模块701相同或相似的功能。The first determining unit 2621 has the same or similar function as the first determining module 701.
生成单元2622,具有与生成模块702相同或相似的功能。The generating unit 2622 has the same or similar function as the generating module 702.
发送单元2623,具有与发送模块703相同或相似的功能。The transmitting unit 2623 has the same or similar function as the transmitting module 703.
本申请示例性实施例还提供了一种存储介质,该存储介质可以为非易失性计算机可读存储介质,当存储介质中的指令由终端的处理组件执行时,使得终端能够执行本申请示例性实施例提供的队列调度方法。The exemplary embodiments of the present application also provide a storage medium, which may be a non-transitory computer readable storage medium, enabling a terminal to execute an example of the present application when instructions in the storage medium are executed by a processing component of the terminal The queue scheduling method provided by the embodiment.
本申请示例性实施例还提供了一种包含指令的计算机程序产品,当计算机程序产品在计算机上运行时,使得计算机执行本申请示例性实施例提供的队列调度方法。The exemplary embodiments of the present application also provide a computer program product comprising instructions that, when executed on a computer, cause the computer to perform the queue scheduling method provided by the exemplary embodiments of the present application.
需要说明的是:上述实施例提供的队列调度方法也可用于其他需要单个个体做向上取整或进位随机计算,使包括多个个体的总体产生随机结果速度是均匀的场景,且总体余数尽量靠近预设值,例如:接口处多端口拼包到固定长度就需要发送,需要随机均匀发送避免突发,本申请示例性实施例对其不做具体限定。It should be noted that the queue scheduling method provided in the foregoing embodiment can also be used in other scenarios that require a single individual to perform rounding up or rounding, so that the overall randomness of multiple individuals is uniform, and the overall remainder is as close as possible. The default value is, for example, the multi-port concatenation at the interface needs to be sent to a fixed length, and needs to be randomly and uniformly transmitted to avoid bursts, which is not specifically limited in the exemplary embodiment of the present application.
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。A person skilled in the art may understand that all or part of the steps of implementing the above embodiments may be completed by hardware, or may be instructed by a program to execute related hardware, and the program may be stored in a computer readable storage medium. The storage medium mentioned may be a read only memory, a magnetic disk or an optical disk or the like.
以上所述仅为本申请的可选实施例,并不用以限制本申请,凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。The above description is only an optional embodiment of the present application, and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application are included in the protection of the present application. Within the scope.

Claims (45)

  1. 一种队列调度方法,其特征在于,所述方法应用于队列管理器,所述方法包括:A queue scheduling method, wherein the method is applied to a queue manager, the method comprising:
    当第一队列的长度差值发生变化时,基于所述第一队列的长度差值和所述第一队列的队列长度确定目标概率;Determining a target probability based on a length difference of the first queue and a queue length of the first queue, when a difference in length of the first queue changes;
    基于所述目标概率,进行调度请求的随机生成,使得所述调度请求生成的可能性与未生成的可能性的比例为所述目标概率,所述调度请求用于指示对所述第一队列进行调度的调度状态;And performing, according to the target probability, a random generation of the scheduling request, such that a ratio of the possibility of generating the scheduling request to an ungenerated possibility is the target probability, where the scheduling request is used to indicate that the first queue is performed Scheduled scheduling status;
    当生成了所述调度请求,将所述调度请求发送至队列调度器;When the scheduling request is generated, the scheduling request is sent to a queue scheduler;
    其中,所述第一队列为所述队列管理器所管理的至少一个队列中的任一队列,所述长度差值为所述第一队列的当前队列信用值与所述第一队列的队列长度的差值,所述当前队列信用值为所述第一队列当前可用于数据传输的数据量额度。The first queue is any one of at least one queue managed by the queue manager, and the length difference is a current queue credit value of the first queue and a queue length of the first queue. The difference between the current queue credits is the amount of data that the first queue is currently available for data transmission.
  2. 根据权利要求1所述的方法,其特征在于,所述基于所述第一队列的长度差值和所述第一队列的队列长度确定目标概率,包括:The method according to claim 1, wherein the determining a target probability based on a length difference of the first queue and a queue length of the first queue comprises:
    当所述第一队列的队列长度发生变化时,获取所述长度差值变化后的第一差值,和变化前的第二差值;And acquiring, when the queue length of the first queue changes, a first difference after the change in the length difference, and a second difference before the change;
    基于所述第一差值和所述第二差值中的至少一个,以及所述第一队列的队列长度确定所述目标概率。The target probability is determined based on at least one of the first difference and the second difference, and a queue length of the first queue.
  3. 根据权利要求2所述的方法,其特征在于,所述基于所述第一差值和所述第二差值中的至少一个,以及所述第一队列的队列长度确定所述目标概率,包括:The method according to claim 2, wherein the determining the target probability based on at least one of the first difference value and the second difference value, and a queue length of the first queue, including :
    将所述第一差值分别与参考信用阈值以及调度粒度比较,所述参考信用阈值小于所述调度粒度,所述调度粒度为所述队列调度器对所述第一队列进行调度时,为所述第一队列分配的用于数据传输的额定数据量;Comparing the first difference with a reference credit threshold and a scheduling granularity, where the reference credit threshold is smaller than the scheduling granularity, where the scheduling granularity is that when the queue scheduler schedules the first queue, The nominal amount of data allocated for data transmission allocated by the first queue;
    当所述第一差值大于所述参考信用阈值且小于所述调度粒度时,基于所述第一差值和所述调度粒度确定所述目标概率。When the first difference is greater than the reference credit threshold and less than the scheduling granularity, the target probability is determined based on the first difference and the scheduling granularity.
  4. 根据权利要求3所述的方法,其特征在于,所述基于所述第一差值和所述调度粒度确定所述目标概率,包括:The method according to claim 3, wherein the determining the target probability based on the first difference value and the scheduling granularity comprises:
    将目标差值大于第一随机数的概率确定为所述目标概率,所述目标差值为所述调度粒度与所述第一差值的差值,所述第一随机数为随机产生且不大于所述调度粒度的正数。Determining, by the probability that the target difference is greater than the first random number, the target probability, where the target difference is a difference between the scheduling granularity and the first difference, the first random number is randomly generated and not A positive number greater than the scheduling granularity.
  5. 根据权利要求2所述的方法,其特征在于,所述基于所述第一差值和所述第二差值中的至少一个,以及所述第一队列的队列长度确定所述目标概率,包括:The method according to claim 2, wherein the determining the target probability based on at least one of the first difference value and the second difference value, and a queue length of the first queue, including :
    将所述第二差值分别与参考信用阈值以及调度粒度比较,所述参考信用阈值小于所述调度粒度,所述调度粒度为所述队列调度器对所述第一队列进行调度时,为所述第一队列分配的用于数据传输的额定数据量;Comparing the second difference with a reference credit threshold and a scheduling granularity, where the reference credit threshold is smaller than the scheduling granularity, where the scheduling granularity is when the queue scheduler schedules the first queue, The nominal amount of data allocated for data transmission allocated by the first queue;
    当所述第二差值大于所述参考信用阈值且小于所述调度粒度时,基于所述第二差值和目 标包长确定所述目标概率,所述目标包长为使所述第一队列的队列长度发生变化的数据包的长度。Determining the target probability based on the second difference and a target packet length when the second difference is greater than the reference credit threshold and less than the scheduling granularity, where the target packet length is the first queue The length of the packet whose length has changed.
  6. 根据权利要求5所述的方法,其特征在于,所述基于所述第二差值和目标包长确定所述目标概率,包括:The method according to claim 5, wherein the determining the target probability based on the second difference and a target packet length comprises:
    将所述目标包长大于第二随机数的概率确定为所述目标概率,所述第二随机数为随机产生且不大于所述第二差值的正数。The probability that the target packet length is greater than the second random number is determined as the target probability, and the second random number is a positive number that is randomly generated and not greater than the second difference.
  7. 根据权利要求2所述的方法,其特征在于,所述基于所述第一差值和所述第二差值中的至少一个,以及所述第一队列的队列长度确定所述目标概率,包括:The method according to claim 2, wherein the determining the target probability based on at least one of the first difference value and the second difference value, and a queue length of the first queue, including :
    将所述第一差值与参考信用阈值以及调度粒度分别比较,所述参考信用阈值小于所述调度粒度,所述调度粒度为所述队列调度器对所述第一队列进行调度时,为所述第一队列分配的用于数据传输的额定数据量;Comparing the first difference with the reference credit threshold and the scheduling granularity, where the reference credit threshold is smaller than the scheduling granularity, and the scheduling granularity is that when the queue scheduler schedules the first queue, The nominal amount of data allocated for data transmission allocated by the first queue;
    将所述第二差值分别与所述参考信用阈值以及所述调度粒度比较;Comparing the second difference with the reference credit threshold and the scheduling granularity, respectively;
    当所述第一差值与所述第二差值均满足:大于所述参考信用阈值且小于所述调度粒度时,基于所述第二差值和目标包长确定所述目标概率,所述目标包长为使所述第一队列的队列长度发生变化的数据包的长度。And determining, when the first difference value and the second difference value are greater than the reference credit threshold and less than the scheduling granularity, determining the target probability based on the second difference value and a target packet length, The target packet length is the length of the data packet that changes the queue length of the first queue.
  8. 根据权利要求7所述的方法,其特征在于,所述基于所述第二差值和目标包长确定所述目标概率,包括:The method according to claim 7, wherein the determining the target probability based on the second difference and a target packet length comprises:
    将所述目标包长与所述第二差值的比值确定为所述目标概率。A ratio of the target packet length to the second difference is determined as the target probability.
  9. 根据权利要求2所述的方法,其特征在于,所述基于所述第一差值和所述第二差值中的至少一个,以及所述第一队列的队列长度确定所述目标概率,包括:The method according to claim 2, wherein the determining the target probability based on at least one of the first difference value and the second difference value, and a queue length of the first queue, including :
    将所述第一差值分别与参考信用阈值以及预设的第一信用阈值进行比较,所述第一信用阈值小于所述参考信用阈值;Comparing the first difference with a reference credit threshold and a preset first credit threshold, where the first credit threshold is less than the reference credit threshold;
    当所述第一差值大于所述第一信用阈值且小于所述参考信用阈值时,确定所述目标概率为1。When the first difference is greater than the first credit threshold and less than the reference credit threshold, determining that the target probability is 1.
  10. 根据权利要求2所述的方法,其特征在于,所述基于所述第一差值和所述第二差值中的至少一个,以及所述第一队列的队列长度确定所述目标概率,包括:The method according to claim 2, wherein the determining the target probability based on at least one of the first difference value and the second difference value, and a queue length of the first queue, including :
    将所述第一差值与预设的第一信用阈值进行比较;Comparing the first difference with a preset first credit threshold;
    当所述第一差值小于所述第一信用阈值时,确定所述目标概率为1。When the first difference is less than the first credit threshold, the target probability is determined to be 1.
  11. 根据权利要求1所述的方法,其特征在于,所述基于所述第一队列的长度差值和所述第一队列的队列长度确定目标概率,包括:The method according to claim 1, wherein the determining a target probability based on a length difference of the first queue and a queue length of the first queue comprises:
    当所述第一队列的当前队列信用值发生变化时,根据所述长度差值确定所述目标概率。When the current queue credit value of the first queue changes, the target probability is determined according to the length difference.
  12. 根据权利要求11所述的方法,其特征在于,所述根据所述长度差值确定所述目标概 率,包括:The method according to claim 11, wherein said determining said target probability based on said difference in length comprises:
    将所述长度差值分别与参考信用阈值以及调度粒度比较,所述参考信用阈值小于所述调度粒度,所述调度粒度为所述队列调度器对所述第一队列进行调度时,为所述第一队列分配的用于数据传输的额定数据量;Comparing the length difference with the reference credit threshold and the scheduling granularity, where the reference credit threshold is smaller than the scheduling granularity, and the scheduling granularity is when the queue scheduler schedules the first queue, The nominal amount of data allocated for data transmission by the first queue;
    当所述长度差值大于所述参考信用阈值且小于所述调度粒度时,基于所述长度差值和所述调度粒度确定所述目标概率。When the length difference is greater than the reference credit threshold and less than the scheduling granularity, the target probability is determined based on the length difference and the scheduling granularity.
  13. 根据权利要求12所述的方法,其特征在于,所述基于所述长度差值和所述调度粒度确定所述目标概率,包括:The method according to claim 12, wherein the determining the target probability based on the length difference and the scheduling granularity comprises:
    将所述长度差值小于第一随机数的概率确定为所述目标概率,所述第一随机数为随机产生且不大于所述调度粒度的正数。Determining, by the probability that the length difference is smaller than the first random number, is the target probability, and the first random number is a positive number that is randomly generated and not greater than the scheduling granularity.
  14. 根据权利要求11所述的方法,其特征在于,所述根据所述长度差值确定所述目标概率,包括:The method according to claim 11, wherein the determining the target probability according to the length difference comprises:
    将所述长度差值分别与参考信用阈值以及预设的第一信用阈值进行比较,所述第一信用阈值小于所述参考信用阈值;Comparing the length difference with a reference credit threshold and a preset first credit threshold, where the first credit threshold is less than the reference credit threshold;
    当所述长度差值大于所述第一信用阈值且小于所述参考信用阈值时,确定所述目标概率为1。When the length difference is greater than the first credit threshold and less than the reference credit threshold, determining that the target probability is 1.
  15. 根据权利要求11所述的方法,其特征在于,所述根据所述长度差值确定所述目标概率,包括:The method according to claim 11, wherein the determining the target probability according to the length difference comprises:
    将所述长度差值与预设的第一信用阈值进行比较;Comparing the length difference with a preset first credit threshold;
    当所述长度差值小于所述第一信用阈值时,确定所述目标概率为1。When the length difference is less than the first credit threshold, the target probability is determined to be 1.
  16. 根据权利要求3至9任一或12至14任一所述的方法,其特征在于,所述基于所述目标概率,进行所述调度请求的随机生成,包括:The method according to any one of claims 3 to 9, or the method according to any one of claims 12 to 14, wherein the performing the random generation of the scheduling request based on the target probability comprises:
    当基于所述目标概率,选择生成所述调度请求时,基于选择结果生成所述调度请求,所述调度请求包括第一状态标识,所述第一状态标识指示所述队列调度器进行队列调度时的第一速率,所述第一速率小于预设的调度速率阈值。When the scheduling request is generated based on the target probability, the scheduling request is generated based on the selection result, where the scheduling request includes a first status identifier, where the first status identifier indicates that the queue scheduler performs queue scheduling The first rate, the first rate is less than a preset scheduling rate threshold.
  17. 根据权利要求10或15所述的方法,其特征在于,所述基于所述目标概率,进行所述调度请求的随机生成,包括:The method according to claim 10 or 15, wherein the performing the random generation of the scheduling request based on the target probability comprises:
    当基于所述目标概率,选择生成所述调度请求时,基于选择结果生成所述调度请求,所述调度请求包括第二状态标识,所述第二状态标识指示所述队列调度器进行队列调度时的第二速率,所述第二速率大于预设的调度速率阈值。When the scheduling request is generated based on the target probability, the scheduling request is generated based on the selection result, where the scheduling request includes a second status identifier, where the second status identifier indicates that the queue scheduler performs queue scheduling The second rate is greater than a preset scheduling rate threshold.
  18. 根据权利要求1至15任一所述的方法,其特征在于,在将所述调度请求发送至队列调度器之后,所述方法还包括:The method according to any one of claims 1 to 15, wherein after the scheduling request is sent to the queue scheduler, the method further comprises:
    接收所述队列调度器发送的调度响应,所述调度响应包括调度粒度,所述调度粒度为所 述队列调度器为所述第一队列分配的用于数据传输的额定数据量;Receiving a scheduling response sent by the queue scheduler, where the scheduling response includes a scheduling granularity, where the scheduling granularity is a rated data amount allocated by the queue scheduler for the first queue for data transmission;
    基于所述调度响应更新所述第一队列的当前队列信用值。Updating the current queue credit value of the first queue based on the scheduling response.
  19. 根据权利要求18所述的方法,其特征在于,在所述基于所述调度响应更新所述第一队列的当前队列信用值之后,所述方法还包括:The method according to claim 18, wherein after the updating the current queue credit value of the first queue based on the scheduling response, the method further comprises:
    基于更新后的当前队列信用值,对所述第一队列中相应长度的数据包执行出队操作。Dequeuing the data packet of the corresponding length in the first queue based on the updated current queue credit value.
  20. 根据权利要求1至15任一所述的方法,其特征在于,所述将所述调度请求发送至队列调度器,包括:The method according to any one of claims 1 to 15, wherein the sending the scheduling request to a queue scheduler comprises:
    判断所述调度请求所指示的调度状态与所述第一队列对应的当前调度状态是否相同;Determining whether the scheduling state indicated by the scheduling request is the same as the current scheduling state corresponding to the first queue;
    当所述调度请求所指示的调度状态与所述第一队列对应的当前调度状态不同时,将所述调度请求发送至所述队列调度器。And when the scheduling state indicated by the scheduling request is different from the current scheduling state corresponding to the first queue, the scheduling request is sent to the queue scheduler.
  21. 根据权利要求1至15任一所述的方法,其特征在于,在所述当第一队列的长度差值发生变化时,基于所述第一队列的长度差值和所述第一队列的队列长度确定目标概率之前,所述方法还包括:The method according to any one of claims 1 to 15, wherein when the length difference of the first queue changes, the difference between the length of the first queue and the queue of the first queue is Before the length determines the target probability, the method further includes:
    当所述第一队列的队列长度发生变化时,确定所述第一队列的长度差值发生变化;When the queue length of the first queue changes, determining that the length difference of the first queue changes;
    和/或,当所述第一队列的当前队列信用值发生变化时,确定所述第一队列的长度差值发生变化。And/or, when the current queue credit value of the first queue changes, determining that the length difference of the first queue changes.
  22. 一种队列调度装置,其特征在于,所述装置包括:A queue scheduling device, characterized in that the device comprises:
    第一确定模块,用于当第一队列的长度差值发生变化时,基于所述第一队列的长度差值和所述第一队列的队列长度确定目标概率;a first determining module, configured to determine a target probability based on a length difference of the first queue and a queue length of the first queue when a difference in length of the first queue changes;
    生成模块,用于基于所述目标概率,进行调度请求的随机生成,使得所述调度请求生成的可能性与未生成的可能性的比例为所述目标概率,所述调度请求用于指示对所述第一队列进行调度的调度状态;a generating module, configured to perform random generation of the scheduling request based on the target probability, such that a ratio of a probability of generating the scheduling request to an ungenerated possibility is the target probability, and the scheduling request is used to indicate a target Decoding the scheduling state of the first queue;
    发送模块,用于当生成了所述调度请求,将所述调度请求发送至队列调度器;a sending module, configured to send the scheduling request to a queue scheduler when the scheduling request is generated;
    其中,所述第一队列为所述队列管理器所管理的至少一个队列中的任一队列,所述长度差值为所述第一队列的当前队列信用值与所述第一队列的队列长度的差值,所述当前队列信用值为所述第一队列当前可用于数据传输的数据量额度。The first queue is any one of at least one queue managed by the queue manager, and the length difference is a current queue credit value of the first queue and a queue length of the first queue. The difference between the current queue credits is the amount of data that the first queue is currently available for data transmission.
  23. 根据权利要求22所述的装置,其特征在于,所述第一确定模块,包括:The device according to claim 22, wherein the first determining module comprises:
    获取子模块,用于当所述第一队列的队列长度发生变化时,获取所述长度差值变化后的第一差值,和变化前的第二差值;Obtaining a sub-module, configured to: when the queue length of the first queue changes, obtain a first difference after the length difference is changed, and a second difference before the change;
    第一确定子模块,用于基于所述第一差值和所述第二差值中的至少一个,以及所述第一队列的队列长度确定所述目标概率。a first determining submodule, configured to determine the target probability based on at least one of the first difference value and the second difference value, and a queue length of the first queue.
  24. 根据权利要求23所述的装置,其特征在于,所述第一确定子模块,包括:The apparatus according to claim 23, wherein the first determining submodule comprises:
    第一比较单元,用于将所述第一差值分别与参考信用阈值以及调度粒度比较,所述参考 信用阈值小于所述调度粒度,所述调度粒度为所述队列调度器对所述第一队列进行调度时,为所述第一队列分配的用于数据传输的额定数据量;a first comparing unit, configured to compare the first difference with a reference credit threshold and a scheduling granularity, where the reference credit threshold is smaller than the scheduling granularity, and the scheduling granularity is that the queue scheduler pairs the first The rated data amount allocated for the first queue for data transmission when the queue is scheduled;
    第一确定单元,用于当所述第一差值大于所述参考信用阈值且小于所述调度粒度时,基于所述第一差值和所述调度粒度确定所述目标概率。a first determining unit, configured to determine the target probability based on the first difference value and the scheduling granularity when the first difference value is greater than the reference credit threshold and less than the scheduling granularity.
  25. 根据权利要求24所述的装置,其特征在于,所述第一确定单元,用于:The device according to claim 24, wherein the first determining unit is configured to:
    将目标差值大于第一随机数的概率确定为所述目标概率,所述目标差值为所述调度粒度与所述第一差值的差值,所述第一随机数为随机产生且不大于所述调度粒度的正数。Determining, by the probability that the target difference is greater than the first random number, the target probability, where the target difference is a difference between the scheduling granularity and the first difference, the first random number is randomly generated and not A positive number greater than the scheduling granularity.
  26. 根据权利要求23所述的装置,其特征在于,所述第一确定子模块,包括:The apparatus according to claim 23, wherein the first determining submodule comprises:
    第一比较单元,用于将所述第二差值分别与参考信用阈值以及调度粒度比较,所述参考信用阈值小于所述调度粒度,所述调度粒度为所述队列调度器对所述第一队列进行调度时,为所述第一队列分配的用于数据传输的额定数据量;a first comparing unit, configured to compare the second difference with a reference credit threshold and a scheduling granularity, where the reference credit threshold is smaller than the scheduling granularity, and the scheduling granularity is that the queue scheduler pairs the first The rated data amount allocated for the first queue for data transmission when the queue is scheduled;
    第一确定单元,用于当所述第二差值大于所述参考信用阈值且小于所述调度粒度时,基于所述第二差值和目标包长确定所述目标概率,所述目标包长为使所述第一队列的队列长度发生变化的数据包的长度。a first determining unit, configured to determine, according to the second difference and a target packet length, the target probability, when the second difference is greater than the reference credit threshold and less than the scheduling granularity, the target packet length The length of the data packet for which the queue length of the first queue changes.
  27. 根据权利要求26所述的装置,其特征在于,所述第一确定单元,用于:The device according to claim 26, wherein the first determining unit is configured to:
    将所述目标包长大于第二随机数的概率确定为所述目标概率,所述第二随机数为随机产生且不大于所述第二差值的正数。The probability that the target packet length is greater than the second random number is determined as the target probability, and the second random number is a positive number that is randomly generated and not greater than the second difference.
  28. 根据权利要求23所述的装置,其特征在于,所述第一确定子模块,包括:The apparatus according to claim 23, wherein the first determining submodule comprises:
    第一比较单元,用于将所述第一差值与参考信用阈值以及调度粒度分别比较,所述参考信用阈值小于所述调度粒度,所述调度粒度为所述队列调度器对所述第一队列进行调度时,为所述第一队列分配的用于数据传输的额定数据量;a first comparing unit, configured to compare the first difference value with a reference credit threshold and a scheduling granularity, where the reference credit threshold is smaller than the scheduling granularity, and the scheduling granularity is that the queue scheduler pairs the first The rated data amount allocated for the first queue for data transmission when the queue is scheduled;
    所述第一比较单元,用于将所述第二差值分别与所述参考信用阈值以及所述调度粒度比较;The first comparing unit is configured to compare the second difference value with the reference credit threshold and the scheduling granularity respectively;
    第一确定单元,用于当所述第一差值与所述第二差值均满足:大于所述参考信用阈值且小于所述调度粒度时,基于所述第二差值和目标包长确定所述目标概率,所述目标包长为使所述第一队列的队列长度发生变化的数据包的长度。a first determining unit, configured to determine, when the first difference value and the second difference value are greater than the reference credit threshold and less than the scheduling granularity, based on the second difference value and a target packet length The target probability, the target packet length is a length of a data packet that changes a queue length of the first queue.
  29. 根据权利要求28所述的装置,其特征在于,所述第一确定单元,用于:The device according to claim 28, wherein the first determining unit is configured to:
    将所述目标包长与所述第二差值的比值确定为所述目标概率。A ratio of the target packet length to the second difference is determined as the target probability.
  30. 根据权利要求23所述的装置,其特征在于,所述第一确定子模块,包括:The apparatus according to claim 23, wherein the first determining submodule comprises:
    第一比较单元,用于将所述第一差值分别与参考信用阈值以及预设的第一信用阈值进行比较,所述第一信用阈值小于所述参考信用阈值;a first comparison unit, configured to compare the first difference value with a reference credit threshold and a preset first credit threshold, where the first credit threshold is smaller than the reference credit threshold;
    第一确定单元,用于当所述第一差值大于所述第一信用阈值且小于所述参考信用阈值时,确定所述目标概率为1。The first determining unit is configured to determine that the target probability is 1 when the first difference is greater than the first credit threshold and less than the reference credit threshold.
  31. 根据权利要求23所述的装置,其特征在于,所述第一确定子模块,包括:The apparatus according to claim 23, wherein the first determining submodule comprises:
    第一比较单元,用于将所述第一差值与预设的第一信用阈值进行比较;a first comparing unit, configured to compare the first difference with a preset first credit threshold;
    第一确定单元,用于当所述第一差值小于所述第一信用阈值时,确定所述目标概率为1。a first determining unit, configured to determine that the target probability is 1 when the first difference is less than the first credit threshold.
  32. 根据权利要求22所述的装置,其特征在于,所述第一确定模块,包括:The device according to claim 22, wherein the first determining module comprises:
    第二确定子模块,用于当所述第一队列的当前队列信用值发生变化时,根据所述长度差值确定所述目标概率。a second determining submodule, configured to determine the target probability according to the length difference when a current queue credit value of the first queue changes.
  33. 根据权利要求32所述的装置,其特征在于,所述第二确定子模块,包括:The apparatus according to claim 32, wherein the second determining submodule comprises:
    第二比较单元,用于将所述长度差值分别与参考信用阈值以及调度粒度比较,所述参考信用阈值小于所述调度粒度,所述调度粒度为所述队列调度器对所述第一队列进行调度时,为所述第一队列分配的用于数据传输的额定数据量;a second comparing unit, configured to compare the length difference value with a reference credit threshold and a scheduling granularity, where the reference credit threshold is smaller than the scheduling granularity, where the scheduling granularity is that the queue scheduler is to the first queue The amount of rated data allocated for the first queue for data transmission when scheduling is performed;
    第二确定单元,用于当所述长度差值大于所述参考信用阈值且小于所述调度粒度时,基于所述长度差值和所述调度粒度确定所述目标概率。a second determining unit, configured to determine the target probability based on the length difference and the scheduling granularity when the length difference is greater than the reference credit threshold and less than the scheduling granularity.
  34. 根据权利要求33所述的装置,其特征在于,所述第二确定单元,用于:The device according to claim 33, wherein the second determining unit is configured to:
    将所述长度差值小于第一随机数的概率确定为所述目标概率,所述第一随机数为随机产生且不大于所述调度粒度的正数。Determining, by the probability that the length difference is smaller than the first random number, is the target probability, and the first random number is a positive number that is randomly generated and not greater than the scheduling granularity.
  35. 根据权利要求32所述的装置,其特征在于,所述第二确定子模块,包括:The apparatus according to claim 32, wherein the second determining submodule comprises:
    第二比较单元,用于将所述长度差值分别与参考信用阈值以及预设的第一信用阈值进行比较,所述第一信用阈值小于所述参考信用阈值;a second comparing unit, configured to compare the length difference value with a reference credit threshold and a preset first credit threshold, where the first credit threshold is smaller than the reference credit threshold;
    第二确定单元,用于当所述长度差值大于所述第一信用阈值且小于所述参考信用阈值时,确定所述目标概率为1。And a second determining unit, configured to determine that the target probability is 1 when the length difference is greater than the first credit threshold and less than the reference credit threshold.
  36. 根据权利要求32所述的装置,其特征在于,所述第二确定子模块,包括:The apparatus according to claim 32, wherein the second determining submodule comprises:
    第二比较单元,用于将所述长度差值与预设的第一信用阈值进行比较;a second comparing unit, configured to compare the length difference with a preset first credit threshold;
    第二确定单元,用于当所述长度差值小于所述第一信用阈值时,确定所述目标概率为1。a second determining unit, configured to determine that the target probability is 1 when the length difference is less than the first credit threshold.
  37. 根据权利要求24至30任一或33至35任一所述的装置,其特征在于,所述生成模块,用于:The device according to any one of claims 24 to 30 or 33 to 35, wherein the generating module is configured to:
    当基于所述目标概率,选择生成所述调度请求时,基于选择结果生成所述调度请求,所述调度请求包括第一状态标识,所述第一状态标识指示所述队列调度器进行队列调度时的第一速率,所述第一速率小于预设的调度速率阈值。When the scheduling request is generated based on the target probability, the scheduling request is generated based on the selection result, where the scheduling request includes a first status identifier, where the first status identifier indicates that the queue scheduler performs queue scheduling The first rate, the first rate is less than a preset scheduling rate threshold.
  38. 根据权利要求31或36所述的装置,其特征在于,所述生成模块,用于:The device according to claim 31 or 36, wherein the generating module is configured to:
    当基于所述目标概率,选择生成所述调度请求时,基于选择结果生成所述调度请求,所述调度请求包括第二状态标识,所述第二状态标识指示所述队列调度器进行队列调度时的第 二速率,所述第二速率大于预设的调度速率阈值。When the scheduling request is generated based on the target probability, the scheduling request is generated based on the selection result, where the scheduling request includes a second status identifier, where the second status identifier indicates that the queue scheduler performs queue scheduling The second rate is greater than a preset scheduling rate threshold.
  39. 根据权利要求22至36任一所述的装置,其特征在于,所述装置还包括:The device according to any one of claims 22 to 36, wherein the device further comprises:
    接收模块,用于接收所述队列调度器发送的调度响应,所述调度响应包括调度粒度,所述调度粒度为所述队列调度器为所述第一队列分配的用于数据传输的额定数据量;a receiving module, configured to receive a scheduling response sent by the queue scheduler, where the scheduling response includes a scheduling granularity, where the scheduling granularity is a rated data volume allocated by the queue scheduler for the first queue for data transmission ;
    更新模块,用于基于所述调度响应更新所述第一队列的当前队列信用值。And an update module, configured to update a current queue credit value of the first queue based on the scheduling response.
  40. 根据权利要求39所述的装置,其特征在于,所述装置还包括:The device of claim 39, wherein the device further comprises:
    执行模块,用于基于更新后的当前队列信用值,对所述第一队列中相应长度的数据包执行出队操作。And an execution module, configured to perform a dequeuing operation on the data packet of the corresponding length in the first queue based on the updated current queue credit value.
  41. 根据权利要求22至36任一所述的装置,其特征在于,所述发送模块,用于:The device according to any one of claims 22 to 36, wherein the sending module is configured to:
    判断所述调度请求所指示的调度状态与所述第一队列对应的当前调度状态是否相同;Determining whether the scheduling state indicated by the scheduling request is the same as the current scheduling state corresponding to the first queue;
    当所述调度请求所指示的调度状态与所述第一队列对应的当前调度状态不同时,将所述调度请求发送至所述队列调度器。And when the scheduling state indicated by the scheduling request is different from the current scheduling state corresponding to the first queue, the scheduling request is sent to the queue scheduler.
  42. 根据权利要求22至36任一所述的装置,其特征在于,所述装置还包括:The device according to any one of claims 22 to 36, wherein the device further comprises:
    第二确定模块,用于当所述第一队列的队列长度发生变化时,确定所述第一队列的长度差值发生变化;a second determining module, configured to determine, when the queue length of the first queue changes, a change in a length difference of the first queue;
    和/或,所述第二确定模块,用于当所述第一队列的当前队列信用值发生变化时,确定所述第一队列的长度差值发生变化。And/or, the second determining module is configured to determine that a difference in length of the first queue changes when a current queue credit value of the first queue changes.
  43. 一种通信设备,其特征在于,所述通信设备包括:队列调度器和队列管理器;A communication device, comprising: a queue scheduler and a queue manager;
    所述队列管理器包括如权利要求22至42任一所述的队列调度装置;The queue manager includes the queue scheduling apparatus according to any one of claims 22 to 42;
    所述队列调度器用于在接收到所述队列管理器发送的调度请求后,向所述队列管理器发送调度响应,所述调度响应用于为基于所述调度请求分配用于数据传输的额定数据量。The queue scheduler is configured to send a scheduling response to the queue manager after receiving the scheduling request sent by the queue manager, where the scheduling response is used to allocate rated data for data transmission based on the scheduling request. the amount.
  44. 一种队列调度装置,其特征在于,所述装置包括:A queue scheduling device, characterized in that the device comprises:
    处理组件;Processing component
    用于存储所述处理组件的可执行指令的存储器;a memory for storing executable instructions of the processing component;
    其中,所述处理组件被配置为:Wherein the processing component is configured to:
    当第一队列的长度差值发生变化时,基于所述第一队列的长度差值和所述第一队列的队列长度确定目标概率;Determining a target probability based on a length difference of the first queue and a queue length of the first queue, when a difference in length of the first queue changes;
    基于所述目标概率,进行调度请求的随机生成,使得所述调度请求生成的可能性与未生成的可能性的比例为所述目标概率,所述调度请求用于指示对所述第一队列进行调度的调度状态;And performing, according to the target probability, a random generation of the scheduling request, such that a ratio of the possibility of generating the scheduling request to an ungenerated possibility is the target probability, where the scheduling request is used to indicate that the first queue is performed Scheduled scheduling status;
    当生成了所述调度请求,将所述调度请求发送至队列调度器;When the scheduling request is generated, the scheduling request is sent to a queue scheduler;
    其中,所述第一队列为所述队列管理器所管理的至少一个队列中的任一队列,所述长度差值为所述第一队列的当前队列信用值与所述第一队列的队列长度的差值,所述当前队列信 用值为所述第一队列当前可用于数据传输的数据量额度。The first queue is any one of at least one queue managed by the queue manager, and the length difference is a current queue credit value of the first queue and a queue length of the first queue. The difference between the current queue credits is the amount of data that the first queue is currently available for data transmission.
  45. 一种存储介质,其特征在于,当所述存储介质中的指令由终端的处理组件执行时,使得所述终端能够执行权利要求1至21任一所述的队列调度方法。A storage medium characterized by enabling the terminal to execute the queue scheduling method according to any one of claims 1 to 21 when an instruction in the storage medium is executed by a processing component of the terminal.
PCT/CN2018/119110 2017-12-08 2018-12-04 Queue scheduling method and apparatus, communication device, and storage medium WO2019109902A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201711298688.6 2017-12-08
CN201711298688.6A CN109905331B (en) 2017-12-08 2017-12-08 Queue scheduling method and device, communication equipment and storage medium

Publications (1)

Publication Number Publication Date
WO2019109902A1 true WO2019109902A1 (en) 2019-06-13

Family

ID=66751264

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/119110 WO2019109902A1 (en) 2017-12-08 2018-12-04 Queue scheduling method and apparatus, communication device, and storage medium

Country Status (2)

Country Link
CN (1) CN109905331B (en)
WO (1) WO2019109902A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113300973B (en) * 2020-02-21 2022-04-12 大唐移动通信设备有限公司 Scheduling method and device for multi-queue transmission, electronic equipment and storage medium
CN117014384A (en) * 2022-04-29 2023-11-07 华为技术有限公司 Message transmission method and message forwarding equipment
CN115344405A (en) * 2022-08-10 2022-11-15 北京有竹居网络技术有限公司 Data processing method, network interface card, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110194426A1 (en) * 2010-02-09 2011-08-11 Chien Fang Hierarchical queuing and scheduling
CN102752192A (en) * 2012-04-27 2012-10-24 浙江工商大学 Bandwidth allocation method of forwarding and control element separation (ForCES) transmission mapping layer based on stream control transmission protocol (SCTP)
CN102932840A (en) * 2012-11-14 2013-02-13 浙江大学 Wireless router active queue management method based on rates and queue length
CN103873383A (en) * 2012-12-12 2014-06-18 中国移动通信集团上海有限公司 Queue scheduling method and device
CN103929372A (en) * 2013-01-11 2014-07-16 华为技术有限公司 Active queue management method and device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FI20045222A0 (en) * 2004-06-15 2004-06-15 Nokia Corp Network devices and traffic processing procedures
CN102104545B (en) * 2011-02-12 2012-08-08 华为技术有限公司 Credit scheduling method and device and bypass device for solving linear speed of packet
CN102857442B (en) * 2011-06-30 2017-11-21 马维尔国际贸易有限公司 The method of transmission queue's state, network equipment and products thereof

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110194426A1 (en) * 2010-02-09 2011-08-11 Chien Fang Hierarchical queuing and scheduling
CN102752192A (en) * 2012-04-27 2012-10-24 浙江工商大学 Bandwidth allocation method of forwarding and control element separation (ForCES) transmission mapping layer based on stream control transmission protocol (SCTP)
CN102932840A (en) * 2012-11-14 2013-02-13 浙江大学 Wireless router active queue management method based on rates and queue length
CN103873383A (en) * 2012-12-12 2014-06-18 中国移动通信集团上海有限公司 Queue scheduling method and device
CN103929372A (en) * 2013-01-11 2014-07-16 华为技术有限公司 Active queue management method and device

Also Published As

Publication number Publication date
CN109905331A (en) 2019-06-18
CN109905331B (en) 2021-01-01

Similar Documents

Publication Publication Date Title
EP2466824B1 (en) Service scheduling method and device
US7826351B2 (en) MMPP analysis of network traffic using a transition window
CN109617829B (en) Method, device and system for processing service request data
WO2019109902A1 (en) Queue scheduling method and apparatus, communication device, and storage medium
US10521258B2 (en) Managing test services in a distributed production service environment
CN107645407B (en) Method and device for adapting QoS
US10554568B2 (en) Technologies for network round-trip time estimation
US10951551B2 (en) Queue management method and apparatus
CN113157465B (en) Message sending method and device based on pointer linked list
CN116868553A (en) Dynamic network receiver driven data scheduling on a data center network for managing endpoint resources and congestion relief
US9298652B2 (en) Moderated completion signaling
US11321135B2 (en) Rate limiting compliance assessments with multi-layer fair share scheduling
CN110557341A (en) Method and device for limiting data current
WO2017032075A1 (en) Quality of service multiplexing method and device, and computer storage medium
CN113225263B (en) Flow request processing method and device and network chip
CN115344405A (en) Data processing method, network interface card, electronic equipment and storage medium
US20210136007A1 (en) Method and apparatus for orchestrating resources in multi-access edge computing (mec) network
WO2017016300A1 (en) Method and apparatus for processing token application, computer storage medium
Hou et al. A provident resource defragmentation framework for mobile cloud computing
CN115242727B (en) User request processing method, device, equipment and medium
US20240048461A1 (en) Data transmission processing networking method and apparatus in a host supporting quality assurance of hyper-precision communication services
CN110119364B (en) Method and system for input/output batch submission
CN117749726A (en) Method and device for mixed scheduling of output port priority queues of TSN switch
US9674282B2 (en) Synchronizing SLM statuses of a plurality of appliances in a cluster
JP6491944B2 (en) Packet processing apparatus and program

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: 18884905

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18884905

Country of ref document: EP

Kind code of ref document: A1