Traffic scheduling method and device, and electronic device
By adopting a credit value adjustment rule in RR scheduling, channels with traffic shaping enabled are scheduled sequentially according to their credit values. This solves the problem of uneven traffic distribution in existing RR scheduling, achieving uniform traffic distribution and improved network stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SUZHOU CENTEC COMM CO LTD
- Filing Date
- 2026-04-30
- Publication Date
- 2026-07-10
AI Technical Summary
In the existing RR scheduling mechanism, when some channels are configured with ignore shape, some channels with traffic shaping enabled cannot distribute traffic evenly, resulting in uneven distribution.
A credit value adjustment rule is adopted, and channels with traffic shaping enabled are scheduled in order of credit value. By reducing the credit value of the target channel and increasing the credit value of other channels, the channels in the shaping group are evenly scheduled.
It alleviates the problem of uneven traffic distribution after ignoring the shaping channel in the RR scheduling mechanism, realizes uniform traffic distribution, and improves the stability and fairness of network transmission.
Smart Images

Figure CN122372498A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and more specifically, to a traffic scheduling method, apparatus, and electronic device. Background Technology
[0002] In live network applications, when multiple channels are scheduled using Round Robin (RR), these channels are shaped. According to the principle of RR scheduling, these channels should be equally distributed among the traffic resources that are shaped.
[0003] However, when some channels are configured with ignore shape and others with channel shape enabled, channels with channel shape enabled cannot be scheduled if the shaping condition is not met; only channels with ignore shape can be scheduled. When the shaping condition is met, channels with channel shape enabled can be scheduled. Channels with channel shape enabled are sorted in a fixed order after sorting, and the shaping condition is checked and scheduled according to this fixed order each time.
[0004] Based on the theory of Restricted Roaming (RR) scheduling, channels with enabled channel shapes should have their bandwidth evenly distributed across that shape. Channels configured with ignored shapes have their traffic unaffected by the shape and are scheduled whenever possible. However, in this scenario, the shaping condition might not be met before all channels with enabled shapes have been scheduled. When the shaping condition is not met, channels configured with ignored shapes will be scheduled, and the remaining channels with enabled shapes will not be scheduled. If the shaping condition is met again later, scheduling will begin from the first channel in the fixed order. Therefore, when RR schedules members with partial shapes and partial ignored shapes, uneven traffic distribution among the shaped members may occur. Summary of the Invention
[0005] This application provides a traffic scheduling method, apparatus, electronic device, and readable storage medium, which can alleviate the problem that the old RR scheduling mechanism always prioritizes scheduling the shape channel immediately following the ignored shape channel after scheduling the traffic of the ignored shape channel, resulting in multiple shape channels not being able to distribute traffic evenly.
[0006] The embodiments of this application can be implemented as follows: In a first aspect, embodiments of this application provide a traffic scheduling method, the method comprising: From the shaping group and the non-shaping group, one group is determined as the target channel group to be scheduled. The non-shaping group is scheduled using a round-robin scheduling method, and all channels in the shaping group are channels with traffic shaping enabled. When the target channel group is a shaping group, the first target channel is determined from the shaping group based on the filtering rule of using the channel corresponding to the highest credit value as the target channel, and it is determined whether the preset shaping conditions are met. If the conditions are met, the traffic of the first target channel is scheduled, the credit values of the first target channel and other channels are adjusted according to the preset credit value adjustment rules, and the shaping group is scheduled again. The preset credit value adjustment rules indicate that the credit value of the target channel is reduced and the credit value of other channels is increased. If all channels in the shaping group have been scheduled at least once or if the preset shaping conditions are not met, the target channel group is redefined.
[0007] Secondly, embodiments of this application provide a traffic scheduling device, the device comprising: The determination module is used to determine a group from the shaped group and the non-shaped group as the target channel group to be scheduled. The non-shaped group is scheduled using a round-robin scheduling method, and each channel in the shaped group is a channel with traffic shaping enabled. The scheduling module is used to determine the first target channel from the shaping group when the target channel group is an integer group, based on the filtering rule of using the channel corresponding to the maximum credit value as the target channel, and to determine whether the preset shaping conditions are met. The scheduling module is further configured to, when conditions are met, schedule the traffic of the first target channel, adjust the credit values of the first target channel and other channels according to a preset credit value adjustment rule, and continue to schedule the shaping group, wherein the preset credit value adjustment rule indicates to decrease the credit value of the target channel and increase the credit value of other channels; The determining module is further configured to redetermine the target channel group if all channels in the shaping group have been scheduled at least once or if the preset shaping conditions are not met.
[0008] Thirdly, embodiments of this application provide an electronic device, including a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor can execute the machine-executable instructions to implement the traffic scheduling method described in the foregoing embodiments.
[0009] Fourthly, embodiments of this application provide a readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the traffic scheduling method as described in the foregoing embodiments.
[0010] The traffic scheduling method, apparatus, electronic device, and readable storage medium provided in this application first determine one of two channel groups—a shaping group and a non-shaping group—as the target channel group to be scheduled. The non-shaping group is scheduled using a round-robin method, while all channels in the shaping group have traffic shaping enabled. When the determined target channel group is a shaping group, a channel is selected as the first target channel based on a filtering rule that uses the channel with the highest credit value as the target channel, and it is determined whether a preset shaping condition is met. If the preset shaping condition is met, the traffic of the first target channel is scheduled, and the credit values of the first target channel and other first target channels are adjusted according to a preset credit value adjustment rule. The first target channel is then determined again, and it is determined whether the shaping condition is met again, to continue scheduling the shaping group. If all channels in the shaping group have been scheduled at least once or the preset shaping condition is not met, the target channel group is re-determined. The preset credit value adjustment rule indicates decreasing the credit value of the target channel and increasing the credit values of other channels. In this way, when some members of the RR scheduling mechanism have traffic shaping enabled and others have not, the channels with traffic shaping enabled are scheduled in order of credit value. This alleviates the problem that the old RR scheduling mechanism always prioritizes scheduling the shape channel immediately following the member after scheduling the traffic of the ignored shape channel, which leads to multiple shape channels not being able to distribute traffic evenly. Attached Figure Description
[0011] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 This is one of the schematic diagrams of normal RR scheduling; Figure 2 This is the second schematic diagram of normal RR scheduling; Figure 3 A schematic diagram of the current RR scheduling when some members have ignored shape and some members have shaped shape; Figure 4 A block diagram illustrating an electronic device provided in an embodiment of this application; Figure 5 One of the flowcharts of the traffic scheduling method provided in the embodiments of this application; Figure 6 for Figure 5 A flowchart illustrating the sub-steps included in step S120; Figure 7 for Figure 5 A flowchart illustrating the sub-steps included in step S140; Figure 8 A second schematic flowchart illustrating the traffic scheduling method provided in this application embodiment; Figure 9 The third flowchart illustrating the traffic scheduling method provided in this application embodiment; Figure 10 The fourth flowchart illustrating the traffic scheduling method provided in this application embodiment; Figure 11 This is a traffic scheduling diagram provided in the embodiments of this application when none of the members have traffic shaping set; Figure 12 A schematic diagram of traffic scheduling when some members are ignored or partially shaped, provided for embodiments of this application; Figure 13 A schematic diagram illustrating the execution process of the traffic scheduling method provided in the embodiments of this application; Figure 14 This is a block diagram of a traffic scheduling device provided in an embodiment of this application.
[0013] Icons: 100 - Electronic device; 110 - Memory; 120 - Processor; 130 - Communication unit; 200 - Traffic scheduling device; 210 - Determination module; 220 - Scheduling module. Detailed Implementation
[0014] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0015] Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0016] It should be noted that relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0017] In a live network, data traffic is highly variable. When data traffic increases to the point where it exceeds the egress transmission capacity, packets need to be buffered and queued for transmission in forwarding devices (such as switches). In severe cases, packets that need to be forwarded may be dropped because the switch buffer is full. This phenomenon of data traffic exceeding the egress forwarding capacity is usually called congestion.
[0018] In real-world applications, traffic congestion often involves allocating limited resources to multiple requesting entities. For example, in a live network, multiple traffic streams might originate from different ingress channels but are forwarded from the same egress point. If the traffic exceeds the egress bandwidth, congestion will occur, requiring a reasonable allocation of bandwidth resources to the ingress traffic. This process of allocating resources to requesting entities is typically called scheduling.
[0019] The core of scheduling is to solve the problem of "how to allocate limited resources to multiple demanding objects", which usually needs to achieve one or more of the following goals: 1. Efficiency: Maximize resource utilization (such as CPU, bandwidth, equipment, etc.) and reduce idle time; 2. Fairness: Ensure that each object (such as process, user, task) has a reasonable chance to obtain resources and avoid "starvation" (not being able to obtain resources for a long time); 3. Responsiveness: Reduce the waiting time for tasks or requests and improve the user experience (such as interactive systems and real-time applications). 4. Priority: Prioritize important or urgent objects (such as critical tasks and high-priority requests).
[0020] RR (Round Robin) scheduling is a basic and classic resource allocation and task scheduling algorithm. Its core feature is "allocating resources in a round-robin and fairly", ensuring that each object gets an equal opportunity to use resources in sequence.
[0021] The essence of RR scheduling is to allocate resources sequentially in a cyclical manner. Each object (such as a process, request, data stream, etc.) receives the same share of resources (such as time slice, number of processing times, bandwidth quota) in each scheduling round, with no priority difference, emphasizing "equal opportunity".
[0022] The following is combined Figure 1 An example is given to illustrate RR scheduling. Figure 1 This describes the case of performing RR scheduling for three different data streams, A, B, and C.
[0023] 1. Scheduling object and queue initialization.
[0024] Objects: The traffic to be scheduled consists of 3 independent data streams, labeled A (e.g., ordinary web page traffic), B (e.g., download traffic), and C (e.g., chat messages).
[0025] Queues: The RR scheduler arranges all active data streams into a ready queue according to the "first-in, first-out" rule (initial order: A - B - C).
[0026] 2. Resource allocation in rotation.
[0027] Fixed share allocation: The scheduler allocates the same share of resources to each data stream (in a traffic scenario, this can be understood as "bandwidth share allocated per transaction" or "processing time"). Here, we assume that the share allocated each time is "1 unit of bandwidth".
[0028] Rotate in sequence: <1> The scheduler first allocates one unit of bandwidth to A at the head of the queue. After A has finished using it, it is moved to the tail of the queue (the queue becomes: B - C - A). <2> The scheduler first allocates one unit of bandwidth to B. After B finishes using it, it is moved to the end of the queue (the queue becomes: C - A - B). <3> The scheduler first allocates one unit of bandwidth to C. After C finishes using it, it is moved to the end of the queue (the queue becomes: A - B - C). Repeated process: The above process is repeated, and each data stream takes turns to obtain resources in sequence until the data stream ends (e.g., after the traffic of A is completed, it is removed from the queue, and the subsequent scheduling order becomes B - C - B – C...).
[0029] It is easy to see that the RR scheduling order strictly follows the queue rotation, and the resource allocation ratio is fixed (here it is 1:1:1), which makes it easy to understand and track the traffic allocation.
[0030] Traffic shaping is a network traffic management strategy that proactively adjusts the output rate of traffic. When the packet transmission rate is too fast, traffic shaping first buffers the traffic in a buffer, and then, under the control of a token bucket, evenly distributes these buffered packets. The result is a smooth packet output rate, which effectively avoids network congestion and improves network transmission stability.
[0031] In live network applications, when multiple channels are used for RR scheduling, these channels are shaped. According to the principle of RR scheduling, these channels should be equally distributed among the traffic resources to be shaped.
[0032] The following example uses a 4-channel traffic model, combined with... Figure 2 and Figure 3 This section explains RR scheduling and traffic shape.
[0033] During normal RR scheduling, such as Figure 2 As shown, the traffic AD is evenly scheduled across the four channels, with a traffic ratio of 1:1:1:1, which meets expectations.
[0034] However, when a channel is configured with an ignore shape (taking channel A as an example), if channel shaping is enabled, and the channel BD (Bandwidth Division Unit) doesn't meet the desired channel shape, channel BD cannot adjust its bandwidth and can only schedule channel A. When the channel shaping is satisfied again, channel BD can resume scheduling. Based on the theory of Reverse Routing (RR), channel BD should evenly distribute the bandwidth of the shape and schedule it uniformly. Traffic to channel A should be unaffected by the shape and should be scheduled whenever possible.
[0035] According to the RR scheduling mechanism, the following possibilities will occur with equal probability.
[0036] 1. For example Figure 3 As shown in (a), after scheduling channel B, the shape resources are not satisfied, so it can only be scheduled to A again.
[0037] 2. For example Figure 3 As shown in (b), after scheduling channel C, the shape resource is not satisfied, so it can only be scheduled to A again.
[0038] 3. For example Figure 3 As shown in (c), after scheduling channel D, the shape resource is not satisfied, so it can only be scheduled to A again.
[0039] In summary, only in scenario 3, where traffic is sequentially scheduled for channels B, C, and D, can the expected fair scheduling result of channels B-D be achieved. However, overall, channel BD ultimately cannot evenly distribute bandwidth resources across the shapes. This is because channel A always has a relative scheduling opportunity, and the RR scheduling of channel BD is interfered with by channel A, resulting in a defect. In other words, currently, when RR scheduling partially shapes and partially ignores shapes, there is an issue of uneven traffic distribution among the shaped members.
[0040] To address the above situation, embodiments of this application provide a traffic scheduling method, apparatus, electronic device, and readable storage medium. When some members of the RR scheduling mechanism have traffic shaping enabled and others have not, the channels with enabled traffic shaping are scheduled sequentially according to their credit values. This alleviates the problem that the old RR scheduling mechanism always prioritizes scheduling the shape channel immediately following the member after scheduling the traffic of the ignored shape channel, resulting in multiple shape channels not being able to distribute traffic evenly.
[0041] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0042] Please refer to Figure 4 , Figure 4 This is a block diagram of an electronic device 100 provided in an embodiment of this application. The electronic device 100 may be, but is not limited to, a computer, server, switch, etc. The electronic device 100 includes a memory 110, a processor 120, and a communication unit 130. The memory 110, processor 120, and communication unit 130 are electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.
[0043] The memory 110 is used to store programs or data. The memory 110 may be, but is not limited to, random access memory (RAM), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc.
[0044] The processor 120 is used to read / write data or programs stored in the memory 110 and execute corresponding functions. For example, the memory 110 stores a traffic scheduling device 200, which includes at least one software function module that can be stored in the memory 110 in the form of software or firmware. The processor 120 executes various functional applications and data processing by running the software programs and modules stored in the memory 110, such as the traffic scheduling device 200 in the embodiments of this application, thereby implementing the traffic scheduling method in the embodiments of this application.
[0045] The communication unit 130 is used to establish a communication connection between the electronic device 100 and other communication terminals through the network, and to send and receive data through the network.
[0046] It should be understood that, Figure 4 The structure shown is only a schematic diagram of the electronic device 100. The electronic device 100 may also include components that are larger than... Figure 4 The more or fewer components shown, or having the same Figure 4 The different configurations shown. Figure 4 The components shown can be implemented using hardware, software, or a combination thereof.
[0047] Please refer to Figure 5 , Figure 5 This is one of the flowcharts illustrating the traffic scheduling method provided in this application. The method can be applied to the aforementioned electronic device. This method can be applied to Ethernet environments with high requirements for data transmission performance and stability, such as data center networks. The specific flow of the traffic scheduling method is described in detail below. In this embodiment, the method may include steps S110 to S140.
[0048] Step S110: Select one group from the shaped group and the non-shaped group as the target channel group to be scheduled.
[0049] In this embodiment, all channels in the shaping group have enabled traffic shaping, meaning each channel in the shaping group has channel shape enabled, or shapEn. The non-shaping group is scheduled using a round-robin method. Channels in both the shaping and non-shaping groups can be channels with traffic to send; if no channel has traffic to send, both the shaping and non-shaping groups are empty.
[0050] One channel group can be selected from the two channel groups, the shaped group and the non-shaped group, as the target channel group to be scheduled. The target channel group to be scheduled is the channel group that will be targeted for subsequent scheduling processing. The specific method for determining the target channel group can be determined according to actual needs and is not specifically limited here. For example, initially, if there is traffic to be scheduled in both channel groups, one group can be randomly selected as the target channel group; otherwise, the target channel group can be determined based on the set rules.
[0051] Step S120: When the target channel group is a shaping group, the first target channel is determined from the shaping group based on the filtering rule of taking the channel corresponding to the maximum credit value as the target channel, and it is determined whether the preset shaping conditions are met.
[0052] Step S130: If the conditions are met, schedule the traffic of the first target channel, adjust the credit values of the first target channel and the first other channels according to the preset credit value adjustment rules, and continue to schedule the shaping group.
[0053] Step S140: If all channels in the shaping group have been scheduled at least once or the preset shaping conditions are not met, the target channel group is redefined.
[0054] When the target channel group is a shaping group, based on the filtering rule of using the channel corresponding to the highest credit value as the target channel, a channel can be determined from the shaping group as the first target channel for subsequent scheduling according to the credit values of each channel in the shaping group. It is also determined whether the current situation meets the preset shaping conditions. The specific method for determining whether the preset shaping conditions are met can be determined based on actual needs and is not specifically limited here. For example, it could be determined whether the current network availability meets the preset shaping conditions.
[0055] If the preset shaping conditions are met, the traffic of the first target channel is scheduled, and the credit value of the first target channel and the credit values of the first other channels are adjusted according to a preset credit value adjustment rule. The preset credit value adjustment rule instructs that the credit value of the target channel be decreased and the credit values of the other channels be increased. That is, when processing based on the preset credit value adjustment rule, the credit value of the first target channel is decreased and the credit values of the first other channels are increased. The first other channels to be adjusted include all channels in the shaping group other than the first target channel.
[0056] After scheduling the traffic of the first target channel and completing the credit value scheduling, one channel scheduling cycle can be considered complete. Next, it can be determined whether the channels in the shaping group have been scheduled at least once in this round of scheduling for that shaping group. If not, the first target channel is re-determined from the shaping group based on the filtering rule of using the channel corresponding to the highest credit value as the target channel. It is then determined whether the preset shaping conditions are met, and if so, the traffic of the newly determined first target channel is scheduled, and the credit values of the new first target channel and the new first other channels are adjusted. This process is repeated for the shaping group until all channels in the shaping group have been scheduled at least once in this round of scheduling for that shaping group or the preset shaping conditions are not met. At this point, a new target channel group is determined. If the determined target channel group is a shaping group, the above scheduling for the shaping group is executed again; if the determined target channel group is a non-shading group, round-robin scheduling can be performed for the non-shading group.
[0057] When performing polling scheduling for non-shape groups, the conventional polling scheduling method can be used, or the scheduling can be similar to that for shape groups, with channels in the non-shape groups being scheduled based on credit values.
[0058] In this way, when some members of the RR scheduling mechanism have traffic shaping enabled and others have not, the channels with traffic shaping enabled are scheduled in order of credit value. This alleviates the problem that the old RR scheduling mechanism always prioritizes scheduling the shape channel immediately following the member after scheduling the traffic of the ignored shape channel, which leads to multiple shape channels not being able to distribute traffic evenly.
[0059] In this embodiment, when determining the target channel group, it can first be analyzed whether both channel groups include channels for which traffic needs to be scheduled. If only one channel group includes a channel for which traffic needs to be scheduled, then that channel group can be used as the target channel group. If both channel groups include channels for which traffic needs to be scheduled, the two channel groups can be used alternately as the target channel groups. Alternatively, if the credit values of channels in the non-integer group are adjusted according to the preset credit value adjustment rule during non-integer group scheduling, the group with the highest corresponding credit value can be used as the target channel group. That is, the credit values of the channels included in the two channel groups are compared, and the channel group with the highest credit value is used as the target channel group. It is worth noting that the above method for determining the target channel group is only an example, and the specific method can be determined according to actual needs.
[0060] When the target channel group is identified as a shaping group, if the channels in the shaping group have not been scheduled at least once in the current scheduling for the shaping group, a channel can be selected from the shaping group as the first target channel according to the screening rule of using the channel corresponding to the highest credit value as the target channel.
[0061] Optionally, as a possible implementation, when a channel in the shaping group is scheduled, when determining a new first target channel, the credit values of the channels that have not yet been scheduled in the current round of scheduling for the shaping group can be compared, and the channel corresponding to the highest credit value can be used as the newly determined first target channel. In this way, each channel can be scheduled once in turn according to its credit value in descending order during a round of scheduling for the shaping group.
[0062] Alternatively, as another possible implementation, the filtering rule instructs the channel corresponding to the highest credit value in the target channel group to be the target channel. If the channels in the shaping group are not all scheduled at least once in the current scheduling for that shaping group, in each round of scheduling for that shaping group, the credit values of all channels in the shaping group (including channels that have been scheduled and those that haven't) are compared, and the channel corresponding to the highest credit value is selected as the first target channel. This ensures that the channels in the shaping group are evenly scheduled.
[0063] Once a first target channel is identified and the preset shaping conditions are met, traffic in the first target channel can be scheduled, and credit values can be adjusted. Optionally, as a possible implementation, this can be achieved through... Figure 6 Adjust your credit score as shown. Please refer to the instructions below. Figure 6 , Figure 6 for Figure 5A flowchart illustrating the sub-steps included in step S120. In this embodiment, step S120 may include sub-steps S121 to S124.
[0064] Sub-step S121: Determine whether the current credit value of the first target channel is the initial credit value.
[0065] If the current credit value is the initial credit value, execute sub-step S122.
[0066] Sub-step S122: Use the initial credit value as the current credit value after the first target channel is updated.
[0067] If the current credit value is not the initial credit value, proceed to sub-step S123.
[0068] Sub-step S123: Subtract the preset unit value from the current credit value and use the result as the updated current credit value of the first target channel.
[0069] Sub-step S124: The sum of the credit value of each first other channel and the preset unit value is used as the updated credit value of each first other channel.
[0070] In this embodiment, it is first determined whether the current credit value of the first target channel is the initial credit value. The initial credit value is the credit value of a channel when it is first added to the channel group, that is, the credit value set when a channel first has traffic to be scheduled. If the current credit value of the first target channel is the initial credit value, then the current credit value of the first target channel is not reduced, and the current credit value of the first target channel is directly used as the updated current credit value of the first target channel. If the current credit value of the first target channel is not the initial credit value, then the current credit value of the first target channel is subtracted from the preset unit value, and the result is used as the updated current credit value of the first target channel. The specific values of the initial credit value and the preset unit value can be set according to actual needs. For example, the initial credit value is 0 and the preset unit value is 1. In this way, even if new members are added, the credit value is easier to maintain, which facilitates scheduling for individual channel groups based on the credit value; and since there is no overdraft value, it is easy to maintain.
[0071] Alternatively, for each first other channel, the credit value of that first other channel can be added to a preset unit value, and the sum can be used as the updated credit value for that first other channel. The first other channels may include channels in the integer group other than the first target channel. It is understood that updating the credit value of the first other channel and updating the credit value of the first target channel can be performed in parallel or sequentially; no specific limitation is made on the execution order here.
[0072] One possible implementation is that, when the non-integer group is scheduled, it is also scheduled based on credit value, and the credit value of each channel in the non-integer group is adjusted according to the preset credit value adjustment rule. If the target channel group is determined based on the group with the highest credit value among the two groups, the first other channel may include channels in the shape group other than the first target channel, as well as channels in the non-integer group. This allows the shape group to have the opportunity to be scheduled.
[0073] After scheduling one channel in the shaping group is completed, it can be determined whether all channels in the shaping group have been scheduled at least once in this round of scheduling for the shaping group. If not, step S120 is executed again. If yes, it is determined that the scheduling for the shaping group in this round has been completed.
[0074] Optionally, if it is determined that the preset shaping conditions are not met, the current first target channel can be left unscheduled. Leaving a channel unscheduled can also be considered as completing one round of scheduling for that channel. After a scheduling period ends, step S120 can be executed again until all channels in the shaping group have been scheduled at least once in this round of scheduling for the shaping group. At this point, it can be determined that one round of scheduling for the shaping group is complete. In this method, when a new first target channel is determined after a scheduling period ends, the channel that was determined to be the first target channel in this round of scheduling for the shaping group as not meeting the preset shaping conditions can be excluded from the list of candidates for the first target channel. That is, the newly determined first target channel is not the channel that was determined to be the first target channel when the preset shaping conditions were not met.
[0075] As another possible implementation, the filtering rule instructs the channel with the highest credit value in the target channel group to be the target channel. If the preset shaping conditions are not met, the channel can be left unscheduled based on the number of channels in the current shaping group that have traffic but are not scheduled. In this way, it can be considered that the channels in the current shaping group that have traffic but are not scheduled have also been scheduled once, and the credit values of the first target channel and the first other channels remain unchanged, thus determining that the current shaping group scheduling has ended. This saves judgment resources.
[0076] When the shaping group is determined to be completed, the target channel group is redefined. Optionally, if the shaping group has been completed but there are cases during the scheduling process that do not meet the preset shaping conditions, another non-empty channel group (i.e., a non-empty non-shaping group) can be directly used as the redefined target channel group.
[0077] Optionally, when the credit values of each channel in the non-shaping group are adjusted according to the preset credit value adjustment rules, if the shaping group has finished scheduling but there are cases during the scheduling process that do not meet the preset shaping conditions, it can also be adjusted through... Figure 7 The target channel group is redefined as shown in the above scenario.
[0078] Please refer to Figure 7 , Figure 7 for Figure 5 A flowchart illustrating the sub-steps included in step S140. In this embodiment, step S140 may include sub-steps S141 to S143.
[0079] Sub-step S141: When both the shaped group and the non-shaped group contain channels for traffic to be scheduled, determine the maximum credit value among the credit values corresponding to the shaped group and the non-shaped group, and use the group corresponding to the maximum credit value as the redefined target channel group.
[0080] Sub-step S142: If the newly determined target channel group is a shaping group, determine whether the preset shaping conditions are met.
[0081] In sub-step S143, if the preset shaping conditions are not met, the channel with traffic to be scheduled in the shaping group is given a turn-off, and the non-shaping group is used as the target channel group to be redefined.
[0082] In this embodiment, after the shaping group is determined to be fully scheduled due to the failure to meet the preset shaping conditions, it can be analyzed whether both channels in the shaping group and the non-shaping group have traffic to be scheduled. If so, the credit values of all channels in the two channel groups are compared to determine the highest credit value, and the channel group containing the highest credit value is designated as the newly determined target channel group. If the newly determined target channel group is a non-shaping group, round-robin scheduling is performed on the channels in the non-shaping group. If the newly determined target channel group is a shaping group, a channel can be selected from the shaping group as the first target channel based on the filtering rules, and it is determined whether the preset shaping conditions are met. If the preset shaping conditions are met, traffic scheduling and credit value updates are performed on the first target channel, i.e., steps S120 to S130 are executed. If the preset shaping conditions are not met, scheduling is carried out in a round-robin manner based on the number of channels with traffic to be scheduled in the shaping group, and the non-shaping group is directly designated as the newly determined target channel group.
[0083] Please refer to Figure 8 , Figure 8 This is a second schematic flowchart illustrating the traffic scheduling method provided in this application embodiment. In this embodiment, the method may further include steps S151 to S153.
[0084] Step S151: When the target channel group is a non-integer group, the second target channel is determined from the non-integer group based on the filtering rule of using the channel corresponding to the maximum credit value as the target channel.
[0085] Step S152: Schedule the traffic of the second target channel, adjust the credit values of the second target channel and other second channels according to the preset credit value adjustment rules, and continue to schedule the non-integer group.
[0086] The credit value adjustment method for the second target channel is the same as that for the first target channel, and the credit value adjustment method for the other second channels is the same as that for the other second channels.
[0087] Step S153: If all channels in the non-integer group have been scheduled at least once, determine that the current round of non-integer group scheduling is over, and re-determine the target channel group.
[0088] In this embodiment, when the target channel group is a non-integer group, the processing method is similar to that of the integer group. Based on the filtering rule of using the channel with the highest credit value as the target channel, the credit values of the channels in the non-integer group are compared to determine the highest credit value among the channels in the non-integer group, and the channel corresponding to the highest credit value is selected as the second target channel. Then, based on the preset credit value adjustment rule, the credit value of the second target channel and the credit values of the other second channels are adjusted, i.e., the credit value of the second target channel is increased, and the credit values of the other second channels are decreased. Next, it is determined whether all channels in the non-integer group have been scheduled at least once in this round of scheduling for the non-integer group. If so, the scheduling of the non-integer group in this round is considered complete; otherwise, channels are selected again for scheduling based on the filtering rule. In this way, a similar method to the credit value-based scheduling method for the integer group can be used to schedule the non-integer group, without the need for setting a separate scheduling method, resulting in good compatibility.
[0089] As one possible implementation, each first other channel includes channels in the shaped group other than the first target channel and channels in the non-shaped group, and each second other channel includes channels in the non-shaped group other than the second target channel and channels in the shaped group. Thus, the shaped group and the non-shaped group can be scheduled based on approximately the same logic.
[0090] By reducing the credit value of the target channel and increasing the credit values of all channels in the two channel groups other than the target channel, when both the shaped group and the non-shaped group contain channels with traffic to be scheduled, the maximum credit value among the credit values corresponding to the two channel groups (shaped and non-shaped) can be determined, and the group corresponding to the maximum credit value can be used as the target channel group. This allows the shaped group to be scheduled as soon as possible. When there is no traffic to be scheduled in the shaped group but there is traffic to be scheduled in the non-shaped group, the non-shaped group can be used as the target channel group. That is, it is equivalent to executing steps S151 to S152 above when all members are set to shapEn.
[0091] Please refer to Figure 9 , Figure 9 This is a third schematic flowchart illustrating the traffic scheduling method provided in this application embodiment. In this embodiment, the method may further include steps S161 to S162.
[0092] Step S161: After completing one channel scheduling, determine whether there are any channels to be added to the channel group based on credit value scheduling.
[0093] Step S162: If a channel needs to be added to a channel group based on credit value scheduling, the credit value of each channel in the channel group to be added is reduced by the minimum credit value in the corresponding credit value of the channel group to update the credit value of each channel in the channel group, and the initial credit value is used as the credit value of the channel to be added.
[0094] In this embodiment, completing traffic scheduling for a single channel or scheduling a single channel to be idle can both be considered as completing a channel scheduling cycle, except that the former is valid scheduling and the latter is invalid scheduling. After completing a channel scheduling cycle, it can be determined whether any channel needs to be added to the channel group based on credit value scheduling. For example, in the shaping group and the non-shaping group, if only the shaping group schedules based on credit value, then after completing a channel scheduling cycle, it is determined whether any channel needs to be added to the shaping group, that is, whether any previously idle channels with traffic shaping enabled now have traffic that needs to be forwarded; if both the shaping group and the non-shaping group schedule based on credit value, then after completing a channel scheduling cycle, it is determined whether any previously idle channels now have traffic that needs to be forwarded.
[0095] If a channel wants to join a channel group based on credit value scheduling, the minimum credit value among all channels in the group is first determined. This minimum credit value is then subtracted from the credit value of each channel in the group, and the result is used as the updated credit value for each channel. The initial credit value is then used as the credit value of the channel to be added to the credit value-based scheduling group. This ensures that both new and old members have scheduling opportunities in the future.
[0096] For example, in a channel group that is scheduled based on credit value, there are channels B, C, and D. If channel A is to be added to the channel group, the credit values of channels B, C, and D are respectively reduced by the minimum credit value of channels B, C, and D to update the credit values of channels B, C, and D, and the initial credit value is used as the credit value of channel A.
[0097] Please refer to Figure 10 , Figure 10 This is a fourth schematic flowchart illustrating the traffic scheduling method provided in this embodiment. In this embodiment, the method may further include steps S164 to S165.
[0098] Step S164: After completing one channel scheduling, determine whether any channels need to exit the channel group based on credit value scheduling.
[0099] Step S165: If a channel needs to exit the channel group based on credit value scheduling, then the channel is removed from the corresponding channel group, and the credit value of each channel in the channel group after the channel exits is reduced by the minimum credit value in the corresponding channel group to update the credit value of each remaining channel in the channel group.
[0100] In this embodiment, when a channel in a channel group scheduled based on credit value changes from having traffic to having no traffic, it is considered that the channel should leave the channel group. After completing one channel scheduling, it can be determined whether any channel should leave the channel group scheduled based on credit value. If so, it is removed from the corresponding channel group. Furthermore, for each remaining channel in the channel group after the removed channel, the minimum credit value among the remaining channels is determined, and the minimum credit value is subtracted from the credit value of each remaining channel. The result is used as the credit value of the corresponding channel to complete the credit value update for each remaining channel. The method for removing a channel from the corresponding channel group can be determined based on actual needs. For example, the credit value of the channel can be modified to an invalid identifier (e.g., N), or when using channel group information to record the identifiers of channels in the channel group, the identifier of the channel can be deleted from the corresponding channel group information. This facilitates the rapid identification of the channel corresponding to the maximum credit value from the channel group later.
[0101] For example, in a channel group that is scheduled based on credit value, there are channels B, C, and D. If channel B wants to leave the channel group, then channel B will be removed from the channel group, and the credit values of channels C and D will be reduced by the minimum credit value in channels C and D respectively, thus completing the credit value update of channels C and D.
[0102] The method provided in this application initializes the same credit base (i.e., initial credit value) for each member scheduled by Redirect (RR). The credit of scheduled members decreases in fixed units, and remains at the base when it reaches the initial value. The credit of unscheduled members increases in fixed units. The effective state (shapEn) of the shape members is recorded. Members with an inactive shapEn share a credit group, and members with an active shapEn share a credit group. Members within a credit group are scheduled sequentially according to their credit values, ultimately achieving uniform scheduling for both shape groups and non-shape groups. This solves the problem of uneven traffic distribution for shape members in scenarios where some RR scheduling members are shaped and some are ignored.
[0103] The following is combined Figure 11 and Figure 12The above traffic scheduling method will be illustrated with an example.
[0104] Please refer to Figure 11 , Figure 11 This is a traffic scheduling diagram illustrating the scenario where none of the members in this application's embodiments have traffic shaping set. Since none of the members have `shapEn` set, meaning none of the members have joined the shape group, the shape group can be considered empty. The credit-based RR scheduling method when none of the members have joined the shape group can be implemented as follows: Figure 11 As shown in the example below, the initial credit value (also known as the credit base) is 0, the preset unit value is 1, and initially there is traffic to be scheduled in channels A, B, C, and D, with the queue order being A, B, C, and D; members are scheduled in order according to their credit values.
[0105] <1> Initialize the credit value of all members to 0. At this point, the credit values are equal. Based on the queue order, channel A will be scheduled.
[0106] <2> At time T1, traffic from channel A is scheduled, and the credit value of channel A decreases by a fixed unit. Since it is already 0, it remains unchanged. The credit values of channel BD are all increased by a fixed unit of 1, and the credit values of channel BD are all updated to 1. Based on the credit value status of channel AD, channel B will be scheduled in the next round.
[0107] <3> At time T2, traffic from channel B is scheduled, and the credit value of channel B decreases to 0 in fixed units; the credit values of channels A, C, and D increase by a fixed unit of 1. After the update, the credit value of channel A is 1, and the credit values of channels C and D are both 2; based on the credit values of channels AD, channel C will be scheduled in the next round.
[0108] <4> At time T3, traffic in channel C is scheduled, and the credit value of channel C decreases by a fixed unit to 1; the credit values of channels A, B, and D increase by a fixed unit of 1. After the update, the credit value of channel A is 2, the credit value of channel B is 1, and the credit value of channel D is 3. Based on the credit values of channels AD, channel D will be scheduled in the next round.
[0109] <5> At time T4, traffic in channel D is scheduled, and the credit value of channel D is reduced to 2 in a fixed unit. The credit values of channels A, B, and C are increased by a fixed unit of 1. After the update, the credit value of channel A is 3, and the credit values of channels B and C are both 2. Based on the credit values of channels AD, channel A will be scheduled in the next round.
[0110] <6> At time T5, traffic from channel A is scheduled, and the credit value of channel A decreases by a fixed unit to 2; the credit values of channels B, C, and D increase by a fixed unit of 1, all updating to 3; based on the credit values of channels AD, channel B will be scheduled in the next round.
[0111] <7> At time T6, if channel A leaves, its credit value is changed to N. The credit values of channels B, C, and D are reduced by the minimum value of 3, resulting in an updated credit value of 0 for channels B, C, and D. Channel B's traffic is scheduled, and its credit value decreases by 1 in fixed increments. Since it is already 0, it remains unchanged. The credit values of channels C and D increase by 1 in fixed increments, so their updated credit values are both 1. Based on the credit value of channel B, channel C will be scheduled in the next round. <8> At time T7, if channel A is confirmed to be added, the credit values of channels B, C, and D will be reduced by the minimum credit value (0) among them. Since it is a reduction of 0, the credit values remain unchanged. The credit value of channel A will be set to a credit base of 0. The traffic of channel C will be scheduled, and the credit value of channel C will decrease by 1 in a fixed unit until it becomes 0. The credit values of channels B, D, and A will increase by a fixed unit of 1. After the update, the credit values of channels A and B will both be 1, and the credit value of channel D will be 2. Based on the credit values of channels AD, channel D will be scheduled in the next round.
[0112] <9> This process is repeated continuously to achieve a uniform distribution... Please refer to Figure 12 , Figure 12This is a traffic scheduling diagram for partial member ignore shape and partial member shape provided in an embodiment of this application. In this example, the initial credit value (also known as the credit base) is 0, the preset unit value is 1, and initially there is traffic to be scheduled in channels A, B, C, and D. The queue order is A, B, C, and D, and channels B, C, and D are set to shape. Members in a group are scheduled sequentially according to their credit value.
[0113] <1> Initialize the credit value of all members to 0. At this time, the credit values of the four channels are equal. According to the queue order, channel A will be scheduled. Since channel A has not been added to the shapEn group, it can be scheduled.
[0114] <2> At time T1, traffic from channel A is scheduled, and the credit value of channel A decreases by a fixed unit. Since it is already 0, it remains unchanged. The credit values of channels B, C, and D increase by a fixed unit of 1, and the credit values of channels BD are all updated to 1. It is determined whether all members of the unshapen group have been scheduled at least once in this round of unshapen group scheduling. Since the result is yes, the unshapen group scheduling ends. At this time, the highest credit value in both the unshapen and shapen groups is 1, placing it in the shapen group, therefore it enters the shapen group scheduling. Based on the credit value of the shapen group, channel B will be scheduled in the next round.
[0115] <3> At time T2, the shape condition is met, and the traffic of channel B is scheduled. The credit of channel B decreases to 0 by a fixed unit. The credits of channels A, C, and D increase by a fixed unit of 1. The updated credit value of channel A is 1, and the updated credit values of channels C and D are both 2. Since none of the members of the shapEn group have been scheduled at least once in this round of scheduling, the credit values of the shapEn group are analyzed to determine that channel C will be scheduled in the next round.
[0116] <4> At time T3, the shape condition is not met, so the traffic in channel C cannot be scheduled, and channel C is left unscheduled. The credit values of all channels remain unchanged. Since none of the members of the shapEn group have been scheduled at least once in this round of shapEn group scheduling, the credit value of the shapEn group is analyzed to determine that channel D will be scheduled in the next round.
[0117] <5> At time T4, the shape condition is not met, so traffic in channel D cannot be scheduled, channel D is left unscheduled, and the credit values of all channels remain unchanged. It is then determined whether all members of the shapEn group have been scheduled at least once; if so, the shapEn group scheduling ends. If the shapEn group scheduling ends but the shape condition is not met, the non-shapEn group scheduling can proceed directly, and channel A will be scheduled.
[0118] <6> At time T5, traffic from channel A is scheduled, and the credit value of channel A decreases to 0 in fixed units. The credit values of channels B, C, and D increase by a fixed unit of 1. The updated credit value of channel B is 1, and the updated credit values of channels C and D are both 3. It is determined whether all members of the non-shapEn group have been scheduled at least once in this round of scheduling for the shapEn group. If so, scheduling ends. Since the non-shapEn group scheduling has ended at this point, and the highest credit value in both groups is in the shapEn group, scheduling proceeds to the shapEn group. Based on the credit value of the shapEn group, channel C will be scheduled in the next round.
[0119] <7> At time T6, the shape condition is met, and traffic from channel C is scheduled. The credit value of channel C decreases by 1 in fixed units, becoming 2. The credit values of channels A, B, and D increase by 1 in fixed units. The updated credit value of channel A is 1, the updated credit value of channel B is 2, and the updated credit value of channel D is 4. Since none of the members of the shapEn group were scheduled at least once in this round of scheduling, based on the credit value analysis of the shapEn group, channel D will be scheduled in the next round.
[0120] <8> At time T7, the shape condition is met, the traffic of channel D is scheduled, and the credit value of channel D decreases by 1 in a fixed unit, becoming 3; the credit values of channels A, B, and C increase by 1 in a fixed unit, the updated credit value of channel A is 2, and the updated credit values of channels B and C are both 3.
[0121] <9> This process is repeated continuously to achieve a uniform distribution... Please refer to Figure 13 , Figure 13 This is a schematic diagram illustrating the execution process of the traffic scheduling method provided in the embodiments of this application. The following is in conjunction with... Figure 13 The execution process of the traffic scheduling method provided in the embodiments of this application will be briefly described.
[0122] P1: For the current channel group to be scheduled, select the member with the highest credit value within the group for scheduling; if the credit values are equal, select the member at the front of the queue. If the group is a shapEn group (i.e., an integer group), execute J1. If the group is an unshapEn group, execute P2.
[0123] J1: Determine whether the shape condition is met. If it is met, execute P2; otherwise, execute P3.
[0124] P2: Schedule the corresponding member, decreasing their credit value by a fixed unit (or leaving it unchanged if it's 0). Unscheduled members will have their credit values increased by a fixed unit. Then, execute J2.
[0125] P3: Unable to schedule the corresponding member, all member credit values remain unchanged, this round of shapEn group scheduling ends, and scheduling is performed based on the number of members in the shapEn group that were not scheduled in this round of shapEn group scheduling. After that, J2 is executed.
[0126] J2: Determine if a member has been added or removed. If a member has been added or removed, execute P4 first, then execute J3; otherwise, execute J3.
[0127] P4: Member addition: Before joining, the credit value of the members in the group is reduced by the minimum credit value in the group; Member removal: After removal, the credit value of the members in the group is reduced by the minimum credit value in the group, ensuring that both new and old members will have scheduling opportunities in the future.
[0128] J3: Determine whether all members in the shapEn group or the non-shapEn group have been scheduled at least once in this round of scheduling for the channel group. If so, proceed to P5; otherwise, return to P1.
[0129] P5: The scheduling of the shapEn group or non-shapEn group for this round of scheduling has ended, and the process will switch to another group for member scheduling.
[0130] In the aforementioned traffic scheduling method, during credit value adjustment, if the credit value of a channel whose credit value needs to be reduced is already at its initial value, it is not further reduced but remains unchanged. Continuing to reduce it would result in credit values lower than the initial value, making it difficult to maintain credit values when members join or leave. Furthermore, resource management typically uses a base value to prevent overdrafts, aligning with real-world memory resource logic and facilitating maintenance.
[0131] In the traffic scheduling method described above, although the traffic is divided into integer groups and non-integer groups, the two groups can be within the same scheduling logic. When member scheduling occurs, the credit values of members in both groups are incremented or decremented. This makes it easier to determine the next group to be scheduled based on the credit value after scheduling of one group. If all members in a group have been effectively scheduled, the group with the highest credit value can be designated as the next group to be scheduled. This next group could be either an integer group or a non-integer group.
[0132] The traffic scheduling method provided in this application uses a credit-based parameter dimension to logically divide the members of the RR scheduling into a shape group and an ignore shape group. This solves the problem that the old RR scheduling mechanism always prioritizes scheduling the shape group members immediately following the ignored shape channel after scheduling the traffic, resulting in uneven traffic distribution among the shape group members. In other words, it ensures that the traffic of the shape group is evenly distributed. Furthermore, the above method is not complex, easy to implement, does not affect the RR scheduling results in non-shape scenarios, and has a certain degree of compatibility.
[0133] To perform the corresponding steps in the above embodiments and various possible methods, an implementation of a traffic scheduling device 200 is given below. Optionally, the traffic scheduling device 200 can adopt the above-described... Figure 4 The device structure of the electronic device 100 shown. Further, please refer to... Figure 14 , Figure 14 This is a block diagram of the traffic scheduling device 200 provided in this embodiment. It should be noted that the basic principle and technical effects of the traffic scheduling device 200 provided in this embodiment are the same as those in the above embodiments. For the sake of brevity, any parts not mentioned in this embodiment can be referred to the corresponding content in the above embodiments. In this embodiment, the traffic scheduling device 200 may include: a determining module 210 and a scheduling module 220.
[0134] The determining module 210 is used to determine one group from the shaping group and the non-shaping group as the target channel group to be scheduled. The non-shaping group is scheduled using a round-robin scheduling method, and all channels in the shaping group are channels with traffic shaping enabled.
[0135] The scheduling module 220 is used to determine the first target channel from the shaping group when the target channel group is a shaping group, based on the filtering rule of taking the channel corresponding to the maximum credit value as the target channel, and to determine whether the preset shaping conditions are met.
[0136] The scheduling module 220 is further configured to, when conditions are met, schedule the traffic of the first target channel, adjust the credit values of the first target channel and other channels according to a preset credit value adjustment rule, and continue scheduling the shaping group. The preset credit value adjustment rule indicates decreasing the credit value of the target channel and increasing the credit values of other channels.
[0137] The determining module 210 is further configured to redetermine the target channel group if all channels in the shaping group have been scheduled at least once or if the preset shaping conditions are not met.
[0138] Optionally, the above modules can be stored in the form of software or firmware. Figure 4 The memory 110 shown is either stored in or embedded in the operating system (OS) of the electronic device 100, and can be used by... Figure 4 The processor 120 executes the program. Meanwhile, the data and program code required to execute the above modules can be stored in the memory 110.
[0139] This application also provides a readable storage medium storing a computer program thereon, which, when executed by a processor, implements the traffic scheduling method described above.
[0140] In summary, this application provides a traffic scheduling method, apparatus, electronic device, and readable storage medium. First, from two channel groups—a shaping group and a non-shaping group—one group is determined as the target channel group to be scheduled. The non-shaping group is scheduled using a round-robin scheduling method, while all channels in the shaping group have traffic shaping enabled. When the determined target channel group is a shaping group, based on a filtering rule that selects the channel with the highest credit value as the target channel, a channel is determined from this shaping group as the first target channel, and it is determined whether a preset shaping condition is met. If the preset shaping condition is met, the traffic of the first target channel is scheduled. The credit values of the first target channel and other first channels are adjusted according to a preset credit value adjustment rule. The first target channel is determined again, and it is determined whether the shaping condition is met again, to continue scheduling the shaping group. If all channels in the shaping group have been scheduled at least once or the preset shaping condition is not met, the target channel group is re-determined. The preset credit value adjustment rule indicates decreasing the credit value of the target channel and increasing the credit values of other channels. In this way, when some members of the RR scheduling mechanism have traffic shaping enabled and others have not, the channels with traffic shaping enabled are scheduled in order of credit value. This alleviates the problem that the old RR scheduling mechanism always prioritizes scheduling the shape channel immediately following the member after scheduling the traffic of the ignored shape channel, which leads to multiple shape channels not being able to distribute traffic evenly.
[0141] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0142] In addition, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0143] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0144] The above description is merely an optional embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A traffic scheduling method, characterized in that, The method includes: From the shaping group and the non-shaping group, one group is determined as the target channel group to be scheduled. The non-shaping group is scheduled using a round-robin scheduling method, and all channels in the shaping group are channels with traffic shaping enabled. When the target channel group is a shaping group, the first target channel is determined from the shaping group based on the filtering rule of using the channel corresponding to the highest credit value as the target channel, and it is determined whether the preset shaping conditions are met. If the conditions are met, the traffic of the first target channel is scheduled, the credit values of the first target channel and other channels are adjusted according to the preset credit value adjustment rules, and the shaping group is scheduled again. The preset credit value adjustment rules indicate that the credit value of the target channel is reduced and the credit value of other channels is increased. If all channels in the shaping group have been scheduled at least once or if the preset shaping conditions are not met, the target channel group is redefined.
2. The method according to claim 1, characterized in that, The method further includes: After completing a channel scheduling, determine whether there are any channels to be added to the channel group based on credit value scheduling; If a channel is to be added to a channel group based on credit value scheduling, the credit value of each channel in the channel group to be added is reduced by the minimum credit value in the corresponding channel group to update the credit value of each channel in the channel group, and the initial credit value is used as the credit value of the channel to be added.
3. The method according to claim 2, characterized in that, The method further includes: After completing a channel scheduling, determine whether any channels need to leave the channel group based on credit value scheduling; If a channel needs to leave a channel group based on credit value scheduling, the channel will be removed from the corresponding channel group, and the credit value of each channel in the channel group after the removal of the channel will be reduced by the minimum credit value in the corresponding channel group to update the credit value of each remaining channel in the channel group.
4. The method according to claim 3, characterized in that, The step of adjusting the credit values of the first target channel and the first other channels according to the preset credit value adjustment rules includes: Determine whether the current credit value of the first target channel is the initial credit value; If the current credit value is not the initial credit value, the result of subtracting a preset unit value from the current credit value shall be used as the current credit value after the first target channel is updated. When the current credit value is the initial credit value, the initial credit value is used as the current credit value after the first target channel is updated. The sum of the credit value of each first other channel and the preset unit value is used as the updated credit value of each first other channel.
5. The method according to any one of claims 1-4, characterized in that, The filtering rule indicates that the channel with the highest credit value in the target channel group should be used as the target channel; And / or, the method further includes: If the conditions are not met, the scheduling will be suspended based on the number of channels in the current shaping group that have not been scheduled but have traffic that needs to be scheduled, and the current shaping group scheduling will be terminated.
6. The method according to any one of claims 1-4, characterized in that, When a non-shaping group is scheduled, the credit value of each channel in the non-shaping group is adjusted according to the preset credit value adjustment rule. The step of re-determining the target channel group when the preset shaping conditions are not met includes: When both the shaped group and the non-shaped group contain channels for traffic scheduling, determine the maximum credit value among the credit values corresponding to the shaped group and the non-shaped group, and use the group corresponding to the maximum credit value as the redefined target channel group; If the newly determined target channel group is a shaping group, determine whether the preset shaping conditions are met; If the preset shaping conditions are not met, the channel will be left idle based on the number of channels with traffic to be scheduled in the shaping group, and the non-shaping group will be used as the target channel group for re-determining.
7. The method according to any one of claims 1-4, characterized in that, The method further includes: When the target channel group is a non-integer group, the second target channel is determined from the non-integer group based on the filtering rule of using the channel corresponding to the highest credit value as the target channel. The traffic of the second target channel is scheduled, and the credit values of the second target channel and the second other channels are adjusted according to the preset credit value adjustment rules. The non-integer group is then scheduled. The credit value adjustment method of the second target channel is the same as that of the first target channel, and the credit value adjustment method of the second other channels is the same as that of the second other channels. If all channels in the non-shaping group have been scheduled at least once, the current round of non-shaping group scheduling is considered complete, and the target channel group is re-determined.
8. The method according to claim 7, characterized in that, Each first other channel includes channels in the shaping group other than the first target channel and channels in the non-shaping group; each second other channel includes channels in the non-shaping group other than the second target channel and channels in the shaping group; determining a group from the shaping group and the non-shaping group as the target channel group to be scheduled currently includes: When both the shaped group and the non-shaped group contain channels for traffic scheduling, the maximum credit value among the credit values corresponding to the shaped group and the non-shaped group is determined, and the group corresponding to the maximum credit value is taken as the target channel group. When there is no traffic to be scheduled in the shaping group and there is traffic to be scheduled in the non-shaping group, the non-shaping group will be used as the target channel group.
9. A flow scheduling device, characterized in that, The device includes: The determination module is used to determine a group from the shaped group and the non-shaped group as the target channel group to be scheduled. The non-shaped group is scheduled using a round-robin scheduling method, and each channel in the shaped group is a channel with traffic shaping enabled. The scheduling module is used to determine the first target channel from the shaping group when the target channel group is an integer group, based on the filtering rule of using the channel corresponding to the maximum credit value as the target channel, and to determine whether the preset shaping conditions are met. The scheduling module is further configured to, when conditions are met, schedule the traffic of the first target channel, adjust the credit values of the first target channel and other channels according to a preset credit value adjustment rule, and continue to schedule the shaping group, wherein the preset credit value adjustment rule indicates to decrease the credit value of the target channel and increase the credit value of other channels; The determining module is further configured to redetermine the target channel group if all channels in the shaping group have been scheduled at least once or if the preset shaping conditions are not met.
10. An electronic device, characterized in that, It includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, the processor executing the machine-executable instructions to implement the traffic scheduling method according to any one of claims 1-8.