CN105119839A - Weighted scheduling method and device based on current_link - Google Patents
Weighted scheduling method and device based on current_link Download PDFInfo
- Publication number
- CN105119839A CN105119839A CN201510450187.XA CN201510450187A CN105119839A CN 105119839 A CN105119839 A CN 105119839A CN 201510450187 A CN201510450187 A CN 201510450187A CN 105119839 A CN105119839 A CN 105119839A
- Authority
- CN
- China
- Prior art keywords
- communication link
- link object
- target communication
- attribute value
- weight attribute
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 38
- 238000004891 communication Methods 0.000 claims abstract description 329
- 238000012545 processing Methods 0.000 claims description 16
- 230000005540 biological transmission Effects 0.000 abstract description 17
- 238000010586 diagram Methods 0.000 description 10
- 238000005516 engineering process Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 230000007423 decrease Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/10—Flow control; Congestion control
- H04L47/12—Avoiding congestion; Recovering from congestion
- H04L47/125—Avoiding congestion; Recovering from congestion by balancing the load, e.g. traffic engineering
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/10—Flow control; Congestion control
- H04L47/12—Avoiding congestion; Recovering from congestion
- H04L47/122—Avoiding congestion; Recovering from congestion by diverting traffic away from congested entities
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
Description
技术领域technical field
本发明涉及计算机技术领域,特别涉及一种基于游标指针的加权调度方法及装置。The invention relates to the field of computer technology, in particular to a weighted scheduling method and device based on cursor pointers.
背景技术Background technique
随着计算机技术的飞速发展,各个计算机之间包括多条通信链路,每一条通信链路的传输速度和承载能力各不相同。在计算机之间进行数据通信时,考虑到负载均衡问题,一般希望能够让传输速度快承担能力强的通信链路多承担一些数据流量,让传输速度慢承载能力弱的通信链路少承担一些数据流量,从而实现负载更均衡分配。With the rapid development of computer technology, there are multiple communication links between computers, and the transmission speed and carrying capacity of each communication link are different. When performing data communication between computers, considering the problem of load balancing, it is generally hoped that communication links with fast transmission speed and strong bearing capacity can bear more data traffic, and communication links with slow transmission speed and weak bearing capacity can bear less data. Traffic, so as to achieve a more balanced load distribution.
目前,一般采用如下方式实现负载均衡分配:每当接收到一个当前数据流量包时,在空闲的所有通信链路中逐个遍历每一个通信链路,将遍历到的权重属性值最大的通信链路作为当前数据流量包的传输链路。At present, the following method is generally used to achieve load balancing distribution: whenever a current data flow packet is received, each communication link is traversed one by one among all idle communication links, and the communication link with the largest weight attribute value traversed is As the transmission link of the current data traffic packet.
然而,当通信链路的数量较大时,现有技术方案中逐个遍历每一个通信链路来实现通信链路的选择时,需要耗费较长的时间,从而影响数据流量包的传输效率。However, when the number of communication links is large, it takes a long time to traverse each communication link one by one to realize the selection of the communication link in the prior art solution, thereby affecting the transmission efficiency of data traffic packets.
发明内容Contents of the invention
有鉴于此,本发明提供一种基于游标指针的加权调度方法及装置,以提高数据流量包的传输效率。In view of this, the present invention provides a cursor pointer-based weighted scheduling method and device to improve the transmission efficiency of data traffic packets.
本发明实施例提供了一种基于游标指针的加权调度方法,包括:An embodiment of the present invention provides a cursor pointer-based weighted scheduling method, including:
S1:根据所有通信链路对象建立环形链表,并从所述环形链表中选择一个通信链路对象将其作为目标通信链路对象;S1: Establish a circular linked list according to all communication link objects, and select a communication link object from the circular linked list as the target communication link object;
S2:将游标指针指向所述目标通信链路对象,并利用所述目标通信链路对象传输数据包;S2: point the cursor pointer to the target communication link object, and use the target communication link object to transmit data packets;
S3:在所述目标通信链路对象达到设定条件时,以所述目标通信链路对象作为起点,以设定顺序选择下一个通信链路对象作为当前的目标通信链路对象,并利用当前的目标通信链路对象继续执行S2。S3: When the target communication link object reaches the setting condition, take the target communication link object as the starting point, select the next communication link object in the setting sequence as the current target communication link object, and use the current The target communication link object continues to execute S2.
优选地,Preferably,
进一步包括:预先为每一条通信链路对象设定权重属性值和运行权重属性值;其中,针对每一条通信链路对象所设定的权重属性值与运行权重属性值相等;It further includes: setting a weight attribute value and an operation weight attribute value for each communication link object in advance; wherein, the weight attribute value set for each communication link object is equal to the operation weight attribute value;
在利用所述目标通信链路对象传输数据包之后,进一步包括:每利用所述目标通信链路对象传输一次数据包,则执行一次将所述目标通信链路对象的运行权重属性值进行更新操作,以使更新后的运行权重属性值小于更新前的运行权重属性值,并在更新后的运行权重属性值满足设定值时,确定所述目标通信链路对象达到设定条件。After using the target communication link object to transmit the data packet, it further includes: performing an operation of updating the running weight attribute value of the target communication link object every time the target communication link object is used to transmit a data packet. , so that the updated operating weight attribute value is smaller than the pre-updated operating weight attribute value, and when the updated operating weight attribute value meets the set value, it is determined that the target communication link object meets the set condition.
优选地,Preferably,
所述执行一次将所述目标通信链路对象的运行权重属性值进行更新操作,包括:将所目标通信链路对象的运行权重属性值减1;其中,所述设定值等于0。The performing an operation of updating the operation weight attribute value of the target communication link object once includes: subtracting 1 from the operation weight attribute value of the target communication link object; wherein, the set value is equal to 0.
优选地,在所述目标通信链路对象达到设定条件之后,在所述以所述目标通信链路对象作为起点,以设定顺序选择下一个通信链路对象作为当前的目标通信链路对象之前,进一步包括:Preferably, after the target communication link object reaches the set condition, using the target communication link object as the starting point, select the next communication link object in a set order as the current target communication link object Before, further include:
将所述目标通信链路对象的运行权重属性值更新为相应地权重属性值。Updating the running weight attribute value of the target communication link object to a corresponding weight attribute value.
优选地,Preferably,
所述以所述目标通信链路对象作为起点,以设定顺序选择下一个通信链路对象作为当前的目标通信链路对象,包括:以所述目标通信链路对象作为起点,以顺时针选择下一个通信链路对象作为当前的目标通信链路对象;The step of using the target communication link object as a starting point and selecting the next communication link object in a set order as the current target communication link object includes: taking the target communication link object as a starting point and selecting the next communication link object clockwise The next communication link object is used as the current target communication link object;
或,or,
所述以所述目标通信链路对象作为起点,以设定顺序选择下一个通信链路对象作为当前的目标通信链路对象,包括:以所述目标通信链路对象作为起点,以逆时针选择下一个通信链路对象作为当前的目标通信链路对象。The step of using the target communication link object as a starting point and selecting the next communication link object in a set order as the current target communication link object includes: taking the target communication link object as a starting point and selecting the next communication link object counterclockwise The next communication link object is used as the current target communication link object.
本发明实施例还提供了一种基于游标指针的加权调度装置,包括:The embodiment of the present invention also provides a cursor pointer-based weighted scheduling device, including:
建立单元,用于根据所有通信链路对象建立环形链表,并从所述环形链表中选择一个通信链路对象将其作为目标通信链路对象;An establishment unit, configured to establish a circular linked list according to all communication link objects, and select a communication link object from the circular linked list as a target communication link object;
处理单元,用于将游标指针指向所述目标通信链路对象,并利用所述目标通信链路对象传输数据包;a processing unit, configured to point a cursor pointer to the target communication link object, and use the target communication link object to transmit data packets;
选择单元,用于在所述目标通信链路对象达到设定条件时,以所述目标通信链路对象作为起点,以设定顺序选择下一个通信链路对象作为当前的目标通信链路对象,并利用当前的目标通信链路对象触发所述处理单元继续执行操作。a selection unit, configured to select the next communication link object in a set order as the current target communication link object, using the target communication link object as a starting point when the target communication link object reaches the set condition, And use the current target communication link object to trigger the processing unit to continue to execute the operation.
优选地,Preferably,
进一步包括:存储单元,用于预先为每一条通信链路对象存储权重属性值和运行权重属性值;其中,针对每一条通信链路对象所设定的权重属性值与运行权重属性值相等;It further includes: a storage unit, which is used to store the weight attribute value and the operation weight attribute value for each communication link object in advance; wherein, the weight attribute value set for each communication link object is equal to the operation weight attribute value;
进一步包括:更新单元,用于每利用所述目标通信链路对象传输一次数据包,则执行一次将所述目标通信链路对象的运行权重属性值进行更新操作,以使更新后的运行权重属性值小于更新前的运行权重属性值,并在更新后的运行权重属性值满足设定值时,确定所述目标通信链路对象达到设定条件。It further includes: an updating unit, configured to perform an operation of updating the operation weight attribute value of the target communication link object every time a data packet is transmitted by using the target communication link object, so that the updated operation weight attribute The value is smaller than the operation weight attribute value before updating, and when the updated operation weight attribute value satisfies the set value, it is determined that the target communication link object meets the set condition.
优选地,Preferably,
所述更新单元,用于将所目标通信链路对象的运行权重属性值减1;其中,所述设定值等于0。The updating unit is configured to subtract 1 from the operation weight attribute value of the target communication link object; wherein, the set value is equal to 0.
优选地,所述更新单元,用于将所述目标通信链路对象的运行权重属性值更新为相应地权重属性值。Preferably, the updating unit is configured to update the running weight attribute value of the target communication link object to a corresponding weight attribute value.
优选地,Preferably,
所述选择单元,用于以所述目标通信链路对象作为起点,以顺时针选择下一个通信链路对象作为当前的目标通信链路对象;或,用于以所述目标通信链路对象作为起点,以逆时针选择下一个通信链路对象作为当前的目标通信链路对象。The selection unit is configured to use the target communication link object as a starting point to select the next communication link object clockwise as the current target communication link object; or, to use the target communication link object as the current target communication link object; Starting point, select the next communication link object counterclockwise as the current target communication link object.
本发明实施例提供了一种基于游标指针的加权调度方法及装置,通过根据所有通信链路对象建立环形链表,以利用游标指针所指向的通信链路对象确定当前正在使用的目标通信链路对象,并在将目标通信链路对象完成使用,在选择通信链路对象时不需要计算查找,直接选择环形链表上的下一个通信链路对象作为目标通信链路对象即可,从而使得在选择通信链路对象时处理速度是不变的,不会因通信链路对象的数量增多而影响处理速度,进而提高了数据流量包的传输效率。The embodiment of the present invention provides a weighted scheduling method and device based on a cursor pointer, by establishing a circular linked list according to all communication link objects, to determine the target communication link object currently in use by using the communication link object pointed to by the cursor pointer , and complete the use of the target communication link object, there is no need to calculate and search when selecting the communication link object, just directly select the next communication link object on the ring list as the target communication link object, so that when selecting the communication link object The processing speed of link objects is constant, and the processing speed will not be affected by the increase of the number of communication link objects, thereby improving the transmission efficiency of data traffic packets.
附图说明Description of drawings
图1是本发明实施例提供的方法流程图;Fig. 1 is the flow chart of the method provided by the embodiment of the present invention;
图2是本发明另一实施例提供的方法流程图;Fig. 2 is a flow chart of a method provided by another embodiment of the present invention;
图3是本发明实施例提供的环形链表结构示意图;Fig. 3 is a schematic structural diagram of a circular linked list provided by an embodiment of the present invention;
图4是本发明实施例提供的current_link指向通信链路对象5的环形链表结构示意图;FIG. 4 is a schematic structural diagram of a circular linked list in which current_link points to a communication link object 5 provided by an embodiment of the present invention;
图5是本发明实施例提供的current_link指向通信链路对象10的环形链表结构示意图;FIG. 5 is a schematic structural diagram of a circular linked list in which current_link points to a communication link object 10 provided by an embodiment of the present invention;
图6是本发明实施例提供的装置所在设备的硬件架构图;FIG. 6 is a hardware architecture diagram of the device where the device provided by the embodiment of the present invention is located;
图7是本发明实施例提供的装置结构示意图;Fig. 7 is a schematic structural diagram of a device provided by an embodiment of the present invention;
图8是本发明另一实施例提供的装置结构示意图。Fig. 8 is a schematic structural diagram of a device provided by another embodiment of the present invention.
具体实施方式Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述。显然,所描述的实施例仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Apparently, the described embodiments are only some of the embodiments of the present invention, but not all of them. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.
如图1所示,本发明实施例提供了一种基于游标指针的加权调度方法,该方法可以包括以下步骤:As shown in Figure 1, the embodiment of the present invention provides a cursor pointer-based weighted scheduling method, which may include the following steps:
步骤101:根据所有通信链路对象建立环形链表,并从环形链表中选择一个通信链路对象将其作为目标通信链路对象。Step 101: Establish a circular linked list according to all communication link objects, and select a communication link object from the circular linked list as a target communication link object.
步骤102:将游标指针指向目标通信链路对象,并利用目标通信链路对象传输数据包。Step 102: point the cursor pointer to the target communication link object, and use the target communication link object to transmit data packets.
步骤103:在目标通信链路对象达到设定条件时,以目标通信链路对象作为起点,以设定顺序选择下一个通信链路对象作为当前的目标通信链路对象,并利用当前的目标通信链路对象继续执行步骤102。Step 103: When the target communication link object reaches the setting condition, take the target communication link object as the starting point, select the next communication link object in the setting order as the current target communication link object, and use the current target communication link object The link object proceeds to step 102 .
根据本方案,通过根据所有通信链路对象建立环形链表,以利用游标指针所指向的通信链路对象确定当前正在使用的目标通信链路对象,并在将目标通信链路对象完成使用,在选择通信链路对象时不需要计算查找,直接选择环形链表上的下一个通信链路对象作为目标通信链路对象即可,从而使得在选择通信链路对象时处理速度是不变的,不会因通信链路对象的数量增多而影响处理速度,进而提高了数据流量包的传输效率。According to this scheme, by establishing a circular linked list according to all communication link objects, the communication link object pointed to by the cursor pointer is used to determine the target communication link object currently in use, and when the target communication link object is used, select There is no need to calculate and search for the communication link object, just select the next communication link object on the ring list directly as the target communication link object, so that the processing speed is unchanged when selecting the communication link object, and will not be affected by The increase in the number of communication link objects affects the processing speed, thereby improving the transmission efficiency of data traffic packets.
由于每一个通信链路对象的权重属性值不同,权重属性值越大,其通信链路对象可以转发的流量就会越大,因此,为了保证权重属性值越大的通信链路对象能够转发与其性能相匹配的流量,可以预先为每一条通信链路对象设定权重属性值和运行权重属性值;其中,针对每一条通信链路对象所设定的权重属性值与运行权重属性值相等。在环形链表上每利用目标通信链路对象传输一次数据包,则执行一次将目标通信链路对象的运行权重属性值进行更新操作,以使更新后的运行权重属性值小于更新前的运行权重属性值,并在更新后的运行权重属性值满足设定值时,确定目标通信链路对象达到设定条件。从而使得每一条通信链路对象被选择的次数不同,保证了权重属性值不同的通信链路对象能够转发与其性能相匹配的流量。Since the weight attribute value of each communication link object is different, the greater the weight attribute value, the greater the traffic that its communication link object can forward. Therefore, in order to ensure that the communication link object with a greater weight attribute value can forward For traffic with matching performance, the weight attribute value and the operation weight attribute value can be set in advance for each communication link object; wherein, the weight attribute value set for each communication link object is equal to the operation weight attribute value. Every time the target communication link object is used to transmit a data packet on the circular linked list, the operation weight attribute value of the target communication link object is updated once, so that the operation weight attribute value after the update is smaller than the operation weight attribute before the update value, and when the updated operating weight attribute value meets the set value, it is determined that the target communication link object meets the set condition. Therefore, the number of times each communication link object is selected is different, ensuring that communication link objects with different weight attribute values can forward traffic matching their performance.
为使本发明的目的、技术方案和优点更加清楚,下面结合附图及具体实施例对本发明作进一步地详细描述。In order to make the purpose, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.
如图2所示,本发明实施例提供了一种基于游标指针的加权调度方法,该方法可以包括以下步骤:As shown in Figure 2, the embodiment of the present invention provides a cursor pointer-based weighted scheduling method, which may include the following steps:
步骤201:根据所有通信链路对象建立一个环形链表,该环形链表中包括所有通信链路对象。Step 201: Establish a circular linked list according to all communication link objects, and the circular linked list includes all communication link objects.
本实施例以环形链表中包括十个通信链路对象为例对加权调度方法进行详细说明。如图3所示,为环形链表结构示意图,其中,该环形链表可以包括以下10个节点:通信链路对象1、通信链路对象2、…、通信链路对象10,其中,其中,每一个节点是指一个通信链路对象,以实现在环形链表上选择目标通信链路对象来传输数据包。In this embodiment, the weighted scheduling method is described in detail by taking ten communication link objects included in the circular linked list as an example. As shown in Figure 3, it is a schematic diagram of the structure of the circular linked list, wherein the circular linked list can include the following 10 nodes: communication link object 1, communication link object 2, ..., communication link object 10, wherein, each A node refers to a communication link object, so as to select a target communication link object on the ring list to transmit data packets.
其中,每一个通信链路对象可以包括如下四个参数:next、weight_rt、weight和link。其中,next用于指示下一个通信链路对象的接口;weight用于表征预先为通信链路对象设置的权重属性值,该权重属性值为预先分配的且固定不变的值;weight_rt用于表征运行权重属性值,在通信链路对象的选择过程中,该weight_rt是一个变量,随着被选择的次数增加而减小,其初始值与weight相等;link用于表征该通信链路对象的其他属性,例如,与其他通信链路对象的链接关系等。Wherein, each communication link object may include the following four parameters: next, weight_rt, weight and link. Among them, next is used to indicate the interface of the next communication link object; weight is used to represent the weight attribute value set for the communication link object in advance, and the weight attribute value is a pre-assigned and fixed value; weight_rt is used to represent The value of the running weight attribute. In the selection process of the communication link object, the weight_rt is a variable that decreases with the number of times selected. Its initial value is equal to weight; link is used to represent the other parameters of the communication link object Attributes, such as link relationships with other communication link objects, etc.
由于每一个通信链路对象所具有传输数据流量的性能不同,因此,本实施例中,可以通过设置通信链路对象的权重属性值weight来表征该通信链路对象所能够传输数据流量的性能,权重属性值weight越大,其传输数据流量的性能越高,相应地,权重属性值weight越小,其传输数据流量的性能越低。并且该权重属性值可以区分不同通信链路对象所具有传输数据流量的性能,因此,不同的通信链路对象其权重属性值也不同。例如,可以设定通信链路对象1、通信链路对象2、……、通信链路对象10的权重属性值分别是:10、15、8、20、15、10、5、17、12、11。Since each communication link object has different performance of transmitting data traffic, in this embodiment, the performance of the communication link object that can transmit data traffic can be represented by setting the weight attribute value weight of the communication link object, The larger the weight attribute value weight, the higher the performance of data traffic transmission, and correspondingly, the smaller the weight attribute value weight is, the lower the data traffic transmission performance is. Moreover, the weight attribute value can distinguish the performance of data traffic transmission of different communication link objects, therefore, the weight attribute values of different communication link objects are also different. For example, the weight attribute values of communication link object 1, communication link object 2, ..., communication link object 10 can be set as: 10, 15, 8, 20, 15, 10, 5, 17, 12, 11.
对于各个通信链路对象在环形链表中的排列顺序可以是按照权重属性值从大到小的顺序在环形链表的顺时针上排列,也可以是按照权重属性值从大到小的顺序在环形链表的逆时针上排列;由于本实施例中在选择通信链路对象时,是逐个选取的,当然也可以在环形链表上的顺时针上按照任意顺序排列各个通信链路对象。其中,以在环形链表上的顺时针上按照任意顺序排列各个通信链路对象为例,对本实施例的加权调度方法进行详细说明。The arrangement order of each communication link object in the circular linked list can be arranged clockwise in the circular linked list according to the order of the weight attribute value from large to small, or it can be arranged in the circular linked list according to the order of the weight attribute value from large to small Arranged in the counterclockwise direction; since the communication link objects are selected one by one in this embodiment, of course each communication link object can also be arranged in any order clockwise on the circular linked list. Wherein, the weighted scheduling method of this embodiment is described in detail by taking the example of arranging communication link objects in an arbitrary order in a clockwise direction on a circular linked list.
步骤202:将游标指针指向目标通信链路对象,并利用目标通信链路对象传输数据包。Step 202: point the cursor pointer to the target communication link object, and use the target communication link object to transmit data packets.
如图3所示,本实施例中,采用游标指针current_link用于表明当前使用的通信链路对象,假设当前确定的目标通信链路对象是图3中的通信链路对象1,那么将current_link指向该通信链路对象1。As shown in Figure 3, in this embodiment, the cursor pointer current_link is used to indicate the currently used communication link object, assuming that the currently determined target communication link object is communication link object 1 in Figure 3, then current_link points to The communication link object 1.
在接收到一个待传输的数据包时,无需进行遍历查找的操作,可以直接在环形链表中选择该current_link所指向的目标通信链路对象来传输数据包,从而提高了数据包传输的效率。When a data packet to be transmitted is received, the target communication link object pointed to by the current_link can be directly selected in the circular linked list to transmit the data packet without performing a traversal search operation, thereby improving the efficiency of data packet transmission.
步骤203:将使用的该目标通信链路对象的weight_rt进行更新,以使更新后的weight_rt小于更新前的weight_rt。Step 203: Update the weight_rt of the used target communication link object, so that the updated weight_rt is smaller than the weight_rt before the update.
由于一个通信链路对象在被使用去传输数据包之前,其weight_rt与weight相等,而每选择一次该通信链路对象,该weight_rt就需要被更新一次,以保证该通信链路对象不能够被无限次使用。Since the weight_rt of a communication link object is equal to the weight before it is used to transmit data packets, and each time the communication link object is selected, the weight_rt needs to be updated once to ensure that the communication link object cannot be infinitely times used.
在本实施例中,对通信链路对象的weight_rt进行更新的方式可以包括:每使用一次该通信链路对象,执行一次将该通信链路对象的weight_rt乘以一个百分数操作得到更新后的weight_rt,该百分数小于1,使得更新后的weight_rt小于更新前的weight_rt。In this embodiment, the method of updating the weight_rt of the communication link object may include: each time the communication link object is used, multiplying the weight_rt of the communication link object by a percentage to obtain the updated weight_rt, This percentage is less than 1, making the updated weight_rt smaller than the pre-updated weight_rt.
优选地,对通信链路对象的weight_rt进行更新的方式可以是:每选择一次该通信链路对象,将该通信链路对象的weight_rt减1。Preferably, the method of updating the weight_rt of the communication link object may be: decrementing the weight_rt of the communication link object by 1 each time the communication link object is selected.
步骤204:继续选择该目标通信链路对象来传输数据包,当该目标通信链路对象更新后的weight_rt满足设定值时,确定该通信链路对象达到设定条件,执行步骤205。Step 204: continue to select the target communication link object to transmit data packets, when the updated weight_rt of the target communication link object meets the set value, determine that the communication link object meets the set condition, and execute step 205.
为了保证每一个通信链路对象能够充分发挥其传输性能所能够传输的数据流量,在本实施例中,针对每一个通信链路对象可以被使用多次去传输数据包,每一次使用后,可以将该通信链路对象的weight_rt更新一次,直到更新后的weight_rt满足设定值时,则确定该通信链路对象满足设定条件,完成对该通信链路对象的选择。In order to ensure that each communication link object can give full play to the data flow that can be transmitted by its transmission performance, in this embodiment, for each communication link object, it can be used multiple times to transmit data packets. After each use, it can The weight_rt of the communication link object is updated once until the updated weight_rt meets the set value, then it is determined that the communication link object satisfies the set condition, and the selection of the communication link object is completed.
其中,根据步骤203中对通信链路对象的weight_rt进行更新的优选方式对每一个通信链路对象的weight_rt进行更新,那么可以设定该设定值为0,当通信链路对象的weight_rt更新为0时,则该通信链路对象更新后的weight_rt满足设定值,以及确定该通信链路对象满足设定条件。对于通信链路对象1、通信链路对象2、……、通信链路对象10分别被选择了10次、15次、8次、20次、15次、10次、5次、17次、12次、11次后,满足设定条件。Wherein, the weight_rt of each communication link object is updated according to the preferred method of updating the weight_rt of the communication link object in step 203, then the set value can be set to 0, when the weight_rt of the communication link object is updated to When 0, the updated weight_rt of the communication link object meets the set value, and it is determined that the communication link object meets the set condition. For communication link object 1, communication link object 2, ..., communication link object 10 were selected 10 times, 15 times, 8 times, 20 times, 15 times, 10 times, 5 times, 17 times, 12 times After times and 11 times, the set condition is satisfied.
步骤205:将目标通信链路对象的运行权重属性值更新为相应地权重属性值。Step 205: Update the operation weight attribute value of the target communication link object to the corresponding weight attribute value.
在本实施例中,为了保证该通信链路对象在下一轮的选择时能够被正常使用,那么需要将目标通信链路对象的weight_rt更新为相应地weight,从而在下一轮的选择时,可以根据该不为0的weight_rt确定该通信链路对象可以执行数据包的传输操作。In this embodiment, in order to ensure that the communication link object can be used normally in the next round of selection, it is necessary to update the weight_rt of the target communication link object to the corresponding weight, so that in the next round of selection, it can be used according to The weight_rt that is not 0 determines that the communication link object can perform the data packet transmission operation.
步骤206:以目标通信链路对象作为起点,以设定顺序选择下一个通信链路对象作为当前的目标通信链路对象,并利用当前的目标通信链路对象继续执行步骤202。Step 206: Taking the target communication link object as a starting point, select the next communication link object in the set sequence as the current target communication link object, and continue to execute step 202 using the current target communication link object.
在本实施例中,当确定通信链路对象满足设定条件时,可以继续选择下一个通信链路对象作为目标通信链路对象来对数据包进行传输。In this embodiment, when it is determined that the communication link object satisfies the set condition, the next communication link object may be continuously selected as the target communication link object to transmit the data packet.
其中,在选择下一个通信链路对象时,可以以目标通信链路对象作为起点,以顺时针或逆时针选择下一个通信链路对象作为当前的目标通信链路对象。例如,以顺时针选择下一个通信链路对象作为当前的目标通信链路对象,那么当目标通信链路对象是通信链路对象1时,那么选择的下一个通信链路对象2作为目标通信链路对象,并根据选择的通信链路对象2执行步骤202。Wherein, when selecting the next communication link object, the target communication link object may be used as a starting point, and the next communication link object may be selected clockwise or counterclockwise as the current target communication link object. For example, select the next communication link object clockwise as the current target communication link object, then when the target communication link object is communication link object 1, then the selected next communication link object 2 will be the target communication link object link object, and execute step 202 according to the selected communication link object 2.
随着通信链路对象的逐个选择,current_link根据所选择的通信链路对象进行依次滑动,在环形链表上依次循环选择下一条通信链路对象,并且每一条通信链路对象的weight决定了current_link滑动到下一个通信链路对象之间的时间段内当前通信链路对象被使用的次数。As the communication link objects are selected one by one, the current_link slides in turn according to the selected communication link objects, and the next communication link object is selected in turn on the ring list, and the weight of each communication link object determines the current_link sliding The number of times the current communication link object is used during the time period between the next communication link object.
如图4所示,为通信链路对象5为目标通信链路对象时的示意图,在该情况下,current_link指向通信链路对象5,表征当前使用的目标通信链路对象是通信链路对象5。如图5所示,为通信链路对象10为目标通信链路对象时的示意图,在情况下,current_link指向通信链路对象10,表征当前使用的目标通信链路对象是通信链路对象10。当通信链路对象10的weight_rt更新为0时,那么将通信链路对象10的weight_rt更新为与其相应地weight,并将current_link指向通信链路对象1,进而继续新一轮的选择。As shown in Figure 4, it is a schematic diagram when the communication link object 5 is the target communication link object. In this case, current_link points to the communication link object 5, indicating that the currently used target communication link object is the communication link object 5 . As shown in FIG. 5 , it is a schematic diagram when the communication link object 10 is the target communication link object. In this case, current_link points to the communication link object 10 , indicating that the currently used target communication link object is the communication link object 10 . When the weight_rt of the communication link object 10 is updated to 0, then the weight_rt of the communication link object 10 is updated to the corresponding weight, and the current_link points to the communication link object 1, and then a new round of selection is continued.
根据本方案,通过根据所有通信链路对象建立环形链表,以利用游标指针所指向的通信链路对象确定当前正在使用的目标通信链路对象,并在将目标通信链路对象完成使用,在选择通信链路对象时不需要计算查找,直接选择环形链表上的下一个通信链路对象作为目标通信链路对象即可,从而使得在选择通信链路对象时处理速度是不变的,不会因通信链路对象的数量增多而影响处理速度,进而提高了数据流量包的传输效率。According to this scheme, by establishing a circular linked list according to all communication link objects, the communication link object pointed to by the cursor pointer is used to determine the target communication link object currently in use, and when the target communication link object is used, select There is no need to calculate and search for the communication link object, just select the next communication link object on the ring list directly as the target communication link object, so that the processing speed is unchanged when selecting the communication link object, and will not be affected by The increase in the number of communication link objects affects the processing speed, thereby improving the transmission efficiency of data traffic packets.
如图6、图7所示,本发明实施例提供了一种基于游标指针的加权调度装置。装置实施例可以通过软件实现,也可以通过硬件或者软硬件结合的方式实现。从硬件层面而言,如图6所示,为本发明实施例基于游标指针的加权调度装置所在设备的一种硬件结构图,除了图6所示的处理器、内存、网络接口、以及非易失性存储器之外,实施例中装置所在的设备通常还可以包括其他硬件,如负责处理报文的转发芯片等等。以软件实现为例,如图7所示,作为一个逻辑意义上的装置,是通过其所在设备的CPU将非易失性存储器中对应的计算机程序指令读取到内存中运行形成的。本实施例提供的基于游标指针的加权调度装置70包括:As shown in FIG. 6 and FIG. 7 , the embodiment of the present invention provides a cursor pointer-based weighted scheduling device. The device embodiments can be implemented by software, or by hardware or a combination of software and hardware. From the hardware level, as shown in Figure 6, it is a hardware structure diagram of the device where the weighted scheduling device based on the cursor pointer in the embodiment of the present invention is located, except for the processor, memory, network interface, and non-volatile memory shown in Figure 6 In addition to the volatile memory, the device where the device in the embodiment is located may generally include other hardware, such as a forwarding chip responsible for processing packets, and the like. Taking software implementation as an example, as shown in Figure 7, as a device in a logical sense, it is formed by reading the corresponding computer program instructions in the non-volatile memory into the memory for operation by the CPU of the device where it is located. The cursor pointer-based weighted scheduling device 70 provided in this embodiment includes:
建立单元701,用于根据所有通信链路对象建立环形链表,并从环形链表中选择一个通信链路对象将其作为目标通信链路对象;The establishment unit 701 is configured to establish a circular linked list according to all communication link objects, and select a communication link object from the circular linked list as a target communication link object;
处理单元702,用于将游标指针指向目标通信链路对象,并利用目标通信链路对象传输数据包;A processing unit 702, configured to point the cursor pointer to the target communication link object, and use the target communication link object to transmit data packets;
选择单元703,用于在目标通信链路对象达到设定条件时,以目标通信链路对象作为起点,以设定顺序选择下一个通信链路对象作为当前的目标通信链路对象,并利用当前的目标通信链路对象触发处理单元继续执行操作。The selection unit 703 is configured to select the next communication link object as the current target communication link object in the set order by using the target communication link object as the starting point when the target communication link object reaches the set condition, and use the current target communication link object The target communication link object triggers the processing unit to continue performing operations.
在本发明一个实施例中,如图8所示,基于游标指针的加权调度装置可以进一步包括:In one embodiment of the present invention, as shown in FIG. 8, the cursor pointer-based weighted scheduling device may further include:
存储单元801,用于预先为每一条通信链路对象存储权重属性值和运行权重属性值;其中,针对每一条通信链路对象所设定的权重属性值与运行权重属性值相等;The storage unit 801 is used to pre-store the weight attribute value and the operation weight attribute value for each communication link object; wherein, the weight attribute value set for each communication link object is equal to the operation weight attribute value;
更新单元802,用于每利用目标通信链路对象传输一次数据包,则执行一次将目标通信链路对象的运行权重属性值进行更新操作,以使更新后的运行权重属性值小于更新前的运行权重属性值,并在更新后的运行权重属性值满足设定值时,确定目标通信链路对象达到设定条件。The update unit 802 is configured to perform an operation of updating the operation weight attribute value of the target communication link object every time the data packet is transmitted by the target communication link object, so that the updated operation weight attribute value is smaller than the operation weight attribute value before the update. weight attribute value, and when the updated operation weight attribute value meets the set value, it is determined that the target communication link object meets the set condition.
进一步地,更新单元802,用于将所目标通信链路对象的运行权重属性值减1;其中,设定值等于0。Further, the updating unit 802 is configured to subtract 1 from the running weight attribute value of the target communication link object; wherein, the set value is equal to 0.
进一步地,更新单元802,用于将目标通信链路对象的运行权重属性值更新为相应地权重属性值。Further, the updating unit 802 is configured to update the running weight attribute value of the target communication link object to a corresponding weight attribute value.
进一步地,选择单元703,用于以目标通信链路对象作为起点,以顺时针选择下一个通信链路对象作为当前的目标通信链路对象;或,用于以目标通信链路对象作为起点,以逆时针选择下一个通信链路对象作为当前的目标通信链路对象。Further, the selection unit 703 is configured to use the target communication link object as a starting point to select the next communication link object clockwise as the current target communication link object; or, to use the target communication link object as a starting point, Select the next communication link object counterclockwise as the current target communication link object.
综上,本发明实施例至少可以实现如下有益效果:In summary, the embodiments of the present invention can at least achieve the following beneficial effects:
1、通过根据所有通信链路对象建立环形链表,以利用游标指针所指向的通信链路对象确定当前正在使用的目标通信链路对象,并在将目标通信链路对象完成使用,在选择通信链路对象时不需要计算查找,直接选择环形链表上的下一个通信链路对象作为目标通信链路对象即可,从而使得在选择通信链路对象时处理速度是不变的,不会因通信链路对象的数量增多而影响处理速度,进而提高了数据流量包的传输效率。1. Establish a circular linked list based on all communication link objects, use the communication link object pointed by the cursor pointer to determine the target communication link object currently in use, and after the target communication link object is used, select the communication link object There is no need to calculate and search for the path object, just select the next communication link object on the ring list directly as the target communication link object, so that the processing speed is unchanged when the communication link object is selected, and it will not be affected by the communication link The increase in the number of road objects affects the processing speed, thereby improving the transmission efficiency of data traffic packets.
2、实现了加权算法,在选择通信链路对象时无需查找最大权重值,直接从active_head上获取到的既是被选的通信链路对象。2. The weighting algorithm is implemented. When selecting a communication link object, there is no need to find the maximum weight value, and the selected communication link object is obtained directly from the active_head.
3、实现方法简洁易懂,采用链表操作在软件开发中易于实现。3. The implementation method is simple and easy to understand, and it is easy to implement in software development by using linked list operations.
4、对通信链路对象的选择过程处理耗时固定,不受通信链路对象数量大小的影响,避免软件运行和处理时性能跳动。4. The selection process of communication link objects takes a fixed amount of time and is not affected by the number of communication link objects, avoiding performance jumps during software operation and processing.
上述设备内的各单元之间的信息交互、执行过程等内容,由于与本发明方法实施例基于同一构思,具体内容可参见本发明方法实施例中的叙述,此处不再赘述。The information exchange and execution process among the units in the above-mentioned equipment are based on the same concept as the method embodiment of the present invention, and the specific content can refer to the description in the method embodiment of the present invention, and will not be repeated here.
需要说明的是,在本文中,诸如第一和第二之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个〃〃〃〃〃〃”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同因素。It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is a relationship between these entities or operations. There is no such actual relationship or sequence. Furthermore, the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also includes elements not expressly listed. other elements of or also include elements inherent in such a process, method, article, or device. Without further limitations, an element defined by the phrase "comprising a """""" does not exclude the presence of additional same elements in the process, method, article or apparatus comprising said element.
本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储在计算机可读取的存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质中。Those of ordinary skill in the art can understand that all or part of the steps to realize the above method embodiments can be completed by program instructions related hardware, and the aforementioned programs can be stored in a computer-readable storage medium. When the program is executed, the It includes the steps of the above method embodiments; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other various media that can store program codes.
最后需要说明的是:以上所述仅为本发明的较佳实施例,仅用于说明本发明的技术方案,并非用于限定本发明的保护范围。凡在本发明的精神和原则之内所做的任何修改、等同替换、改进等,均包含在本发明的保护范围内。Finally, it should be noted that the above descriptions are only preferred embodiments of the present invention, and are only used to illustrate the technical solution of the present invention, and are not used to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present invention are included in the protection scope of the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510450187.XA CN105119839A (en) | 2015-07-28 | 2015-07-28 | Weighted scheduling method and device based on current_link |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510450187.XA CN105119839A (en) | 2015-07-28 | 2015-07-28 | Weighted scheduling method and device based on current_link |
Publications (1)
Publication Number | Publication Date |
---|---|
CN105119839A true CN105119839A (en) | 2015-12-02 |
Family
ID=54667734
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510450187.XA Pending CN105119839A (en) | 2015-07-28 | 2015-07-28 | Weighted scheduling method and device based on current_link |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105119839A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114385579A (en) * | 2022-01-04 | 2022-04-22 | 北京全路通信信号研究设计院集团有限公司 | A log writing method, device, device and medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1434393A (en) * | 2003-02-24 | 2003-08-06 | 武汉大学 | Dynamic loading balance method for cluster server |
CN101373509A (en) * | 2008-10-10 | 2009-02-25 | 华南理工大学 | A Kind of RFID Middleware Based on Distributed ALE |
JP2009100118A (en) * | 2007-10-15 | 2009-05-07 | Mitsubishi Electric Corp | Transmission device, reception device, communication device, and communication method |
CN103338493A (en) * | 2013-05-31 | 2013-10-02 | 同济大学 | Adaptive multi-path route method based on RPL |
CN104202255A (en) * | 2014-08-26 | 2014-12-10 | 浪潮(北京)电子信息产业有限公司 | Efficient multi-link data transmission implementation method |
-
2015
- 2015-07-28 CN CN201510450187.XA patent/CN105119839A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1434393A (en) * | 2003-02-24 | 2003-08-06 | 武汉大学 | Dynamic loading balance method for cluster server |
JP2009100118A (en) * | 2007-10-15 | 2009-05-07 | Mitsubishi Electric Corp | Transmission device, reception device, communication device, and communication method |
CN101373509A (en) * | 2008-10-10 | 2009-02-25 | 华南理工大学 | A Kind of RFID Middleware Based on Distributed ALE |
CN103338493A (en) * | 2013-05-31 | 2013-10-02 | 同济大学 | Adaptive multi-path route method based on RPL |
CN104202255A (en) * | 2014-08-26 | 2014-12-10 | 浪潮(北京)电子信息产业有限公司 | Efficient multi-link data transmission implementation method |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114385579A (en) * | 2022-01-04 | 2022-04-22 | 北京全路通信信号研究设计院集团有限公司 | A log writing method, device, device and medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8762396B2 (en) | Dynamic, hierarchical bloom filters for network data routing | |
US9585049B2 (en) | Method for multipath scheduling based on a lookup table | |
US11797534B2 (en) | Efficient SQL-based graph random walk | |
US10476985B1 (en) | System and method for resource management and resource allocation in a self-optimizing network of heterogeneous processing nodes | |
CN103631657A (en) | Task scheduling algorithm based on MapReduce | |
CN105262794B (en) | Content put-on method and device | |
WO2024174915A1 (en) | Information control method and system, electronic device, and readable storage medium | |
CN107404541A (en) | A kind of method and system of peer-to-peer network transmission neighbor node selection | |
CN116089031A (en) | A Heterogeneous Task Scheduling Method Based on Ant Colony Optimization Algorithm | |
WO2023231339A1 (en) | Transaction execution method and node in blockchain system, and blockchain system | |
WO2024021412A1 (en) | Structured p2p network optimization | |
CN112463291A (en) | Virtual machine deployment method, device, equipment and readable storage medium | |
CN108763381A (en) | Divide table method and apparatus based on consistency hash algorithm | |
CN113377510B (en) | Cache packet scheduling optimization algorithm based on consistent hashing in serverless computing environment | |
CN108696427A (en) | A kind of data transmission method and device | |
CN105119839A (en) | Weighted scheduling method and device based on current_link | |
US10516613B1 (en) | Network device storage of incremental prefix trees | |
US9298505B2 (en) | Time and space-deterministic task scheduling apparatus and method using multi-dimensional scheme | |
EP3777047B1 (en) | System and method for resource management and resource allocation in a self-optimizing network of heterogeneous processing nodes | |
CN109525407B (en) | A method and readable storage medium for generating a full coverage nested container with no intersection at the same layer | |
TW202427248A (en) | Geometric stream data processing method, computing device and computer readable storage medium | |
CN116737370A (en) | Multi-resource scheduling method, system, storage medium and terminal | |
CN115665082A (en) | Method and system for identifying key nodes of social network based on information entropy improvement | |
US12198024B2 (en) | Configuring autosave triggers based on value metrics | |
Chao et al. | Intelligent interaction design research based on block chain communication technology and fuzzy system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20151202 |
|
WD01 | Invention patent application deemed withdrawn after publication |