[go: up one dir, main page]

CN100417138C - A method of load sharing - Google Patents

A method of load sharing Download PDF

Info

Publication number
CN100417138C
CN100417138C CNB2005101016826A CN200510101682A CN100417138C CN 100417138 C CN100417138 C CN 100417138C CN B2005101016826 A CNB2005101016826 A CN B2005101016826A CN 200510101682 A CN200510101682 A CN 200510101682A CN 100417138 C CN100417138 C CN 100417138C
Authority
CN
China
Prior art keywords
path
load sharing
flow identifier
hop
paths
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.)
Expired - Fee Related
Application number
CNB2005101016826A
Other languages
Chinese (zh)
Other versions
CN1859286A (en
Inventor
刘少伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CNB2005101016826A priority Critical patent/CN100417138C/en
Publication of CN1859286A publication Critical patent/CN1859286A/en
Application granted granted Critical
Publication of CN100417138C publication Critical patent/CN100417138C/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本发明公开了一种负载分担的方法,当通信设备所接收报文的下一跳路径多于一条时,根据通信设备所支持的下一跳最大支持路径数目得到所需流的数量,并为每个流分配流标识。且每个流标识值唯一对应一条确定的下一跳路径,这样路由可以直接选取路径标识,不用读取门限值从而确定对应的路径标识,从而避免读取门限值造成的对访问同一块内存带来的性能瓶颈。所以本发明的负载分担方法适合高速设备使用。同时,当由于路由发生变化而带来的下一跳路径增加或减少时,通过按照流标识改变路径数最少原则来更改流标识与路径的对应关系可以解决现有技术中在增删负载分担路径时,带来的大量流出现误乱序问题,此外,本发明也可以解决非等分的负载分担问题。

Figure 200510101682

The invention discloses a method for load sharing. When the next-hop path of the message received by the communication device is more than one, the number of required flows is obtained according to the maximum number of next-hop supported paths supported by the communication device, and is Each stream is assigned a stream ID. And each flow identifier value uniquely corresponds to a determined next-hop path, so that the route can directly select the path identifier without reading the threshold value to determine the corresponding path identifier, thereby avoiding the access to the same block caused by reading the threshold value Performance bottlenecks caused by memory. Therefore, the load sharing method of the present invention is suitable for high-speed equipment. At the same time, when the next-hop path increases or decreases due to the change of the route, the corresponding relationship between the flow identifier and the path can be changed by changing the corresponding relationship between the flow identifier and the path according to the principle of changing the least number of paths according to the flow identifier. , a large number of streams caused by the out-of-sequence problem, in addition, the present invention can also solve the non-equal load sharing problem.

Figure 200510101682

Description

一种负载分担的方法 A method of load sharing

技术领域 technical field

本发明涉及通信领域,尤其是涉及一种负载分担的方法。The invention relates to the communication field, in particular to a load sharing method.

背景技术 Background technique

在实际网络中,由于节点之间的拓扑关系比较复杂,经常会出现到一个目的地有多条路的情况。多条路可能都可以到达,并且相互之间是对等的,即都会形成路由。这样到一个目的地就会有多条等价路由出现。In an actual network, due to the complex topological relationship between nodes, there are often multiple paths to a destination. Multiple paths may be reachable, and they are equal to each other, that is, they all form routes. In this way, there will be multiple equal-cost routes to a destination.

如图1所示,从节点R1到R8,可以有三条路,如果路由计算将这三条路作为等价路由对待,那么在R1节点,一个报文就面临三个选择。As shown in Figure 1, there may be three paths from node R1 to R8. If the routing calculation treats these three paths as equal-cost routes, then at node R1, a packet faces three choices.

第一条路:R1-》R2-》R3-》R4-》R8The first road: R1-》R2-》R3-》R4-》R8

第二条路:R1-》R5-》R8The second road: R1-"R5-"R8

第三条路:R1-》R6-》R7-》R8The third road: R1-》R6-》R7-》R8

对于网上的流量,有时会为了实现链路备份或者扩大流量,也会采用分担的方式,即去往同一个地方会出现多条路径,多条路上都有流量存在,相互之间是流量分担的,即负载分担。负载分担的第一个目标是尽量把流量分的均衡,多个链路都可以充分发挥作用。For online traffic, sometimes in order to achieve link backup or expand traffic, a sharing method is also adopted, that is, there will be multiple paths to the same place, and traffic exists on multiple paths, and traffic is shared between each other , that is, load sharing. The first goal of load sharing is to balance the traffic as much as possible, so that multiple links can fully play their roles.

负载分担在很多地方都会出现。比如我们最常见的IP路由器上,或者标签交换路径(LSP)的交换设备上。Load sharing occurs in many places. For example, on our most common IP router, or on the switching device of the label switching path (LSP).

在下一代网络中,采用的多网融合的方案,即在一张网络上传送多种业务,对于同一个下一跳路由器可能会有一个或者多个路径出现,如果对于同一个流分配到不同的路径上,同一个流的概念是从同一个源来并去往同一个目的地,并且有一些共同特征的数据包的集合,因为不同的路径经过的节点数量不同,经过的传输链路距离不同、不同节点的拥塞程度和缓存大大小不同,会造成不同路径的时延也不同,此时同一个流到达目的地的时间就可能出现不同,可能出现乱序。In the next-generation network, the solution of multi-network integration is adopted, that is, multiple services are transmitted on one network. There may be one or more paths for the same next-hop router. If the same flow is allocated to different On the path, the concept of the same flow is a collection of data packets that come from the same source and go to the same destination, and have some common characteristics, because the number of nodes passed by different paths is different, and the distance of the transmission link passed Different nodes have different congestion levels and buffer sizes, which will cause different delays on different paths. At this time, the arrival time of the same flow at the destination may be different, and may be out of order.

对于使用传输控制协议(TCP)传送的流量,乱序在目的节点会被认为是报文丢失,会出现重传,造成网络流量变大,严重的会出现TCP断连接。同时如果是传送的实时业务,比如因特网语音通信(Voice Over IP;VOIP),对于终端用户,话音质量会不可忍受,会出现断断续续或者不清楚的现象。For traffic transmitted using the Transmission Control Protocol (TCP), out-of-sequence will be considered as packet loss at the destination node, and retransmission will occur, resulting in increased network traffic, and in severe cases, TCP disconnection will occur. At the same time, if it is a real-time service transmitted, such as Internet voice communication (Voice Over IP; VOIP), for end users, the voice quality will be unbearable, and there will be intermittent or unclear phenomena.

因此,在下一代网络中,路由器转发时,将同一个流使用同一个路径转发是非常重要的一个特性。因此负载分担的第二个要求是,同一个流不能出现乱序。Therefore, in the next generation network, when routers forward, it is a very important feature to use the same path to forward the same flow. Therefore, the second requirement of load sharing is that the same stream cannot be out of order.

目前,现有技术是按照流实现负载分担的方法,其利用了D.Thaler提出的哈希门限算法。哈希门限算法,是通过将报文头中的域进行Hash,得到的Hash值作为流的标识,对于IP报文一般使用源IP地址和目的IP地址进行Hash。在负载分担时,Hash算法可采用CRC16的算法进行。At present, the existing technology is a method of realizing load sharing according to flows, which utilizes the hash threshold algorithm proposed by D. Thaler. The hash threshold algorithm is to hash the field in the packet header, and the obtained hash value is used as the identifier of the flow. For IP packets, the source IP address and destination IP address are generally used for hashing. During load sharing, the Hash algorithm can use the CRC16 algorithm.

在负载分担时,对Hash值设置多个门限,比如有8个等价路由,Hash值为0~65535,那么就将0~65535八等分,Hash值落在第一个区间内,就走第一条路,Hash值落在第n个区间内就走第n条路。When load sharing, set multiple thresholds for the Hash value. For example, if there are 8 equal-cost routes, and the Hash value is 0 to 65535, then divide 0 to 65535 into eight equal parts. In the first way, if the Hash value falls within the nth interval, take the nth way.

当由于路由变化需要增加路径时,同时修改门限值,比如从3条路径变为4条路径,那么用65535除以4,然后再乘以n就得到了第n条路径的区间。说明如下:When it is necessary to add paths due to routing changes, modify the threshold at the same time, for example, from 3 paths to 4 paths, then divide 65535 by 4, and then multiply by n to get the interval of the nth path. described as follows:

假定原来有3条等价路由(3个下一跳),其门限设置如下:Suppose there are 3 equal-cost routes (3 next hops), and the threshold is set as follows:

Figure C20051010168200051
Figure C20051010168200051

现在增加一个下一跳,变为4个下一跳,此时分配关系的变化如下所示:Now add a next hop to change to 4 next hops. At this time, the changes in the allocation relationship are as follows:

Figure C20051010168200061
Figure C20051010168200061

这样就实现了按照流的负载分担。In this way, load balancing according to flows is realized.

在现有技术中,在负载分担的下一跳较多时,因为每次都要读取Hash门限,那么在高速设备中会出现对某一快存储区的访问竞争,导致出现瓶颈,所以高速设备的性能很难做到很高。同时,由于路由的变化,在下一跳需要增加删除路径时,会出现大量流更换路径,造成潜在的不必要的大量乱序。下面详细说明这个问题。In the prior art, when there are many next hops for load sharing, because the Hash threshold must be read every time, there will be access competition for a certain fast storage area in the high-speed device, resulting in a bottleneck, so the high-speed device It is difficult to achieve high performance. At the same time, due to routing changes, when the next hop needs to add and delete paths, a large number of flows will change paths, resulting in potentially unnecessary large amounts of disorder. This problem is detailed below.

其中改变下一跳的流标识(ID)范围为如下所示,其中图中灰色部分为改变路径的部分。The flow identification (ID) range of changing the next hop is as follows, and the gray part in the figure is the part of changing the path.

Figure C20051010168200062
Figure C20051010168200062

总共改变路径的流的比例为:The total fraction of streams that change paths is:

((65535-49151)+(43690-32767)+21845-16383))/65536=50%((65535-49151)+(43690-32767)+21845-16383))/65536=50%

但当我们增加了一条路径(下一跳)时,最多只需要有25%的流量改变路径到这条路上即可,也就是说有50%-25%=25%的流量不需要改变路径。But when we add a path (next hop), at most 25% of the traffic only needs to change the path to this path, that is to say, 50%-25%=25% of the traffic does not need to change the path.

改变路径,就意味着在切换的时间段内,这些流可能会出现乱序。我们通过上述例子可以看到,使用这种方法,除了需要切换的流量外,还有很大比例的流量被误切换了路径,出现了不必要的乱序。乱序对于TCP流量就会带来重传,对于语音等,就意味着出现质量下降。这个问题,在减少路径(下一跳时)也同样存在。Changing the path means that during the switching period, these streams may appear out of order. We can see from the above examples that, using this method, in addition to the traffic that needs to be switched, a large proportion of traffic is switched by mistake, resulting in unnecessary disorder. Out-of-order will lead to retransmission for TCP traffic, and for voice, etc., it means quality degradation. This problem also exists when reducing the path (next hop).

发明内容 Contents of the invention

有鉴于此,本发明的主要目的是在提供一种负载分担的方法,使得在实现负载分担的同时,能优化高速设备的处理性能,同时解决由于路径变化时所导致的大比例误乱序问题。In view of this, the main purpose of the present invention is to provide a method of load sharing, so that while realizing load sharing, the processing performance of high-speed devices can be optimized, and at the same time, the problem of large-scale error and out-of-sequence caused by path changes can be solved .

本发明提供一种负载分担的方法,具体包括如下步骤,The present invention provides a method for load sharing, which specifically includes the following steps,

A.当通信设备所接收报文的下一跳路径多于一条时,根据通信设备所支持的下一跳最大支持路径数目得到所需流的数量值,并为每个流分配流标识,所述流的数量值大于等于所述的下一跳最大支持路径数目。A. When the next hop path of the message received by the communication device is more than one, the number of required flows is obtained according to the maximum number of supported next hop paths supported by the communication device, and a flow identifier is assigned to each flow, so The value of the number of flows mentioned above is greater than or equal to the number of the maximum number of paths supported by the next hop.

B.通信设备根据所述报文的目的地址和所述的流标识来使每个流唯一对应一条确定的下一跳路径;B. The communication device makes each flow uniquely correspond to a determined next-hop path according to the destination address of the message and the flow identifier;

C.通信设备根据所述的下一跳路径进行所述报文的负载分担转发。所述的步骤A中流的数量值是1至下一跳最大支持路径数目的公倍数。C. The communication device performs load sharing and forwarding of the message according to the next-hop path. The value of the number of streams in step A is a common multiple of the maximum number of supported paths from 1 to the next hop.

所述的步骤A中的流的数量值,根据流量分配比例的误差要求,取接近1至下一跳最大支持路径数目的公倍数的2的整次幂的值。The quantity value of the flow in the step A, according to the error requirement of the traffic distribution ratio, takes a value close to the integer power of 2 that is the common multiple of the maximum supported path number of the next hop.

所述的流标识是根据所述报文头的域的内容通过哈希算法得出的。The flow identifier is obtained through a hash algorithm according to the content of the field of the message header.

所述的报文头的域包括源地址、目的地址、报文生存时间、源端口号、目的端口号、协议类型之一或任意组合。The fields of the message header include source address, destination address, message lifetime, source port number, destination port number, protocol type, or any combination thereof.

所述的步骤B具体包括,Described step B specifically comprises,

B1、在路由的路由表中设置负载分担表,所述的负载分担表包括流标识和下一跳标识;B1. A load sharing table is set in the routing table of the route, and the load sharing table includes a flow identifier and a next hop identifier;

B2、通信设备根据所述报文的目的地址和所述的流标识在所述的负载分担表中查找下一跳路径。B2. The communication device searches for a next-hop path in the load sharing table according to the destination address of the message and the flow identifier.

步骤B中所述流标识和下一跳路径的对应关系中,所述的下一跳路径根据不同路径所需分担的流量比例来对应一个或多个流标识。In the correspondence between the flow identifier and the next-hop path in step B, the next-hop path corresponds to one or more flow identifiers according to the proportion of traffic that needs to be shared by different paths.

当路径需要删除或增加时,根据所述的比例修改流标识和路径的对应关系。When a path needs to be deleted or added, the corresponding relationship between the flow identifier and the path is modified according to the ratio.

还包括根据所述流标识改变路径数最少来改变流标识与路径的对应关系。It also includes changing the corresponding relationship between the flow identifier and the path by changing the number of paths to be the least according to the flow identifier.

所述的下一跳最大支持路径数目发生改变时,要重新计算流的数量并得出流标识,并且要初始化负载分担流标识和路径所对应的负载分担表。When the maximum number of paths supported by the next hop changes, the number of flows must be recalculated to obtain the flow ID, and the load sharing table corresponding to the load sharing flow ID and the path must be initialized.

由上述本发明提供的技术方案可以看出,通过对数据报文进行Hash得到有限的流标识,且每个流标识值唯一对应一条确定的下一跳路径,这样路由其可以直接选取路径标识,不用读取门限值从而确定对应的路径标识。这样,就避免的读取门限值造成的对访问同一块内存带来的高速设备的性能瓶颈。所以本发明的负载分担方法适合高速设备使用。同时,当由于路由发生变化而带来的下一跳路径增加或减少时,通过按照流标识改变路径数最少原则来更改流标识的路径可以解决现有技术中在增删负载分担路径时,带来的大量流出现误乱序问题,同时,本发明也可以解决非等分的负载分担问题。It can be seen from the above-mentioned technical solution provided by the present invention that limited flow identifiers are obtained by performing Hash on the data message, and each flow identifier value uniquely corresponds to a certain next-hop path, so that the route can directly select the path identifier, The corresponding path identifier is determined without reading the threshold value. In this way, the performance bottleneck of high-speed devices caused by accessing the same block of memory caused by the read threshold is avoided. Therefore, the load sharing method of the present invention is suitable for high-speed equipment. At the same time, when the next hop path increases or decreases due to the change of the route, the path of the flow identifier can be changed by changing the path of the flow identifier according to the principle of changing the least number of paths. The problem of out-of-sequence occurs in a large number of streams, and at the same time, the present invention can also solve the problem of non-equal load sharing.

附图说明 Description of drawings

图1为现有网络中路由器的拓扑示意图;Fig. 1 is the topological schematic diagram of the router in the existing network;

图2为本发明的方法流程图;Fig. 2 is method flowchart of the present invention;

图3是本发明的一实施例的方法示意图。Fig. 3 is a schematic diagram of a method according to an embodiment of the present invention.

具体实施方式 Detailed ways

本发明提供了一种负载分担的方法,其核心思想是通过数据结构的设计,消除读取门限值的过程,提高高速设备的处理性能。并且通过路径数量变化时,对改变路径路由精确比例的控制,完全或者在可以接受的范围内消除误乱序问题。The invention provides a load sharing method, the core idea of which is to eliminate the process of reading the threshold value and improve the processing performance of the high-speed equipment through the design of the data structure. And when the number of paths changes, the control of changing the precise ratio of path routing can completely or within an acceptable range eliminate the problem of misordering.

为使本发明的目的、技术方案和优点表达得更加清楚明白,下面结合附图及具体实施例对本发明再作进一步详细的说明:In order to make the purpose, technical solutions and advantages of the present invention more clearly, the present invention will be described in further detail below in conjunction with the accompanying drawings and specific embodiments:

参见图2,See Figure 2,

步骤201、当通信设备所接收报文的下一跳路径多于一条时,根据通信设备所支持的下一跳最大支持路径数目得到所需流的数量,并为每个流分配流标识。Step 201. When the communication device receives more than one next-hop path for the message, obtain the number of required flows according to the maximum supported number of next-hop paths supported by the communication device, and assign a flow identifier to each flow.

本发明中,所述的Hash计算的输入值是数据报文头的域的内容,所述的报文头中的域可以是报文头中域的内容,输出值是一个流标识。所述的报文头的域包括但不限于源地址、目的地址、报文生存时间、源端口号、目的端口号、协议类型之一或任意组合。In the present invention, the input value of the Hash calculation is the content of the field in the data message header, the field in the message header can be the content of the field in the message header, and the output value is a flow identifier. The fields of the message header include but are not limited to one or any combination of source address, destination address, message lifetime, source port number, destination port number, protocol type.

假设将数据流一共分为N个,HASH算法直接得到的是0至N-1的值,每个值直接对应一个路径。Assuming that the data stream is divided into N, the HASH algorithm directly obtains values from 0 to N-1, and each value directly corresponds to a path.

N的值可以这样选取:假定路由表中下一跳最大支持L条路径,所述的下一跳最大支持路径数目是一个预先已经设定好的值,可以是通过命令行设定的,也可以是通过网管来设定的;如果下一跳最大支持路径数目发生改变,要重新通过HASH计算最大流标识数量,并且要初始化负载分担流标识和路径所对应的负载分担表(LBT);The value of N can be selected in this way: assuming that the next hop in the routing table supports a maximum of L paths, the maximum number of paths supported by the next hop is a pre-set value, which can be set through the command line, or It can be set through the network management; if the maximum number of paths supported by the next hop changes, the maximum number of flow identifiers must be recalculated through HASH, and the load sharing table (LBT) corresponding to the load sharing flow identifier and the path must be initialized;

如果为了保证负载均衡,理论上N应该能够被1~L整除,例如下一跳支持X条有效路由,则数据流0~N被整数倍地平均分配到X条有效路由中。下面我们以下一跳最大支持路径L=3来说明N值的选取,当L=3时,N理论上最小取值应为6,因为例子中当下一跳为3条路径,数据流的数量若要实现负载均衡,则数据流的数量应能够被3整除;由于L为3时下一跳最大支持路径,则当下一跳为2条路径时,数据流的数量应能够被2整除,才能实现负载均衡。所以在例子中,整个数据包的传送若要实现负载均衡,则数据流N的值应同时能被2和3整除,即当L=3时,N理论上最小取值应为6。同理,当L=16时,一般下一跳最大支持路径数目都不会超过这个值,即正常情况下在8以内,N的值理论上最小取值为9×5×7×11×13×16,其中16×9×5×7包括了当N=1、2、3、4、6、8、10、12或14的情形。In order to ensure load balancing, theoretically N should be divisible by 1~L, for example, the next hop supports X effective routes, then data streams 0~N are evenly distributed to X effective routes by integer multiples. Next, let's illustrate the selection of the value of N with the maximum supported path L=3 in the next hop. When L=3, the theoretical minimum value of N should be 6, because in the example, when the next hop is 3 paths, the number of data streams is as follows: To achieve load balancing, the number of data streams should be divisible by 3; since the maximum path supported by the next hop when L is 3, when the next hop is 2 paths, the number of data streams should be divisible by 2 to achieve load balanced. Therefore, in the example, if the transmission of the entire data packet is to achieve load balancing, the value of the data flow N should be divisible by 2 and 3 at the same time, that is, when L=3, the theoretical minimum value of N should be 6. Similarly, when L=16, generally the maximum number of supported paths for the next hop will not exceed this value, that is, under normal circumstances, it is within 8, and the theoretical minimum value of N is 9×5×7×11×13 ×16, wherein 16×9×5×7 includes the cases when N=1, 2, 3, 4, 6, 8, 10, 12 or 14.

当最大支持的负载分担路径在2至8时数据流N的最小取值如下所示。When the maximum supported load sharing path is 2 to 8, the minimum value of data flow N is as follows.

  L L   最小理论N Minimum theoretical N   2 2   2 2   3 3   6 6   4 4   12 12   5 5   60 60   6 6   60 60   7 7   420 420   8 8   840 840

从中我们可以看出,当L的取值越大时,数据流N的最小取值增长速度很快,这样计算出来的N值会很大,如果计算机内存够大,则可以按照这个来设计,但在实际中,我们可以适当简化为,选取一个L的若干倍的值作为N即可。因为在高速设备中通过Hash算法得出来得值一般为2的整次幂,所以可以选取一个大于L的2的整次幂来作为N,例如可以按照如下来进行近似选取:From this we can see that when the value of L is larger, the minimum value of the data stream N increases rapidly, so the calculated value of N will be very large. If the computer memory is large enough, it can be designed according to this. But in practice, we can appropriately simplify it to just select a value that is several times of L as N. Because the value obtained by the Hash algorithm in high-speed equipment is generally an integer power of 2, so an integer power of 2 larger than L can be selected as N, for example, it can be approximated as follows:

  L L   N N   2 2   2 2   3 3   8 8   4 4   16 16   5 5   64 64   6 6   64 64   7 7   64 64   8 8   64 64

步骤202、通信设备根据所述报文的目的地址和所述的流标识来使每个流唯一对应一条确定的下一跳路径;Step 202, the communication device makes each flow uniquely correspond to a determined next-hop path according to the destination address of the message and the flow identifier;

通信设备中流标识对应的下一跳路径在查找之前已经是唯一确定的。我们可以在路由表中初始化设置一个负载分担表,所述的负载分担表至少包括流标识和下一跳标识两个字段;通信设备根据所述报文的目的地址和所述的流标识的值在负载分担表中确定下一跳路径。需要说明的是,一个流标识唯一对应一个确定的下一跳路径,但是一个确定的下一跳路径可以对应一个或者多个流标识。The next-hop path corresponding to the flow identifier in the communication device has been uniquely determined before the search. We can initialize a load sharing table in the routing table, and the load sharing table includes at least two fields of the flow identifier and the next hop identifier; the communication device according to the destination address of the message and the value of the flow identifier Determine the next-hop path in the load balancing table. It should be noted that a flow identifier uniquely corresponds to a determined next-hop path, but a determined next-hop path may correspond to one or more flow identifiers.

如果要求平均分配流量时,则每个下一跳路径所分担的流标识是等分的。如果要求流量在不同路径上按不同比例进行分配,则每个下一跳路径分分担的流标识是按照所要求的比例进行分配的。If it is required to distribute traffic evenly, the flow identifiers shared by each next-hop path are equally divided. If traffic is required to be allocated in different proportions on different paths, the flow identifier shared by each next-hop path is allocated in accordance with the required proportion.

当由于路由发生变化、人工通过命令行进行转发路径的增删或来自转发层面的快速自动发现机制发现其中有路径不可达等情况而导致下一跳路径需要删除或增加时,仅仅需要根据所述的比例修改流标识和路径的对应关系,而无需根据流标识的顺序来改变流标识与路径的对应关系。尤其是,我们可以根据所述流标识改变路径数最少来改变流标识与路径的对应关系,这样可以有效地减少大量流变化而引起的流乱序问题。When the next-hop path needs to be deleted or added due to changes in routing, manual addition and deletion of forwarding paths through the command line, or the rapid automatic discovery mechanism from the forwarding layer discovers that some of the paths are unreachable, etc., only need to be based on the above-mentioned The ratio modifies the corresponding relationship between flow identifiers and paths without changing the corresponding relationship between flow identifiers and paths according to the order of flow identifiers. In particular, we can change the corresponding relationship between the flow identifier and the path according to the flow identifier changing the least number of paths, which can effectively reduce the problem of flow disorder caused by a large number of flow changes.

步骤203、通信设备根据所述的下一跳路径进行所述报文的负载分担转发Step 203, the communication device performs load sharing and forwarding of the message according to the next hop path

下面以IPV4转发中的负载分担为例来说明本发明的负载分担方法的实现。The following takes load sharing in IPV4 forwarding as an example to illustrate the implementation of the load sharing method of the present invention.

IPV4转发选路是经过查找FIB来得到,FIB是由是一个带有掩码长度的IP地址为索引的下一跳路径来组成的。The IPV4 forwarding route selection is obtained by searching the FIB. The FIB is composed of a next-hop path indexed by an IP address with a mask length.

查FIB表,是用包的目的IP地址作为Key值,来查找一个表,或者一棵树,得到最长匹配的表项(最精确匹配、最优的表项)。例如目的地址为1.1.1.1,路由表中有两项,一项是1.1.1.*/24,一项是1.1.*.*/16,斜杠后面标识掩码,那么该目的地地址将匹配上1.1.1.*/24这条路由,因为它比1.1.*.*/16更精确。To look up the FIB table, use the destination IP address of the packet as the Key value to search a table or a tree to obtain the longest matching entry (the most accurate match, the optimal entry). For example, the destination address is 1.1.1.1, and there are two items in the routing table, one is 1.1.1.*/24, the other is 1.1.*.*/16, and the mask is marked after the slash, then the destination address will be Matches the route 1.1.1.*/24 because it is more precise than 1.1.*.*/16.

匹配到表项以后,可以得到一条路径,该路径通过下一跳IP地址+出接口来表示,也有用一个索引来表示的(例如使用邻接表的转发模型),下文中,不论上述两种情况,对一个下一跳路径统一用NH来标识。After the entry is matched, a path can be obtained, which is represented by the next hop IP address + outgoing interface, and also represented by an index (for example, using the forwarding model of the adjacency table). In the following, regardless of the above two cases , a next-hop path is uniformly identified by NH.

本发明中的FIB表项逻辑结构如下所示,The logical structure of the FIB entry in the present invention is as follows,

NH NH 负载分担标志位LF Load sharing flag LF 其它标志位和表项内容 Other flag bits and table entry content 负载分担表指针LP Load sharing table pointer LP

其中,NH和其它标志位和表项内容同一般的FIB表,在LF为0时,表明没有多条路径,表项同一般的FIB一样,取NH转发;当负载分担标志位LF为1时,表明有多条路径,需要通过负载分担表指针LP来查找负载分担表(LBT)从而进行负载分担。Among them, the content of NH and other flag bits and entries is the same as that of the general FIB table. When LF is 0, it indicates that there are no multiple paths. The entry is the same as the general FIB, and NH is used for forwarding; when the load sharing flag LF is 1 , indicating that there are multiple paths, and the load sharing table (LBT) needs to be searched through the load sharing table pointer LP to perform load sharing.

当负载分担标志位LF为1时,表明有多条路径,需要通过负载分担表指针LP来进行负载分担。负载分担表指针LP通过查找负载分担表,来获得确定得下一跳路径。所述的负载分担表包括目的地址、流标识和下一跳标识三个字段;例如,负载分担表如下表所示,When the load sharing flag bit LF is 1, it indicates that there are multiple paths, and load sharing needs to be performed through the load sharing table pointer LP. The load sharing table pointer LP obtains the determined next-hop path by looking up the load sharing table. The load sharing table includes three fields: destination address, flow ID and next hop ID; for example, the load sharing table is shown in the following table,

Figure C20051010168200121
Figure C20051010168200121

我们以下一跳最大支持路径L=4为例说明,所对应的数据流N的值为16,那么每个流标识对应一条确定的路径。当下一跳有4条路径时,以NH1、NH2、NH3和NH4分别代替,为了实现负载分担,则数据流被平均分配到这4条路径上,而且数据流是否按照顺序被分配到这4条路径上与负载均衡没有关系。例如,当下一跳有4条路径时,每个流标识与下一条路径的对应关系可以如下表所示,Let's take the next hop maximum supported path L=4 as an example, and the value of the corresponding data flow N is 16, so each flow identifier corresponds to a certain path. When there are 4 paths for the next hop, replace them with NH1, NH2, NH3, and NH4 respectively. In order to achieve load sharing, the data flow is evenly distributed to these 4 paths, and whether the data flow is distributed to these 4 paths in order The path has nothing to do with load balancing. For example, when there are 4 paths for the next hop, the corresponding relationship between each flow identifier and the next path can be shown in the following table,

  流标识 Stream ID 00 11 22 33 44 55 66 77 88 99 1010 1111 1212 1313 1414 1515   路径 path   NH1 NH1   NH1 NH1   NH4 NH4   NH2 NH2   NH2 NH2   NH4 NH4   NH2 NH2   NH4 NH4   NH2 NH2   NH3 NH3   NH1 NH1   NH3 NH3   NH3 NH3   NH1 NH1   NH4 NH4   NH3 NH3

同时,我们根据流标识改变路径数最少原则来改变路径可以解决了在增删负载分担路径时,带来的大量流出现误乱序问题。下面我们结合上例来具体说明一下,At the same time, we change the path according to the principle of changing the least number of paths according to the flow identifier, which can solve the problem of misordering of a large number of flows when adding or deleting load sharing paths. Let's illustrate it in detail with the above example.

当上例中的下一跳的路径由4个变为3个时,比如NH4断掉了,则现在还有3条路径,分别为NH1、NH2和NH3,此时如果要实现负载分担,数据流标识0至15需要被平均分配到NH1、NH2和NH3上,根据流标识改变路径最少原则,则需要变化的路径应为将NH4的4条流标识尽可能平均分配到NH1、NH2和NH3上即可,则我们需要将NH1至NH3的每个路径上增加一个流标识,同时还要有一个路径再增加一个流标识,我们可以任选一个,比如NH1增加两个。通过变化后的可能分配如下:When the path of the next hop in the above example changes from 4 to 3, for example, NH4 is disconnected, there are still 3 paths, namely NH1, NH2 and NH3. Flow IDs 0 to 15 need to be evenly distributed to NH1, NH2, and NH3. According to the principle of changing the least number of flow IDs, the path that needs to be changed should be to distribute the 4 flow IDs of NH4 to NH1, NH2, and NH3 as evenly as possible. That is, we need to add a flow identifier to each path from NH1 to NH3, and at the same time add a flow identifier to a path. We can choose one, for example, add two to NH1. The possible assignments after passing the changes are as follows:

  流标识 Stream ID 00 11 22 33 44 55 66 77 88 99 1010 1111 1212 1313 1414 1515   路径 path   NH1 NH1   NH1 NH1   NH1 NH1   NH2 NH2   NH2 NH2   NH1 NH1   NH2 NH2   NH2 NH2   NH2 NH2   NH3 NH3   NH1 NH1   NH3 NH3   NH3 NH3   NH1 NH1   NH3 NH3   NH3 NH3

即原来走NH4的流,目前分别走NH1至NH3了,并且相对均匀,达到了负载分担的效果,被改变流的比例为:4/16=25%,且没有误乱序的出现。That is, the flow that originally went through NH4 is now going through NH1 to NH3 respectively, and it is relatively uniform, achieving the effect of load sharing. The ratio of the changed flow is: 4/16=25%, and there is no disorder.

当上例中的下一跳的路径由4个变为5个时,比如增加了NH5,此时如果要实现负载分担,数据流标识0至15应被尽可能地分配到NH1、NH2、NH3、NH4和NH5上。根据流标识改变路径最少原则,则需要变化的路径应为将NH1、NH2、NH3和NH4中的任意3条路径各取出一个流标识分配到NH5上即可。通过变化后的可能分配如下:When the path of the next hop in the above example is changed from 4 to 5, for example, NH5 is added, if load sharing is to be realized at this time, data flow identifiers 0 to 15 should be allocated to NH1, NH2, and NH3 as much as possible , NH4 and NH5. According to the principle of changing the least number of paths with flow identifiers, the path to be changed should be to take out a flow identifier from any three paths of NH1, NH2, NH3, and NH4 and assign them to NH5. The possible assignments after passing the changes are as follows:

  流标识 Stream ID 00 11 22 33 44 55 66 77 88 99 1010 1111 1212 1313 1414 1515   路径 path   NH5 NH5   NH1 NH1   NH5 NH5   NH5 NH5   NH2 NH2   NH4 NH4   NH2 NH2   NH4 NH4   NH2 NH2   NH3 NH3   NH1 NH1   NH3 NH3   NH3 NH3   NH1 NH1   NH4 NH4   NH3 NH3

即在NH1、NH2和NH4中各取出一个流标识分配给NH5,则被改变的流的比例为3/16=18.75%,且没有误乱序的出现。That is, one flow ID is taken from NH1, NH2, and NH4 and assigned to NH5, then the proportion of changed flows is 3/16=18.75%, and there is no out-of-sequence occurrence.

需要说明的是,每个流标识和下一条路径的对应关系,只是满足比例上的对应关系即可,不需要顺序排列,所述的比例是指不同路径所需分担的流量的比例。因为在实际路径中,比如TE LSP隧道等,不同的路径要求分担的流量比例大小不是等分的,比如有3条路径NH1~NH3,分别分担20%、20%、60%的流量,则可以将NH1、NH2各分配3个流标识,NH3分配10个流标识,就可以达到分担的目的。所以我们可以对流标识根据实际需要的比例进行分配,从而达到负载合理分担的效果。同时,当由于路由变化,需要增加删除路径时,同样按照所述比例进行,并且按照流标识改变路径最少原则来实现负载分担,而不是顺序的对流标识进行分配路径,可以解决在下一跳路径增加或删除时为了实现负载分担而带来的大量流出现误乱序问题。It should be noted that the corresponding relationship between each flow identifier and the next path only needs to satisfy the corresponding relationship in proportion, and does not need to be arranged in order. The proportion refers to the proportion of traffic that needs to be shared by different paths. Because in actual paths, such as TE LSP tunnels, different paths require that the proportion of traffic shared is not equal. For example, there are 3 paths NH1~NH3, which share 20%, 20%, and 60% of the traffic respectively. NH1 and NH2 are allocated 3 flow IDs each, and NH3 is allocated 10 flow IDs, so that the purpose of sharing can be achieved. Therefore, we can allocate flow IDs according to the actual needs, so as to achieve the effect of reasonable load sharing. At the same time, when it is necessary to add and delete paths due to routing changes, it is also carried out according to the above-mentioned ratio, and load sharing is realized according to the principle of changing the path with the least amount of flow identifiers, instead of assigning paths to flow identifiers sequentially, it can solve the problem of increasing the next-hop path. Or the large number of streams brought in to achieve load sharing during deletion may be out of order.

同时,在所述的例子中,当下一跳路径由2条变为1条时,需要修改所有的流标识对应所述的唯一的路径并将FIB表中的LF标志位变为0。At the same time, in the above example, when the next hop path is changed from 2 to 1, it is necessary to modify all flow identifiers corresponding to the unique path and change the LF flag in the FIB table to 0.

以上所述,仅为本发明较佳的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉该技术的人在本发明所揭露的技术范围内,可轻易想到的变化或替换,都应涵盖在本发明的保护范围之内。The above is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person familiar with the technology can easily think of changes or replacements within the technical scope disclosed in the present invention. , should be covered within the protection scope of the present invention.

Claims (10)

1. 一种负载分担的方法,其特征在于,1. A method for load sharing, characterized in that, A、当通信设备所接收报文的下一跳路径多于一条时,根据通信设备的下一跳最大支持路径数目得到所需流的数量值,并为每个流分配流标识,所述流的数量值大于等于所述的下一跳最大支持路径数目;A. When the next hop path of the message received by the communication device is more than one, the number of required flows is obtained according to the maximum number of paths supported by the next hop of the communication device, and a flow identifier is assigned to each flow. The value of the number is greater than or equal to the maximum number of paths supported by the next hop; B、通信设备根据所述报文的目的地址和所述的流标识来使每个流唯一对应一条确定的下一跳路径;B. The communication device makes each flow uniquely correspond to a determined next-hop path according to the destination address of the message and the flow identifier; C、通信设备根据所述的下一跳路径进行所述报文的负载分担转发。C. The communication device performs load sharing and forwarding of the message according to the next-hop path. 2. 根据权利要求1所述的一种负载分担的方法,其特征在于,所述的步骤A中流的数量值是1至下一跳最大支持路径数目的公倍数。2. A method of load sharing according to claim 1, characterized in that the number of flows in the step A is a common multiple of the maximum number of supported paths from 1 to the next hop. 3. 根据权利要求1所述的一种负载分担的方法,其特征在于,所述的步骤A中的流的数量值,根据流量分配比例的误差要求,取接近1至下一跳最大支持路径数目的公倍数的2的整次幂的值。3. A method of load sharing according to claim 1, characterized in that, the quantity value of the flow in the step A, according to the error requirement of the flow distribution ratio, is close to 1 to the maximum supported path of the next hop The value of the integer power of 2 that is the common multiple of the number. 4. 根据权利要求1所述的方法,其特征在于,所述的流标识是根据所述报文头的域的内容通过哈希算法得出的。4. The method according to claim 1, wherein the flow identifier is obtained through a hash algorithm according to the content of the header field. 5. 根据权利要求4所述的方法,其特征在于,所述的报文头的域包括源地址、目的地址、报文生存时间、源端口号、目的端口号、协议类型之一或任意组合。5. The method according to claim 4, wherein the domain of the message header includes one or any combination of source address, destination address, message lifetime, source port number, destination port number, protocol type . 6. 根据权利要求1所述的方法,其特征在于,所述的步骤B具体包括,6. method according to claim 1, is characterized in that, described step B specifically comprises, B1、在路由的路由表中设置负载分担表,所述的负载分担表包括流标识和下一跳标识;B1. A load sharing table is set in the routing table of the route, and the load sharing table includes a flow identifier and a next hop identifier; B2、通信设备根据所述报文的目的地址和所述的流标识在所述的负载分担表中查找下一跳路径。B2. The communication device searches for a next-hop path in the load sharing table according to the destination address of the message and the flow identifier. 7. 根据权利要求1所述的方法,其特征在于,步骤B中所述流标识和下一跳路径的对应关系中,所述的下一跳路径根据不同路径所需分担的流量比例来对应一个或多个流标识。7. The method according to claim 1, characterized in that, in the corresponding relationship between the flow identifier and the next-hop path in step B, the next-hop path corresponds to the traffic ratio required to be shared by different paths One or more stream IDs. 8. 根据权利要求7所述的方法,其特征在于,当路径需要删除或增加时,根据所述的比例修改流标识和路径的对应关系。8. The method according to claim 7, wherein when a path needs to be deleted or added, the corresponding relationship between the flow identifier and the path is modified according to the ratio. 9. 根据权利要求8所述的方法,其特征在于,还包括根据所述流标识改变路径数最少原则来改变流标识与路径的对应关系。9. The method according to claim 8, further comprising changing the corresponding relationship between the flow identifier and the path according to the principle of changing the flow identifier with the least number of paths. 10. 根据权利要求1中所述的方法,其特征在于,所述的下一跳最大支持路径数目发生改变时,要重新计算流的数量值并得出流标识,并且要初始化负载分担流标识和路径所对应的负载分担表。10. The method according to claim 1, characterized in that when the maximum number of paths supported by the next hop changes, the number of flows must be recalculated to obtain the flow identifier, and the load sharing flow identifier must be initialized and the load balancing table corresponding to the path.
CNB2005101016826A 2005-11-19 2005-11-19 A method of load sharing Expired - Fee Related CN100417138C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2005101016826A CN100417138C (en) 2005-11-19 2005-11-19 A method of load sharing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2005101016826A CN100417138C (en) 2005-11-19 2005-11-19 A method of load sharing

Publications (2)

Publication Number Publication Date
CN1859286A CN1859286A (en) 2006-11-08
CN100417138C true CN100417138C (en) 2008-09-03

Family

ID=37298150

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2005101016826A Expired - Fee Related CN100417138C (en) 2005-11-19 2005-11-19 A method of load sharing

Country Status (1)

Country Link
CN (1) CN100417138C (en)

Families Citing this family (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101247348B (en) * 2008-03-12 2010-08-04 华为技术有限公司 Load sharing method and equipment
CN101335709B (en) * 2008-08-07 2010-09-22 杭州华三通信技术有限公司 Method for implementing load sharing among flow analysis servers and shunting equipment
CN102136989B (en) * 2010-01-26 2014-03-12 华为技术有限公司 Message transmission method, system and equipment
CN102143041B (en) * 2010-07-02 2014-03-26 华为技术有限公司 Network traffic sharing method, device and system
CN101895472B (en) 2010-07-16 2013-11-06 华为技术有限公司 Traffic flow load sharing method and processing method and corresponding device and system
CN103281252B (en) * 2013-05-14 2017-04-26 华为技术有限公司 Message flow control method and device based on multi-path transmission
US20150124623A1 (en) * 2013-11-07 2015-05-07 Futurewei Technologies, Inc. System and Method for Traffic Splitting
CN104009932B (en) * 2014-04-30 2017-06-23 易云捷讯科技(北京)股份有限公司 A kind of flow based on Openflow rules arbitrarily compares carrying method
CN106487703A (en) * 2015-08-27 2017-03-08 中兴通讯股份有限公司 A kind of load share method and device
CN107770061B (en) * 2016-08-16 2020-12-01 华为技术有限公司 Method and forwarding device for forwarding message
CN108337160A (en) * 2017-01-20 2018-07-27 华为技术有限公司 Data transmission method, destination node and source node
CN112511449B (en) * 2019-09-16 2022-12-30 华为技术有限公司 Message flow out-of-order detection method, message processing method and device
EP4024789A4 (en) 2019-09-16 2022-12-14 Huawei Technologies Co., Ltd. Method of detecting out-of-order message flow, message processing method, and device
CN110995609A (en) * 2019-12-20 2020-04-10 新华三半导体技术有限公司 Message sending method and device, electronic equipment and storage medium
CN112463360B (en) * 2020-10-29 2024-08-02 空气动力学国家重点实验室 Parallel reading method for hundred billion hundred GB magnitude grid data files
CN114827054A (en) * 2021-01-29 2022-07-29 阿里巴巴集团控股有限公司 Acceleration unit, related device and path selection method

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6111877A (en) * 1997-12-31 2000-08-29 Cisco Technology, Inc. Load sharing across flows
CN1414737A (en) * 2002-05-23 2003-04-30 华为技术有限公司 Method of flow load sharing
CN1431807A (en) * 2003-01-28 2003-07-23 威盛电子股份有限公司 Method of allocating data package stream
CN1567891A (en) * 2003-06-20 2005-01-19 华为技术有限公司 A method for implementing data service transmission routing
WO2005071900A1 (en) * 2004-01-23 2005-08-04 Siemens Aktiengesellschaft Optimisation of traffic distribution in multipath routing

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6111877A (en) * 1997-12-31 2000-08-29 Cisco Technology, Inc. Load sharing across flows
CN1414737A (en) * 2002-05-23 2003-04-30 华为技术有限公司 Method of flow load sharing
CN1431807A (en) * 2003-01-28 2003-07-23 威盛电子股份有限公司 Method of allocating data package stream
CN1567891A (en) * 2003-06-20 2005-01-19 华为技术有限公司 A method for implementing data service transmission routing
WO2005071900A1 (en) * 2004-01-23 2005-08-04 Siemens Aktiengesellschaft Optimisation of traffic distribution in multipath routing

Also Published As

Publication number Publication date
CN1859286A (en) 2006-11-08

Similar Documents

Publication Publication Date Title
CN100417138C (en) A method of load sharing
US7260096B2 (en) Method and router for forwarding internet data packets
CN104811387B (en) The equal cost multipath explicitly replicated with position index
Chen et al. An efficient multipath forwarding method
Yu et al. BUFFALO: Bloom filter forwarding architecture for large organizations
US9736058B2 (en) Multi-region source routed multicast using sub-tree identifiers
US7606161B2 (en) Distributing information across equal-cost paths in a network
US7936764B1 (en) Method for optimizing IP route table size through IP route aggregation
CN104601485B (en) The distribution method of network flow and the method for routing for realizing network flow distribution
US7277386B1 (en) Distribution of label switched packets
CN106105130A (en) Carry the source routing of entropy head
CN104580165B (en) A kind of cooperation caching method in wisdom contract network
US20080159150A1 (en) Method and Apparatus for Preventing IP Datagram Fragmentation and Reassembly
CN101043428B (en) Method and system for routing and forwarding
CN101330466A (en) Method and device for forwarding multicast message
WO2011095017A1 (en) Method and routing device for implementing load sharing
CN102804707A (en) Methods for managing paths between source and destination nodes within the data link layer, and corresponding source nodes and tables
Lei et al. Multipath routing in SDN-based data center networks
Gao et al. Global hybrid routing for scale-free networks
CN100450037C (en) A method and device for implementing IP packet load sharing
US7702882B2 (en) Apparatus and method for performing high-speed lookups in a routing table
CN113595919A (en) Load sharing method and device
Luo et al. Name label switching paradigm for named data networking
Craig et al. Bloomflow: Openflow extensions for memory efficient, scalable multicast with multi-stage bloom filters
CN108075955B (en) Backbone network data processing method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20080903

Termination date: 20191119

CF01 Termination of patent right due to non-payment of annual fee