Summary of the invention
Embodiments provide a kind of method and apparatus of queue scheduling, by pre-configured link paths, the message in direct scheduling queue also exports, and improves the efficiency of schedules message, and saves storage resources.Meanwhile, scheduler resource can flexible configuration to each scheduling level, thus the utilance of scheduler resource can be improved, save hardware resource.
Embodiments provide a kind of method of queue scheduling, the method comprises:
According to configuration parameter information, set up the linking relationship of each queue and higher level's virtual scheduling device, the linking relationship between virtual scheduling device at different levels, and the linking relationship of first order virtual scheduling device and message output port, form link paths;
Preserve the configuration parameter of described linking relationship; The described configuration parameter information of regular or irregular amendment, configures described link paths;
After receiving dispatching message request, according to the described configuration parameter stored, obtain the queue storing described message;
According to the described link paths of described queue to message output port, the message in execution cost queue.
Preferably, after receiving message, described message is stored into corresponding queue according to the classification of configuration.
Preferably, the described configuration parameter information of regular or irregular amendment, configures described link paths.
Preferably, after the request of described reception dispatching message, according to the configuration parameter stored, obtain the queue storing described message, comprising:
After receiving scheduling message request, according to described configuration parameter, from first order virtual scheduling device, obtain the next stage virtual scheduling device with linking relationship step by step, until obtain the queue of the needs scheduling with linking relationship.
Preferably, the real-time upwards primary virtual scheduler dispatches state information of described queue, when in described queue during stored messages, send to described higher level's virtual scheduling device the information that mark exists message, the linking relationship between described higher level's virtual scheduling device and this queue is in state of activation; When in described queue during non-stored messages, send to described higher level's virtual scheduling device the information that mark does not exist message, the linking relationship between described higher level's virtual scheduling device and this queue is in unactivated state.
Preferably, when the link between virtual scheduling device at the corresponding levels and subordinate's virtual scheduling device or queue is all in unactivated state, the Link State of itself and higher level's virtual scheduling device is changed to inactive.
Preferably, when obtaining the queue of described packet storage, the numbering of described queue is sent to its higher level's virtual scheduling device.
Accordingly, embodiments provide a kind of device of queue scheduling, comprising:
Link establishment unit, for according to configuration parameter information, set up the linking relationship of each queue and higher level's virtual scheduling device, the linking relationship between virtual scheduling device at different levels, and the linking relationship of first order virtual scheduling device and message output port, form link paths;
Configuration parameter memory cell, for preserving the configuration parameter of described linking relationship; The described configuration parameter information of regular or irregular amendment, configures described link paths;
Queue acquiring unit, after receiving dispatching message request, according to the described configuration parameter stored, obtains the queue storing described message;
Scheduling unit, for according to the described link paths of described queue to message output port, the message in execution cost queue.
Preferably, described device also comprises: packet storage unit, after receiving message, described message is stored into corresponding queue according to the classification of configuration.
Preferably, described scheduling unit, after receiving scheduling message request, according to described configuration parameter, from first order virtual scheduling device, obtain the next stage virtual scheduling device with linking relationship step by step, until obtain the queue of the needs scheduling with linking relationship.
Embodiments provide a kind of method and apparatus of queue scheduling, after receiving dispatching message request, according to the configuration parameter stored, obtain the queue storing described message; According to the link paths of described queue to message output port, the message in execution cost queue.The method and apparatus of the queue scheduling using the embodiment of the present invention to provide, by pre-configured link paths, the message in direct scheduling queue also exports, and improves the efficiency of schedules message, and saves storage resources.And scheduling sum of series scheduling structure can flexible configuration, also improves the resource utilization of scheduler.
Embodiment
Below in conjunction with each accompanying drawing, the main of embodiment of the present invention technical scheme is realized principle, embodiment and set forth in detail the beneficial effect that should be able to reach.
In order to solve prior art Problems existing, embodiments providing a kind of method of queue scheduling, as shown in Figure 1, comprising the following steps:
After step 101, the request of reception dispatching message, according to the configuration parameter stored, obtain the queue of stored messages;
Step 102, according to the link paths of queue to message output port, the message in scheduling queue.
Concrete, after receiving message, this message is stored into corresponding queue according to the classification of configuration, and wait is scheduled.Wherein, the classification of configuration can comprise: the class of service of message, the type of message, the source address etc. that message is corresponding, such as by the video traffic packet storage of user A in first queue, by the audio service packet storage of user A in the 3rd queue, the word service message of user B is stored in the tenth queue.
When dispatching above-mentioned message, the linking relationship between queue and virtual scheduling device and virtual scheduling device at different levels is utilized to dispatch.This linking relationship can be arranged in advance by user, according to configuration parameter information, set up the linking relationship of each queue and higher level's virtual scheduling device, linking relationship between virtual scheduling device at different levels, and the linking relationship of first order virtual scheduling device and message output port, form link paths, the dispatching algorithm attribute of each virtual scheduling device can also be set.Then the configuration parameter of above-mentioned linking relationship is preserved.As shown in Figure 2, for the scheduling structure in the embodiment of the present invention, when configuring this structure, need to configure the linking relationship between each queue and virtual scheduling device, namely Queue links is to which virtual scheduling device, as shown in Figure 2, queue Q0 is linked to virtual scheduling device S3, queue Q1 is linked to virtual scheduling device S2; Also need the linking relationship between configuration virtual scheduler, as shown in Figure 2, virtual scheduling device S3 is linked to virtual scheduling device S2, virtual scheduling device S2 is linked to virtual scheduling device S1, and wherein virtual scheduling device S1 is first order virtual scheduling device, its link message output port; In addition, can also configure the algorithm attribute of each virtual scheduling device, namely each virtual scheduling device needs the dispatching algorithm of use, and other parameter etc. required under certain dispatching algorithm concrete.By above-mentioned link, can each queue of dynamic-configuration to the progression of message, such as queue Q0 have passed through the scheduling of virtual scheduling device S1, S2, S3, be then 3 grades of scheduling, queue Q1 have passed through the scheduling of virtual scheduling device S1, S2, be then 2 grades of scheduling.Certain virtual scheduling device can be connected to other any one virtual scheduling device, such user just can by regular or irregular amendment configuration parameter information, configuration link path, the number of flexible control virtual scheduling device, this configuration information can on-the-fly modify, and namely supports the dynamic conditioning in running.It is characteristic herein that flexible control on-the-fly modifies, and should embody in claim
And, above-mentioned queue in real time upwards primary virtual scheduler dispatches state information, when in queue during stored messages, superior virtual scheduling device sends the information that mark exists message, and the linking relationship between higher level's virtual scheduling device and this queue is in state of activation; When in queue during non-stored messages, superior virtual scheduling device sends the information that mark does not exist message, and the linking relationship between higher level's virtual scheduling device and this queue is in unactivated state.Such as, in queue during stored messages, in the information that superior virtual scheduling device sends, be designated 1; In queue during non-stored messages, in the information that superior virtual scheduling device sends, be designated 0.When being designated 1 in last information, and be designated 0 in this information, then illustrate that the message in this queue has been scheduled; When being designated 0 in last information, and be designated 1 in this information, then illustrate in this queue and stored message, can be scheduled.Meanwhile, when the link between virtual scheduling device at the corresponding levels and subordinate's virtual scheduling device or queue is all in unactivated state, the Link State of itself and higher level's virtual scheduling device is changed to inactive.
After receiving scheduling message request, according to above-mentioned configuration parameter, from first order virtual scheduling device, obtain the next stage virtual scheduling device with linking relationship step by step, until obtain the physical queue of the needs scheduling with linking relationship, the numbering of this queue is sent to its higher level's virtual scheduling device.Preferably, the information sending this queue number has flag, is represented the validity of this information by this flag.
By foregoing description, can find out, the method for the queue scheduling using the embodiment of the present invention to provide, by pre-configured link paths, the message in direct scheduling queue also exports, and improves the efficiency of schedules message, and saves storage resources.And scheduling sum of series scheduling structure can flexible configuration, also improves the resource utilization of scheduler.
Below the method for the queue scheduling that the embodiment of the present invention provides is described in detail, as shown in Figure 3, performs following steps:
Step 301, configure linking relationship between each queue and virtual scheduling device, and linking relationship between each virtual scheduling device preserving;
Concrete, pass through configuration parameter, set up the linking relationship of each queue and higher level's virtual scheduling device, linking relationship between virtual scheduling device at different levels, and the linking relationship of first order virtual scheduling device and message output port, form link paths, the dispatching algorithm attribute of each virtual scheduling device can also be set, then preserve the configuration parameter of above-mentioned linking relationship.During configuration, need to configure the linking relationship between each queue and virtual scheduling device, namely Queue links is to which virtual scheduling device, also need the linking relationship between configuration virtual scheduler, the algorithm attribute of each virtual scheduling device can also be configured, namely each virtual scheduling device needs the dispatching algorithm of use, and other parameter etc. required under certain dispatching algorithm concrete.And, above-mentioned queue in real time upwards primary virtual scheduler dispatches state information, when in queue during stored messages, superior virtual scheduling device sends the information that mark exists message, and the linking relationship between higher level's virtual scheduling device and this queue is in state of activation; When in queue during non-stored messages, superior virtual scheduling device sends the information that mark does not exist message, and the linking relationship between higher level's virtual scheduling device and this queue is in unactivated state.Such as, in queue during stored messages, in the information that superior virtual scheduling device sends, be designated 1; In queue during non-stored messages, in the information that superior virtual scheduling device sends, be designated 0.When being designated 1 in last information, and be designated 0 in this information, then illustrate that the message in this queue has been scheduled; When being designated 0 in last information, and be designated 1 in this information, then illustrate in this queue and stored message, can be scheduled.Meanwhile, when the link between virtual scheduling device at the corresponding levels and subordinate's virtual scheduling device or queue is all in unactivated state, the Link State of itself and higher level's virtual scheduling device is changed to inactive.
Step 302, reception message, and be stored into corresponding queue;
Concrete, after receiving message, this message is stored into corresponding queue according to the classification of configuration, and wait is scheduled.Wherein, the classification of configuration can comprise: the class of service of message, the type of message, the source address etc. that message is corresponding, such as by the video traffic packet storage of user A in first queue, by the audio service packet storage of user A in the 3rd queue, the word service message of user B is stored in the tenth queue.
After step 303, the request of reception dispatching message, according to the configuration parameter stored, obtain the queue of stored messages;
Concrete, according to the configuration parameter preserved, from first order virtual scheduling device, obtain the next stage virtual scheduling device with linking relationship step by step, until obtain the physical queue of the needs scheduling with linking relationship, the numbering of this queue is sent to its higher level's virtual scheduling device.Preferably, the information sending this queue number has flag, is represented the validity of this information by this flag.
Step 304, according to the link paths of queue to message output port, the message in scheduling queue.Concrete, the quantity of schedules message and length can be configured in advance, such as, can dispatch a certain amount of message at every turn, and the byte number of this message can not exceed predetermined value.
By foregoing description, can find out, the method for the queue scheduling using the embodiment of the present invention to provide, by pre-configured link paths, the message in direct scheduling queue also exports, and improves the efficiency of schedules message, and saves storage resources.And scheduling sum of series scheduling structure can flexible configuration, also improves the resource utilization of scheduler.
Accordingly, the embodiment of the present invention additionally provides a kind of device of queue scheduling, as shown in Figure 4, comprising:
Queue acquiring unit 401, after receiving dispatching message request, according to the configuration parameter stored, obtains the queue storing described message;
Scheduling unit 402, for according to the link paths of described queue to message output port, the message in execution cost queue.
Preferably, this device also comprises: packet storage unit 403, after receiving message, described message is stored into corresponding queue according to the classification of configuration.
Preferably, this device also comprises:
Link establishment unit 404, for according to configuration parameter information, set up the linking relationship of each queue and higher level's virtual scheduling device, the linking relationship between virtual scheduling device at different levels, and the linking relationship of first order virtual scheduling device and message output port, form link paths;
Configuration parameter memory cell 405, for preserving the described configuration parameter of described linking relationship.
Preferably, above-mentioned scheduling unit 402, after receiving scheduling message request, according to described configuration parameter, from first order virtual scheduling device, obtain the next stage virtual scheduling device with linking relationship step by step, until obtain the queue of the needs scheduling with linking relationship.
Above-mentioned virtual scheduling device in the embodiment of the present invention can comprise: Weighted Round Robin scheduler, weighted-fair-queuing scheduler, absolute priority algorithmic dispatching device etc.
By foregoing description, can find out, the method and apparatus of the queue scheduling using the embodiment of the present invention to provide, by pre-configured link paths, the message in direct scheduling queue also exports, and improves the efficiency of schedules message, and saves storage resources.And scheduling sum of series scheduling structure can flexible configuration, also improves the resource utilization of scheduler.
Obviously, those skilled in the art can carry out various change and modification to the present invention and not depart from the spirit and scope of the present invention.Like this, if these amendments of the present invention and modification belong within the scope of the claims in the present invention and equivalent technologies thereof, then the present invention is also intended to comprise these change and modification.