WO2016145737A1 - Load sharing method and device - Google Patents

Load sharing method and device Download PDF

Info

Publication number
WO2016145737A1
WO2016145737A1 PCT/CN2015/081173 CN2015081173W WO2016145737A1 WO 2016145737 A1 WO2016145737 A1 WO 2016145737A1 CN 2015081173 W CN2015081173 W CN 2015081173W WO 2016145737 A1 WO2016145737 A1 WO 2016145737A1
Authority
WO
WIPO (PCT)
Prior art keywords
traffic
ratio
link
load sharing
type
Prior art date
Application number
PCT/CN2015/081173
Other languages
French (fr)
Chinese (zh)
Inventor
牛俊杰
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2016145737A1 publication Critical patent/WO2016145737A1/en

Links

Images

Definitions

  • This paper relates to the field of data communication, especially a method and device for implementing load sharing.
  • the traffic entering the router is greater than the outbound interface bandwidth of the single link of the router, the traffic is offloaded to the outbound interface of multiple links to load the traffic. Distribution requirements.
  • the load sharing method is further divided into packet mode load sharing and flow mode load sharing.
  • the load balancing based on the packet mode is to randomly divide the traffic entering the router to the outbound interface of the configured multiple load sharing links.
  • the load balancing based on the flow mode includes the traffic offloading the outbound interfaces of multiple load sharing links.
  • the load balancing based on the flow mode also needs to ensure that each type of traffic is sent only on the outbound interface of one link, thereby ensuring that the same type of traffic passes through the same path in the network. It ensures that the same kind of traffic is consistent in the order of sending and receiving in the data transmission process.
  • the load sharing method based on the packet mode mainly maps the traffic that needs load sharing to the outbound interface of the N links of the load sharing by using the generated random value. This method can increase the number of bits of the random value. The effect of load sharing is better and even.
  • the load balancing method based on the flow mode is complex. You need to select different types of flow identifiers for different types of packets.
  • the fourth version (IPV4) of the Internet Protocol can select the source IP address, destination IP address, and protocol number.
  • the service type (TOS), the source port number, the destination port number, and the like are used as the flow identifier.
  • the algorithm maps to 0 to (N-1) links, where N is the link.
  • the hash identifier is unified by the hash (HASH) algorithm to obtain the HASH result, and then the value obtained by the HASH result modulo N is used to select the number of links.
  • the load balancing method based on the flow mode has a lot of limitations.
  • the key to the uniformity of load sharing lies in the following points: 1.
  • the identifier field of the stream is selected, that is, how to classify the stream identifiers of different streams; 2.
  • the mapping function The selection of the stream identifier is how to map it to a finite value range of 0 to N-1 (N is the number of links). The selection of the stream identifier does not apply. For all scene requirements, direct HASH operations cannot be evenly mapped onto the link based on the selected stream identifier.
  • the destination IP changes in the lower 16 bits
  • the TOS field changes between several finite values
  • the port number is in a larger interval 5000-65535. Change; assume that all flow identifiers are mapped by HASH operation result. Since the source IP does not change, there is no need to add a flow identifier; the destination IP is not necessary to take all 32-bit calculations in the lower 16-bit change; the value between IP and port number
  • the distribution of HASH calculation results is also unpredictable; therefore, the above load sharing method cannot achieve equalization of traffic.
  • the key to the load sharing method is how to distinguish and collect the traffic types and map them to 0 to N-1 links.
  • the related technology uses the keyword static mapping method, which has uneven sharing and causes some traffic entering the router.
  • This document provides a method and system for implementing load sharing, which can improve the load sharing unevenness and make the load sharing of each link even and reasonable. After the load sharing, the bandwidth of each link meets the bandwidth requirement of traffic offloading.
  • a method for implementing load sharing comprising:
  • the load sharing parameter is greater than or equal to the preset load sharing threshold, the load sharing is determined to be uneven, and the second load sharing method is configured to distribute the traffic to the traffic distribution link for traffic distribution.
  • the first load sharing method includes:
  • Pre-set protocols based on the interconnection between source networks, SIP, or protocol-based DIP based on interconnection between destination networks, or based on user datagram protocol UDP port numbers, or based on triples, or based on quintuple, or based on Cyclic Redundancy Check Code CRC, or XOR-based static mapping method.
  • obtaining load sharing parameters of the system includes:
  • the load sharing parameter is obtained by subtracting the minimum value of the traffic bandwidth ratio from the maximum value in the traffic bandwidth ratio.
  • the method for sharing the second load includes:
  • Traffic is distributed to each link based on the size of the first ratio and the second ratio.
  • distributing traffic to each link according to the size of the first ratio and the second ratio includes:
  • each type of traffic and link After sorting each type of traffic and link according to the first ratio and the second ratio, respectively, assigning each type of traffic to the second ratio from small to large according to the order of the first ratio up to the first ratio being the smallest. In each link.
  • each type of traffic is allocated to each of the links whose second ratio is from small to large in an order that the first ratio is up to the first ratio is the smallest:
  • each type of traffic is allocated one by one according to the first ratio, from the largest to the smallest, to the second smallest link. ;
  • the link is removed from the ordering of the distributed distribution traffic, and the size ratio of the first ratio of each type of traffic that is not allocated is updated and the second ratio of the unallocated links is sorted.
  • the traffic distribution allocation of each type of traffic is continued with the updated first ratio order and the second ratio sorting until each link is unassigned, and unassigned each type of traffic is uniformly allocated to the remaining links.
  • determining whether to continue to distribute the distributed traffic to the link according to the obtained difference includes:
  • the second ratio of the link having the smallest second ratio is obtained, and when the difference is equal to zero, The traffic distribution of the link is stopped.
  • the difference is less than zero, the corresponding type of traffic that is less than zero is used as the unallocated traffic, and the traffic is allocated to the link.
  • the method further includes:
  • the first load sharing method is used for traffic distribution.
  • the method further includes:
  • the traffic is distributed to the link of the traffic distribution, the corresponding ACL rule is delivered, and the traffic is distributed according to the ACL rule.
  • the ACL rule is an ACL quintuple, which is delivered through a content-addressable memory TCAM or a prefix tree trie table.
  • the method when performing traffic distribution, the method further includes:
  • the first load balancing is used for the traffic of the type, and the number of traffic types of the first load sharing traffic is counted. When the number of the traffic traffic types is greater than the matching adjustment threshold. And distributing the traffic of the second load by using the second load sharing method for the undistributed traffic.
  • An apparatus for implementing load sharing comprising: a statistical analysis unit and a judgment processing unit; wherein
  • the statistical analysis unit is configured to: collect statistics on each link under the first load sharing method in the first preset duration, and obtain a load sharing parameter of the system;
  • the judgment processing unit includes a judgment module and a processing module; wherein
  • the determining module is configured to: determine that the load sharing is uneven when the load sharing parameter is greater than or equal to a preset load sharing threshold;
  • the processing module is configured to: when determining the load sharing unevenness, switch to the second load sharing method to distribute the traffic to the traffic distribution link for traffic distribution.
  • the statistical analysis unit is set to:
  • the statistical analysis unit is set to:
  • the load sharing parameter is obtained by subtracting the minimum value of the traffic bandwidth ratio from the maximum value in the traffic bandwidth ratio.
  • the processing module is configured to: when determining load sharing unevenness,
  • Traffic is distributed to each link for traffic distribution according to the size of the first ratio and the second ratio.
  • the processing module is configured to: when determining load sharing unevenness,
  • each type of traffic and link After sorting each type of traffic and link according to the first ratio and the second ratio, respectively, assigning each type of traffic to the second ratio from small to large according to the order of the first ratio up to the first ratio being the smallest. In each link.
  • the processing module is configured to: when determining load sharing unevenness,
  • each type of traffic is allocated one by one according to the first ratio, from the largest to the smallest, to the second smallest link. ;
  • the link is removed from the ordering of the distributed distribution traffic, and the size ratio of the first ratio of each type of traffic that is not allocated is updated and the second ratio of the unallocated links is sorted.
  • the traffic distribution allocation of each type of traffic is continued with the updated first ratio order and the second ratio sorting until each link is unassigned, and unassigned each type of traffic is uniformly allocated to the remaining links.
  • the processing module is configured to: when determining load sharing unevenness,
  • each type of traffic is allocated one by one according to the first ratio, from the largest to the smallest, to the second smallest link. ;
  • the second ratio of the link having the smallest second ratio is subtracted from the calculated sum of the first ratios of the flow rates of each type of the link assigned to the link with the smallest second ratio, and then the difference is obtained when the difference is equal to zero.
  • the traffic distribution of the link; when the difference is less than zero, the corresponding type of traffic when the value is less than zero is used as the unallocated traffic, and the traffic is allocated to the link;
  • the link is removed from the ordering of the distributed distribution traffic, and the size ratio of the first ratio of each type of traffic that is not allocated is updated and the second ratio of the unallocated links is sorted.
  • the traffic distribution allocation of each type of traffic is continued with the updated first ratio order and the second ratio sorting until each link is unassigned, and unassigned each type of traffic is uniformly allocated to the remaining links.
  • the determining module is further configured to: when the load sharing parameter is less than a preset load sharing threshold, determine that the load sharing is uniform;
  • the processing module is further configured to: when determining load sharing is uniform, use the first load sharing method to perform traffic distribution.
  • the device further includes a rule sending unit, configured to: after switching to the second load sharing method for traffic distribution, assigning a corresponding ACL according to the traffic distribution to the traffic distribution link Rules, traffic distribution based on ACL rules;
  • the ACL rule is ACL quintuple and is delivered through the content-addressable memory TCAM or the prefix tree trie table.
  • the device further includes a statistical processing unit, configured to: when performing traffic distribution,
  • the first load balancing is used for the traffic of the type, and the number of traffic types of the first load sharing traffic is counted. When the number of the traffic traffic types is greater than the matching adjustment threshold. And distributing the traffic of the second load by using the second load sharing method for the undistributed traffic.
  • a computer readable storage medium storing computer executable instructions for performing the method of any of the above.
  • the technical solution of the present invention includes: collecting the traffic of each link in the first load sharing method for the first preset duration, and obtaining the load sharing parameter of the system; when the load sharing parameter is greater than or equal to the preset load sharing At the threshold, the load sharing is determined to be uneven, and the second load sharing method is configured to distribute the traffic to the traffic distribution link for traffic distribution.
  • the second load sharing method when the load sharing parameter exceeds the load sharing threshold, the second load sharing method is used to solve the problem of uneven load sharing; further, each type of traffic is allocated from large to small to link bandwidth from small to large. The link, the last unallocated traffic is digested by the largest link, which solves the problem of uneven load sharing.
  • FIG. 1 is a flowchart of a method for implementing load sharing according to an embodiment of the present invention
  • FIG. 2 is a structural block diagram of an apparatus for load sharing according to an embodiment of the present invention.
  • Figure 3 is a flow chart of the method of the first embodiment of the present invention.
  • FIG. 1 is a flowchart of a method for implementing load sharing according to an embodiment of the present invention. As shown in FIG. 1 , the method includes:
  • Step 100 Collect each link traffic under the first load sharing method for the first preset duration, and obtain a load sharing parameter of the system.
  • the size of the traffic in the statistical link belongs to the conventional technical means of those skilled in the art.
  • the load sharing parameters are:
  • the load sharing parameter is obtained by subtracting the minimum value of the traffic bandwidth ratio from the maximum value in the traffic bandwidth ratio.
  • the first load sharing method includes:
  • Pre-set protocols based on interconnection between source networks (SIP), or protocols based on interconnection between destination networks (DIP), or based on User Datagram Protocol (UDP) port numbers, or based on triples, or based on A quintuple, or a cyclic redundancy check code (CRC), or an XOR-based static mapping method.
  • SIP source networks
  • DIP destination networks
  • UDP User Datagram Protocol
  • CRC cyclic redundancy check code
  • Step 101 When the load sharing parameter is greater than or equal to the preset load sharing threshold, determine that the traffic is unevenly distributed in the link, and switch to the second load sharing method to distribute the traffic to the traffic distribution link for traffic distribution.
  • the method further includes:
  • the first load sharing method is used for traffic distribution.
  • the first preset duration is mainly determined according to the type and quantity of the traffic shared by the load. The more the general types and the larger the number of traffic distribution processes, the smaller the first preset duration may be.
  • the value of the load sharing threshold is set based on the quality of the load sharing, the link bandwidth, and the traffic volume. If the load sharing requirement is high, the load sharing threshold is low, and vice versa. When switching to the second load sharing method, it is generally necessary to sacrifice some system performance. Therefore, the load sharing threshold is analyzed and set according to system performance and load sharing requirements, and can be adjusted according to actual conditions.
  • the first preset duration that meets the sharing should be reasonable within the range of 10 minutes to 2 hours, and the threshold should not exceed 5%.
  • the load sharing flow rate is large and the load flow rate is stable.
  • the first preset duration can be set to a minimum value of 10 minutes, and when the flow rate is small, the first preset duration can be set to 30 minutes.
  • the load sharing threshold is set to a maximum value of 5%. The link bandwidth is close to 1:1. At this time, it is appropriate to set the load sharing threshold to 0.1%.
  • the method for sharing the second load includes:
  • Traffic is distributed to each link based on the size of the first ratio and the second ratio.
  • distributing traffic to each link according to the first ratio and the second ratio includes:
  • each type of traffic and link After sorting each type of traffic and link according to the first ratio and the second ratio, respectively, assigning each type of traffic to the second ratio from small to large according to the order of the first ratio up to the first ratio being the smallest. In each link.
  • each type of traffic is allocated to each of the links whose second ratio is from small to large according to the order that the first ratio is up to the first ratio is the smallest:
  • each type of traffic is allocated one by one according to the first ratio, from the largest to the smallest, to the second smallest link. ;
  • the link is removed from the ordering of the distributed distribution traffic, and the size ratio of the first ratio of each type of traffic that is not allocated is updated and the second ratio of the unallocated links is sorted.
  • the traffic distribution allocation of each type of traffic is continued with the updated first ratio order and the second ratio sorting until each link is unassigned, and unassigned each type of traffic is uniformly allocated to the remaining links.
  • determining, according to the obtained difference, whether to continue to distribute the distributed traffic to the link includes: The second ratio of the link having the smallest second ratio is subtracted from the calculated sum of the first ratios of the flow rates of each type of the link assigned to the link with the smallest second ratio, and then the difference is obtained when the difference is equal to zero. Traffic is allocated to the link; when the difference is less than zero, the corresponding type of traffic that is less than zero is used as unallocated traffic, and traffic is allocated to the link.
  • the preset ratio when sampling is set according to the quality requirements of the second load sharing method and the type and quantity of traffic distributed by the system. Generally, the higher the required quality, the larger the preset ratio, but the larger the type and quantity of traffic. Using a high preset ratio to sample a large amount of traffic data will affect certain system performance. Therefore, it is set according to actual needs and system performance. It can be passed. When the current flow rate of the system device accounts for less than 50% of the maximum flow speed, the preset ratio can be set to 1:1. At this time, the impact on the operation of the system equipment is small, and the high sampling ratio can be set.
  • the second preset duration can be set to a smaller value (such as 10 minutes); when the current flow rate of the system device accounts for 80% of the maximum flow velocity, the preset ratio of the sampling can be set to not exceed 4:1.
  • the preset ratio can be set. For the case of no more than 100:1, consider the normal flow rate, set the preset ratio to 1000:1 and the second preset duration to 120 minutes. If the message flow speed is very large, you can set the preset ratio to 100. :1 and the second preset duration is 60 minutes; the primary reference factor of the second preset duration is the same as the reference factor of the first preset duration.
  • the method of the embodiment of the present invention further includes:
  • ACL access control list
  • the ACL rule is an ACL five-tuple, which is delivered through a content-addressable memory (TCAM) or a prefix tree (trie) table.
  • TCAM content-addressable memory
  • trie prefix tree
  • the first load balancing is used for the traffic of the type, and the number of traffic types of the first load sharing traffic is counted. When the number of the traffic traffic types is greater than the matching adjustment threshold. And distributing the traffic of the second load by using the second load sharing method for the undistributed traffic.
  • the matching adjustment threshold is mainly related to the system's uniform requirement for load sharing. The higher the requirement, the smaller the adjustment value is. When the requirement is low, the value can be set to be 0.1% to 5%. For a scenario with a large number of links with redundant bandwidth, the system does not have a bad impact on the system traffic. In this case, you can set the matching adjustment threshold to a larger value of 5%. When it is small, if the 10M stream passes through the 10G bandwidth, the matching adjustment threshold can be set to a maximum value of 5%. When the load-sharing traffic is close to the link bandwidth, the load sharing uniformity is required to be strict. Otherwise, one link traffic may be excessively allocated and the other links may be redundant. In the case of the remaining bandwidth, such as the load sharing traffic and the total link bandwidth ratio of 99:100, the matching adjustment threshold is required to be a small value, for example, 0.1%.
  • the second load sharing method when the load sharing parameter exceeds the load sharing threshold, the second load sharing method is adopted, and each type of traffic is allocated to the second ratio from small to large according to the order of the first ratio to the first ratio being the smallest.
  • each link load In each link, each link load is evenly distributed. Further, each type of traffic is allocated from the largest to the smallest link to the link bandwidth from small to large, and the last unallocated traffic passes the second ratio.
  • the maximum link bandwidth is digested, which solves the problem of uneven load sharing.
  • FIG. 2 is a structural block diagram of a system for implementing load sharing according to an embodiment of the present invention. As shown in FIG. 2, the method includes: a statistical analysis unit 21 and a determination processing unit 22;
  • the statistical analysis unit 21 is configured to: collect each link traffic under the first load sharing method for the first preset duration, and obtain a load sharing parameter of the system;
  • the determination processing unit 22 includes a determination module 221 and a processing module 222;
  • the determining module 221 is configured to: determine that the load sharing is uneven when the load sharing parameter is greater than or equal to a preset load sharing threshold;
  • the processing module 222 is configured to switch to the second load sharing when determining the load sharing unevenness
  • the method distributes traffic to the traffic distribution link for traffic distribution.
  • the statistical analysis unit 21 is configured to:
  • the statistical analysis unit 21 is set to:
  • the load sharing parameter is obtained by subtracting the minimum value of the traffic bandwidth ratio from the maximum value in the traffic bandwidth ratio.
  • the processing module 222 is configured to: when determining the load sharing unevenness, sample the traffic to be distributed according to the load sharing in the second preset duration according to the preset ratio;
  • Traffic is distributed to each link for traffic distribution according to the size of the first ratio and the second ratio.
  • the processing module 222 is configured to: when determining load sharing unevenness,
  • each type of traffic and link After sorting each type of traffic and link according to the first ratio and the second ratio, respectively, assigning each type of traffic to the second ratio from small to large according to the order of the first ratio up to the first ratio being the smallest. In each link.
  • the processing module 222 is configured to: when determining load sharing unevenness,
  • each type of traffic is allocated one by one according to the first ratio size from the largest to the smallest, to the link with the smallest second ratio;
  • the link is removed from the ordering of the distributed distribution traffic, and the size ratio of the first ratio of each type of traffic that is not allocated is updated and the second ratio of the unallocated links is sorted.
  • the traffic distribution allocation of each type of traffic is continued with the updated first ratio order and the second ratio sorting until each link is unassigned, and unassigned each type of traffic is uniformly allocated to the remaining links.
  • the processing module 222 is configured to: when determining load sharing unevenness,
  • each type of traffic is allocated one by one according to the first ratio, from the largest to the smallest, to the second smallest link. ;
  • the second ratio of the link having the smallest second ratio is subtracted from the calculated sum of the first ratios of the flow rates of each type of the link assigned to the link with the smallest second ratio, and then the difference is obtained when the difference is equal to zero.
  • the traffic distribution of the link; when the difference is less than zero, the corresponding type of traffic when the value is less than zero is used as the unallocated traffic, and the traffic is allocated to the link;
  • the link is removed from the ordering of the distributed distribution traffic, and the size ratio of the first ratio of each type of traffic that is not allocated is updated and the second ratio of the unallocated links is sorted.
  • the traffic distribution allocation of each type of traffic is continued with the updated first ratio order and the second ratio sorting until each link is unassigned, and unassigned each type of traffic is uniformly allocated to the remaining links.
  • the determining module 221 is further configured to: when the load sharing parameter is less than a preset load sharing threshold, determine that the load sharing is uniform;
  • the processing module 222 is further configured to perform traffic distribution by using the first load sharing method when determining that the load sharing is uniform.
  • the device of the embodiment of the present invention further includes a rule issuing unit 23, configured to: after switching to the second load sharing method for traffic distribution, assigning the corresponding ACL rule according to the traffic distribution to the traffic distribution link, according to the ACL rule Traffic distribution;
  • the ACL rule is an ACL five-tuple, which is delivered through a content-addressable memory (TCAM) or a prefix tree (trie) table.
  • TCAM content-addressable memory
  • trie prefix tree
  • the apparatus of the embodiment of the present invention further includes a statistical processing unit 24, configured to: when performing traffic distribution,
  • the first load balancing is used for the traffic of the type, and the number of traffic types of the first load sharing traffic is counted. When the number of the traffic traffic types is greater than the matching adjustment threshold. And distributing the traffic of the second load by using the second load sharing method for the undistributed traffic.
  • FIG. 3 is a flow chart of the method of the first embodiment of the present invention, as shown in FIG.
  • Step 300 Perform a traffic sampling of the second load sharing method by using a preset ratio of 1:1.
  • the preset ratio is set to 1:1, indicating that the quality requirement of the second load sharing method is high.
  • the flow keyword virtual private network function number (VPN ID) plus DIP identification implementation is implemented. For example, traffic data processed by the second load sharing method is required.
  • Step 301 Write the sampled traffic data into the buffer, analyze the type of the sampled traffic, and obtain a first ratio of the sampled traffic of each type of traffic;
  • Step 302 Calculate a second ratio of the bandwidth of each link in the link to the total bandwidth of all links distributed by the traffic.
  • Step 303 Distribute each type of traffic in a corresponding link according to the second load sharing method, including:
  • each type of traffic is allocated one by one according to the first ratio from the largest to the smallest.
  • the value of the sum of the first ratios of each type of traffic assigned to the second ratio of the second ratio minus the second ratio is determined to determine whether to continue to distribute the distributed traffic to the link;
  • Step 304 After the traffic is distributed to the second load balancing method, the ACL rule is delivered according to the ACL rule.
  • Step 305 Perform ACL rule matching, and perform ACL rule matching when the link performs traffic distribution.
  • the traffic distribution is performed according to step 3060, which is equivalent to using the second load method to complete the traffic distribution. Otherwise, step 3070 is performed.
  • Step 3060 Perform traffic distribution according to an ACL rule.
  • Step 3070 The first load sharing offload is used for the traffic that does not match the ACL rule, and the number of types of traffic that is divided by the first load is used.
  • Step 3071 If the number of types of traffic that uses the first load sharing offload is greater than the matching adjustment threshold, step 300 is performed, otherwise, step 3072 is performed.
  • Step 3072 Perform traffic distribution according to the first load sharing method.
  • the number of links for traffic load sharing is 3, and the link bandwidth ratio of the three links is 1:2:1.
  • the traffic of the packet is IP traffic. Based on the SIP change, there are 255 traffic types from 10.10.10.0 to 10.10.10.254.
  • the first load sharing method is a method of the CRC32 mod logical linknum link number of the source IP.
  • the load sharing threshold (the deviation between the link maximum load and the link minimum load) is 0.05
  • the traffic of the three links is counted as 6200000, 12800000, and 6400000 respectively under the first load sharing method;
  • the first load sharing method described above requires high sampling performance because it does not need to sample complex statistics and delivery processes, and needs to be prioritized. Maintaining the first load sharing method is a scheme for performing traffic distribution in the implementation scenario. After all, when switching from the first load sharing method to the second load sharing method, it is necessary to lose part of the system performance in order to obtain a uniform load sharing effect.
  • the number of links for traffic load sharing is 3, and the link bandwidth ratio of the three links is 1:2:1.
  • the traffic of the packet is IP traffic. Based on the SIP change, there are 10 types of traffic from 10.10.10.0 to 10.10.10.9.
  • the first preset duration is 10 minutes and the load sharing threshold is 0.01;
  • the traffic of the three links is counted as 6200000, 12800000, and 6400000 respectively under the first load sharing method;
  • the traffic to be distributed by the load sharing in the second preset duration is sampled according to the preset ratio; here, the preset ratio is 1.
  • the second preset duration is 10 minutes.
  • the sampling analysis obtained 9900 kinds of flow, and the first ratio of each flow was from 1/9900, 1/9900, 1/9900...1/9900, respectively;
  • the second ratio of the link bandwidth of the three links is 0.25:0.5:0.25;
  • the second load sharing method after sorting each type of traffic, the largest traffic 1/9900 is allocated to the minimum remaining bandwidth link 0.25 which is just satisfied, and the second ratio is reduced by 0.25 each time one type of traffic is allocated.
  • the first ratio of the traffic of the type is obtained, and the difference is obtained until the difference is zero, and the traffic is allocated to the link; when less than zero occurs, the traffic allocated when the value is less than zero is used as the initial traffic of the next link distribution traffic.
  • the link is removed from the ordering of the traffic distribution, the updated unallocated first ratio ordering of each type of traffic and the second ratio ordering of the unassigned links continue unallocated Traffic distribution for each type of traffic; when there is only one link left, all unassigned traffic of each type is assigned to the remaining links; thus distributing 2475 traffic types to the first of the second ratio of 0.25 Link; after updating the first ratio and the second ratio, the other link allocation with the second ratio of 0.25 continues to allocate 2475 traffic, and the link with the second ratio of 0.5 is allocated the remaining 4950 traffic.
  • the split ratio perfectly satisfies the link bandwidth ratio of 1:2:1,
  • ACL rules are delivered for traffic distribution.
  • the first load balancing is used for the traffic of the type, and the number of traffic types of the traffic that is divided by the first load is used.
  • the number of traffic types is greater than the preset threshold, The traffic distribution is performed by re-using the second load sharing method for the undistributed traffic.
  • the matching adjustment threshold of the second load sharing method is set to 10.1%, and the 100/10000 ratio is less than 10.1%. Therefore, it is not necessary to re-use the second load sharing method for traffic distribution.
  • the traffic distribution of the 100 types of flows according to the first load sharing method has little effect on the load sharing of the overall traffic distribution.
  • all or part of the steps of the above embodiments may also be implemented by using an integrated circuit. These steps may be separately fabricated into individual integrated circuit modules, or multiple modules or steps may be fabricated into a single integrated circuit module. achieve.
  • the devices/function modules/functional units in the above embodiments may be implemented by a general-purpose computing device, which may be centralized on a single computing device or distributed over a network of multiple computing devices.
  • the device/function module/functional unit in the above embodiment When the device/function module/functional unit in the above embodiment is implemented in the form of a software function module and sold or used as a stand-alone product, it can be stored in a computer readable storage medium.
  • the above mentioned computer readable storage medium may be a read only memory, a magnetic disk or an optical disk or the like.
  • the second load sharing method when the load sharing parameter exceeds the load sharing threshold, the second load sharing method is used to solve the problem of uneven load sharing; each type of traffic is allocated from the largest to the smallest link to the link bandwidth from small to large. Finally, the unallocated traffic is digested through the largest link, which solves the problem of uneven load sharing.

Abstract

A load sharing method and device. The method comprises: counting, in a first preset time duration and in a first load sharing method, each item of link traffic to obtain a load sharing parameter of a system; and when the load sharing parameter is greater than or equal to a preset load sharing threshold, determining that the load sharing is uneven, and switching to a second load sharing method to allocate traffic to a traffic distribution link to distribute the traffic.

Description

一种实现负荷分担的方法及装置Method and device for realizing load sharing 技术领域Technical field
本文涉及数据通信领域,尤指一种实现负荷分担的方法及装置。This paper relates to the field of data communication, especially a method and device for implementing load sharing.
背景技术Background technique
在路由器或其他产品中使用的,当进入路由器的流量大于路由器的单个链路的出接口带宽时,通过负荷分担方法将进入的流量分流到多个链路的出接口进行分流,从而满足用户流量的分发需求。In the router or other products, when the traffic entering the router is greater than the outbound interface bandwidth of the single link of the router, the traffic is offloaded to the outbound interface of multiple links to load the traffic. Distribution requirements.
根据流量分流方式的不同,负荷分担方法又分为基于包模式负荷分担和基于流模式负荷分担。其中,基于包模式的负荷分担是指将进入路由器的流量随机分流到配置的多个负荷分担链路的出接口上;基于流模式的负荷分担包括将流量分流多个负荷分担链路的出接口,与基于包模式的负荷分担不同,基于流模式的负荷分担还需要同时保证每个种类的流量只在一个链路的出接口发送,从而保证同一种类的流量在网络中经过的路径相同,也保证了相同种类的流量在数据传输过程中收发顺序上一致。具体的,基于包模式的负荷分担方法主要通过产生的随机值将需要负荷分担的流量通过处理映射到负荷分担的N个链路的出接口中,这种方法通过增加随机值的位数可以使负荷分担的效果更佳均匀。基于流模式的负荷分担方法实现较为复杂,需要根据不同的场景需求选取不同的报文的流标识种类,例如、互联网协议的第四版(IPV4)报文可以选取源IP、目的IP,协议号、服务类型(TOS)、源端口号、目的端口号等等作为流标识;确定流标识种类后,再经过算法映射到0~(N-1)个链路中,其中,N为链路个数;最后,通过哈希(HASH)算法将流标识统一运算后得到HASH结果,再使用HASH结果模N求得的值选取链路数。According to the different traffic distribution modes, the load sharing method is further divided into packet mode load sharing and flow mode load sharing. The load balancing based on the packet mode is to randomly divide the traffic entering the router to the outbound interface of the configured multiple load sharing links. The load balancing based on the flow mode includes the traffic offloading the outbound interfaces of multiple load sharing links. Different from the load sharing based on the packet mode, the load balancing based on the flow mode also needs to ensure that each type of traffic is sent only on the outbound interface of one link, thereby ensuring that the same type of traffic passes through the same path in the network. It ensures that the same kind of traffic is consistent in the order of sending and receiving in the data transmission process. Specifically, the load sharing method based on the packet mode mainly maps the traffic that needs load sharing to the outbound interface of the N links of the load sharing by using the generated random value. This method can increase the number of bits of the random value. The effect of load sharing is better and even. The load balancing method based on the flow mode is complex. You need to select different types of flow identifiers for different types of packets. For example, the fourth version (IPV4) of the Internet Protocol can select the source IP address, destination IP address, and protocol number. The service type (TOS), the source port number, the destination port number, and the like are used as the flow identifier. After the flow identifier type is determined, the algorithm maps to 0 to (N-1) links, where N is the link. Finally, the hash identifier is unified by the hash (HASH) algorithm to obtain the HASH result, and then the value obtained by the HASH result modulo N is used to select the number of links.
基于流模式的负荷分担方法存在很大的局限性,其中,负荷分担是否均匀的关键在于以下几点:1、流的标识字段选取,即如何划分不同的流的流标识种类;2、映射函数的选取;即选取流标识后如何将其通过一定运算映射到有限的值0~N-1的区间范围之内(N为链路个数)。流标识的选取不能适用 于所有场景需求,而根据选取的流标识直接HASH运算也无法将其均匀映射到链路上。例如,假设当前场景中IPV4报文中源IP是不变的,目的IP在低16位发生变化,TOS字段在几个有限值之间变化,端口号则在一个较大的区间5000-65535中变化;假设将所有流标识通过HASH运算结果来映射,由于源IP没有变化则没有加入流标识的必要;目的IP仅在低16bit变化取全部32bit计算也没有必要;IP与端口号之间的值差异很大HASH运算结果的分布也是不可预测;因此,上述负荷分担方法无法实现流量的均分。The load balancing method based on the flow mode has a lot of limitations. The key to the uniformity of load sharing lies in the following points: 1. The identifier field of the stream is selected, that is, how to classify the stream identifiers of different streams; 2. The mapping function The selection of the stream identifier is how to map it to a finite value range of 0 to N-1 (N is the number of links). The selection of the stream identifier does not apply. For all scene requirements, direct HASH operations cannot be evenly mapped onto the link based on the selected stream identifier. For example, suppose the source IP in the IPV4 packet in the current scenario is unchanged, the destination IP changes in the lower 16 bits, the TOS field changes between several finite values, and the port number is in a larger interval 5000-65535. Change; assume that all flow identifiers are mapped by HASH operation result. Since the source IP does not change, there is no need to add a flow identifier; the destination IP is not necessary to take all 32-bit calculations in the lower 16-bit change; the value between IP and port number The distribution of HASH calculation results is also unpredictable; therefore, the above load sharing method cannot achieve equalization of traffic.
负荷分担方法的关键是如何区分并统计流量的种类,将其映射到0~N-1个链路中,相关技术采用关键字静态映射方法,存在分担不均的情况,造成部分进入路由器的流量依旧大于路由器的单个链路的出接口带宽;特别是链路数或者流量种类较小时,负荷分担不均的情况更为严重。The key to the load sharing method is how to distinguish and collect the traffic types and map them to 0 to N-1 links. The related technology uses the keyword static mapping method, which has uneven sharing and causes some traffic entering the router. The outbound interface bandwidth of a single link that is still larger than the router; especially when the number of links or traffic types is small, the load sharing is more severe.
发明内容Summary of the invention
本文提供一种实现负荷分担的方法及系统,能够改善负荷分担不均的情况,使每个链路负荷分担均匀合理,负荷分担后每个链路的带宽满足流量分流的带宽需求。This document provides a method and system for implementing load sharing, which can improve the load sharing unevenness and make the load sharing of each link even and reasonable. After the load sharing, the bandwidth of each link meets the bandwidth requirement of traffic offloading.
一种实现负荷分担的方法,包括:A method for implementing load sharing, comprising:
统计第一预设时长内在第一负荷分担方法下的每个链路流量,获得系统的负荷分担参数;Counting each link traffic under the first load sharing method for the first preset duration, and obtaining a load sharing parameter of the system;
当负荷分担参数大于或等于预先设置的负荷分担阈值时,确定负荷分担不均,切换到第二负荷分担方法将流量分配到流量分发的链路中进行流量分发。When the load sharing parameter is greater than or equal to the preset load sharing threshold, the load sharing is determined to be uneven, and the second load sharing method is configured to distribute the traffic to the traffic distribution link for traffic distribution.
可选地,第一负荷分担方法包括:Optionally, the first load sharing method includes:
预先设置的基于源网络之间互连的协议SIP、或基于目的网络之间互连的协议DIP、或基于用户数据报协议UDP端口号、或基于三元组、或基于五元组、或基于循环冗余校验码CRC、或基于异或的静态映射方法。Pre-set protocols based on the interconnection between source networks, SIP, or protocol-based DIP based on interconnection between destination networks, or based on user datagram protocol UDP port numbers, or based on triples, or based on quintuple, or based on Cyclic Redundancy Check Code CRC, or XOR-based static mapping method.
可选地,获得系统的负荷分担参数包括:Optionally, obtaining load sharing parameters of the system includes:
将统计的每个链路的流量除以每个链路自身的带宽获得每个链路相应的 流量带宽比;Divide the traffic of each link by the bandwidth of each link to obtain the corresponding value of each link. Traffic bandwidth ratio
将流量带宽比中的最大值减去流量带宽比的最小值,获得负荷分担参数。The load sharing parameter is obtained by subtracting the minimum value of the traffic bandwidth ratio from the maximum value in the traffic bandwidth ratio.
可选地,第二负荷的分担方法包括:Optionally, the method for sharing the second load includes:
根据预设比值采样第二预设时长内所述负荷分担所要分发的流量;And sampling the traffic to be distributed by the load sharing in the second preset duration according to the preset ratio;
分析采样流量的种类并获得每个种类流量所占采样流量的第一比值,计算所述链路中每个链路带宽占流量分发的所有链路总带宽的第二比值;Analyzing a type of sampling traffic and obtaining a first ratio of sampling traffic of each type of traffic, and calculating a second ratio of each link bandwidth in the link to a total bandwidth of all links distributed by the traffic;
根据第一比值和第二比值的大小将流量分发到每个链路中。Traffic is distributed to each link based on the size of the first ratio and the second ratio.
可选地,根据第一比值和第二比值的大小将流量分发到每个链路中包括:Optionally, distributing traffic to each link according to the size of the first ratio and the second ratio includes:
将每个种类流量和链路分别按照第一比值和第二比值的大小进行排序后,按照第一比值最大到第一比值最小的顺序,将每个种类流量分配到第二比值由小至大的每个链路中。After sorting each type of traffic and link according to the first ratio and the second ratio, respectively, assigning each type of traffic to the second ratio from small to large according to the order of the first ratio up to the first ratio being the smallest. In each link.
可选地,按照第一比值最大到第一比值最小的顺序,将每个种类流量分配到第二比值由小至大的每个链路中包括:Optionally, each type of traffic is allocated to each of the links whose second ratio is from small to large in an order that the first ratio is up to the first ratio is the smallest:
将每个种类流量和链路分别按照第一比值和第二比值的大小进行排序后,将每个种类流量根据第一比值大小由最大到最小的顺序逐个分配至第二比值最小的链路中;After sorting each type of traffic and links according to the first ratio and the second ratio, respectively, each type of traffic is allocated one by one according to the first ratio, from the largest to the smallest, to the second smallest link. ;
计算分配给第二比值最小的链路的每个种类流量的第一比值的累加和,将第二比值最小的链路的第二比值减去计算获得的所述累加和获得差值后,根据获得的差值确定是否继续往该链路分配分发的流量;Calculating an accumulated sum of the first ratios of each type of traffic assigned to the link having the smallest second ratio, subtracting the second ratio of the link having the smallest second ratio from the calculated sum obtained and obtaining the difference, according to The obtained difference determines whether to continue to distribute the distributed traffic to the link;
停止往该链路分配流量时,将该链路从分配分发流量的排序中移出,更新未分配的每个种类流量的第一比值的大小排序和未分配的链路的第二比值的大小排序,以更新的第一比值排序和第二比值排序继续每个种类流量的流量分发分配,直至只剩一个链路时,将未分配的每个种类流量统一分配给该剩余的链路。When the allocation of traffic to the link is stopped, the link is removed from the ordering of the distributed distribution traffic, and the size ratio of the first ratio of each type of traffic that is not allocated is updated and the second ratio of the unallocated links is sorted. The traffic distribution allocation of each type of traffic is continued with the updated first ratio order and the second ratio sorting until each link is unassigned, and unassigned each type of traffic is uniformly allocated to the remaining links.
可选地,根据获得的差值确定是否继续往该链路分配分发的流量包括:Optionally, determining whether to continue to distribute the distributed traffic to the link according to the obtained difference includes:
将第二比值最小的链路的第二比值减去计算获得的分配给第二比值最小的链路的每个种类流量的第一比值的累加和获得差值后,当差值等于零时, 停止该链路的流量分配;当差值小于零时,将小于零时的对应的种类流量作为未分配的流量,停止往该链路分配流量。After subtracting the calculated second sum of the first ratio of the traffic of each type of the link assigned to the second smallest ratio, the second ratio of the link having the smallest second ratio is obtained, and when the difference is equal to zero, The traffic distribution of the link is stopped. When the difference is less than zero, the corresponding type of traffic that is less than zero is used as the unallocated traffic, and the traffic is allocated to the link.
可选地,当负荷分担参数小于预先设置的负荷分担阈值时,该方法还包括:Optionally, when the load sharing parameter is less than a preset load sharing threshold, the method further includes:
采用第一负荷分担方法进行流量分发。The first load sharing method is used for traffic distribution.
可选地,在切换到第二负荷分担方法进行流量分发后,该方法还包括:Optionally, after switching to the second load sharing method for traffic distribution, the method further includes:
根据所述流量分配到流量分发的链路、下发相应的访问控制列表ACL规则,根据ACL规则进行流量分发;The traffic is distributed to the link of the traffic distribution, the corresponding ACL rule is delivered, and the traffic is distributed according to the ACL rule.
所述ACL规则为ACL五元组,通过内容寻址存储器TCAM或前缀树trie表下发。The ACL rule is an ACL quintuple, which is delivered through a content-addressable memory TCAM or a prefix tree trie table.
可选地,在进行流量分发时,该方法还包括:Optionally, when performing traffic distribution, the method further includes:
当进行流量分发出现ACL规则不匹配时,对该种类流量采用所述第一负荷分担分流,并统计采用所述第一负荷分担分流的流量的种类数,当统计流量种类数大于匹配调整阈值时,对未分发的流量重新采用所述第二负荷的分担方法进行流量分发。When the ACL rule does not match the traffic distribution, the first load balancing is used for the traffic of the type, and the number of traffic types of the first load sharing traffic is counted. When the number of the traffic traffic types is greater than the matching adjustment threshold. And distributing the traffic of the second load by using the second load sharing method for the undistributed traffic.
一种实现负荷分担的装置,包括:统计分析单元和判断处理单元;其中,An apparatus for implementing load sharing, comprising: a statistical analysis unit and a judgment processing unit; wherein
统计分析单元,设置为:统计第一预设时长内在第一负荷分担方法下的每个链路流量,获得系统的负荷分担参数;The statistical analysis unit is configured to: collect statistics on each link under the first load sharing method in the first preset duration, and obtain a load sharing parameter of the system;
判断处理单元包括判断模块及处理模块;其中,The judgment processing unit includes a judgment module and a processing module; wherein
判断模块,设置为:当负荷分担参数大于或等于预先设置的负荷分担阈值时,确定负荷分担不均;The determining module is configured to: determine that the load sharing is uneven when the load sharing parameter is greater than or equal to a preset load sharing threshold;
处理模块,设置为:在确定负荷分担不均时,切换到第二负荷分担方法将流量分配到流量分发的链路中进行流量分发。The processing module is configured to: when determining the load sharing unevenness, switch to the second load sharing method to distribute the traffic to the traffic distribution link for traffic distribution.
可选地,统计分析单元是设置为:Optionally, the statistical analysis unit is set to:
统计第一预设时长内在预先设置的基于SIP、或基于DIP、或基于UDP端口号、或基于三元组、或基于五元组、或基于CRC、或基于异或的静态映射方法下的每个链路流量,获得系统的负荷分担参数。 Counting the first preset duration within a pre-set SIP-based, or DIP-based, or UDP-based port number, or triple-based, or quintuple-based, or CRC-based, or XOR-based static mapping method Link traffic, get the load sharing parameters of the system.
可选地,统计分析单元是设置为:Optionally, the statistical analysis unit is set to:
将所述统计的每个链路的流量除以每个链路自身的带宽获得每个链路相应的流量带宽比;Dividing the traffic of each link of the statistics by the bandwidth of each link itself to obtain a corresponding traffic bandwidth ratio of each link;
将所述流量带宽比中的最大值减去流量带宽比的最小值,获得负荷分担参数。The load sharing parameter is obtained by subtracting the minimum value of the traffic bandwidth ratio from the maximum value in the traffic bandwidth ratio.
可选地,处理模块是设置为:在确定负荷分担不均时,Optionally, the processing module is configured to: when determining load sharing unevenness,
根据预设比值采样第二预设时长内所述负荷分担所要分发的流量;And sampling the traffic to be distributed by the load sharing in the second preset duration according to the preset ratio;
分析采样流量的种类并获得每个种类流量所占采样流量的第一比值,计算所述链路中每个链路带宽占流量分发的所有链路总带宽的第二比值;Analyzing a type of sampling traffic and obtaining a first ratio of sampling traffic of each type of traffic, and calculating a second ratio of each link bandwidth in the link to a total bandwidth of all links distributed by the traffic;
根据第一比值和第二比值的大小将流量分发到每个链路中进行流量分发。Traffic is distributed to each link for traffic distribution according to the size of the first ratio and the second ratio.
可选地,处理模块是设置为:在确定负荷分担不均时,Optionally, the processing module is configured to: when determining load sharing unevenness,
根据预设比值采样第二预设时长内所述负荷分担所要分发的流量;And sampling the traffic to be distributed by the load sharing in the second preset duration according to the preset ratio;
分析采样流量的种类并获得每个种类流量所占采样流量的第一比值,计算所述链路中每个链路带宽占流量分发的所有链路总带宽的第二比值;Analyzing a type of sampling traffic and obtaining a first ratio of sampling traffic of each type of traffic, and calculating a second ratio of each link bandwidth in the link to a total bandwidth of all links distributed by the traffic;
将每个种类流量和链路分别按照第一比值和第二比值的大小进行排序后,按照第一比值最大到第一比值最小的顺序,将每个种类流量分配到第二比值由小至大的每个链路中。After sorting each type of traffic and link according to the first ratio and the second ratio, respectively, assigning each type of traffic to the second ratio from small to large according to the order of the first ratio up to the first ratio being the smallest. In each link.
可选地,处理模块是设置为:在确定负荷分担不均时,Optionally, the processing module is configured to: when determining load sharing unevenness,
根据预设比值采样第二预设时长内所述负荷分担所要分发的流量;And sampling the traffic to be distributed by the load sharing in the second preset duration according to the preset ratio;
分析采样流量的种类并获得每个种类流量所占采样流量的第一比值,计算所述链路中每个链路带宽占流量分发的所有链路总带宽的第二比值;Analyzing a type of sampling traffic and obtaining a first ratio of sampling traffic of each type of traffic, and calculating a second ratio of each link bandwidth in the link to a total bandwidth of all links distributed by the traffic;
将每个种类流量和链路分别按照第一比值和第二比值的大小进行排序后,将每个种类流量根据第一比值大小由最大到最小的顺序逐个分配至第二比值最小的链路中;After sorting each type of traffic and links according to the first ratio and the second ratio, respectively, each type of traffic is allocated one by one according to the first ratio, from the largest to the smallest, to the second smallest link. ;
计算分配给第二比值最小的链路的每个种类流量的第一比值的累加和,将第二比值最小的链路的第二比值减去计算获得的所述累加和获得差值后, 根据获得的差值确定是否继续往该链路分配分发的流量;Calculating an accumulated sum of first ratios of each type of traffic assigned to the link having the smallest second ratio, and subtracting the calculated second sum from the second ratio to obtain the difference obtained by the calculation Determining whether to continue distributing the distributed traffic to the link according to the obtained difference;
停止往该链路分配流量时,将该链路从分配分发流量的排序中移出,更新未分配的每个种类流量的第一比值的大小排序和未分配的链路的第二比值的大小排序,以更新的第一比值排序和第二比值排序继续每个种类流量的流量分发分配,直至只剩一个链路时,将未分配的每个种类流量统一分配给该剩余的链路。When the allocation of traffic to the link is stopped, the link is removed from the ordering of the distributed distribution traffic, and the size ratio of the first ratio of each type of traffic that is not allocated is updated and the second ratio of the unallocated links is sorted. The traffic distribution allocation of each type of traffic is continued with the updated first ratio order and the second ratio sorting until each link is unassigned, and unassigned each type of traffic is uniformly allocated to the remaining links.
可选地,处理模块是设置为:在确定负荷分担不均时,Optionally, the processing module is configured to: when determining load sharing unevenness,
根据预设比值采样第二预设时长内所述负荷分担所要分发的流量;And sampling the traffic to be distributed by the load sharing in the second preset duration according to the preset ratio;
分析采样流量的种类并获得每个种类流量所占采样流量的第一比值,计算所述链路中每个链路带宽占流量分发的所有链路总带宽的第二比值;Analyzing a type of sampling traffic and obtaining a first ratio of sampling traffic of each type of traffic, and calculating a second ratio of each link bandwidth in the link to a total bandwidth of all links distributed by the traffic;
将每个种类流量和链路分别按照第一比值和第二比值的大小进行排序后,将每个种类流量根据第一比值大小由最大到最小的顺序逐个分配至第二比值最小的链路中;After sorting each type of traffic and links according to the first ratio and the second ratio, respectively, each type of traffic is allocated one by one according to the first ratio, from the largest to the smallest, to the second smallest link. ;
将第二比值最小的链路的第二比值减去计算获得的分配给第二比值最小的链路的每个种类流量的第一比值的累加和获得差值后,当差值等于零时,停止该链路的流量分配;当差值小于零时,将小于零时的对应的种类流量作为未分配的流量,停止往该链路分配流量;The second ratio of the link having the smallest second ratio is subtracted from the calculated sum of the first ratios of the flow rates of each type of the link assigned to the link with the smallest second ratio, and then the difference is obtained when the difference is equal to zero. The traffic distribution of the link; when the difference is less than zero, the corresponding type of traffic when the value is less than zero is used as the unallocated traffic, and the traffic is allocated to the link;
停止往该链路分配流量时,将该链路从分配分发流量的排序中移出,更新未分配的每个种类流量的第一比值的大小排序和未分配的链路的第二比值的大小排序,以更新的第一比值排序和第二比值排序继续每个种类流量的流量分发分配,直至只剩一个链路时,将未分配的每个种类流量统一分配给该剩余的链路。When the allocation of traffic to the link is stopped, the link is removed from the ordering of the distributed distribution traffic, and the size ratio of the first ratio of each type of traffic that is not allocated is updated and the second ratio of the unallocated links is sorted. The traffic distribution allocation of each type of traffic is continued with the updated first ratio order and the second ratio sorting until each link is unassigned, and unassigned each type of traffic is uniformly allocated to the remaining links.
可选地,判断模块,还设置为:当负荷分担参数小于预先设置的负荷分担阈值时,确定负荷分担均匀;Optionally, the determining module is further configured to: when the load sharing parameter is less than a preset load sharing threshold, determine that the load sharing is uniform;
处理模块,还设置为:在确定负荷分担均匀时,采用第一负荷分担方法进行流量分发。The processing module is further configured to: when determining load sharing is uniform, use the first load sharing method to perform traffic distribution.
可选地,该装置还包括规则下发单元,设置为:在切换到第二负荷分担方法进行流量分发后,根据所述流量分配到流量分发的链路下发相应的ACL 规则,根据ACL规则进行流量分发;Optionally, the device further includes a rule sending unit, configured to: after switching to the second load sharing method for traffic distribution, assigning a corresponding ACL according to the traffic distribution to the traffic distribution link Rules, traffic distribution based on ACL rules;
ACL规则为ACL五元组,通过内容寻址存储器TCAM或前缀树trie表下发。The ACL rule is ACL quintuple and is delivered through the content-addressable memory TCAM or the prefix tree trie table.
可选地,该装置还包括统计处理单元,设置为:在进行流量分发时,Optionally, the device further includes a statistical processing unit, configured to: when performing traffic distribution,
当进行流量分发出现ACL规则不匹配时,对该种类流量采用所述第一负荷分担分流,并统计采用所述第一负荷分担分流的流量的种类数,当统计流量种类数大于匹配调整阈值时,对未分发的流量重新采用所述第二负荷的分担方法进行流量分发。When the ACL rule does not match the traffic distribution, the first load balancing is used for the traffic of the type, and the number of traffic types of the first load sharing traffic is counted. When the number of the traffic traffic types is greater than the matching adjustment threshold. And distributing the traffic of the second load by using the second load sharing method for the undistributed traffic.
一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令用于执行上述任一项的方法。A computer readable storage medium storing computer executable instructions for performing the method of any of the above.
与相关技术相比,本文技术方案包括:统计第一预设时长内在第一负荷分担方法下的每个链路流量,获得系统的负荷分担参数;当负荷分担参数大于或等于预先设置的负荷分担阈值时,确定负荷分担不均,切换到第二负荷分担方法将流量分配到流量分发的链路中进行流量分发。本发明实施例通过负荷分担参数超过负荷分担阈值时,采用第二负荷分担方法,解决了负荷分担不均的问题;进一步地,每个种类流量按照由大至小分配到链路带宽从小到大的链路,最后未分配的流量通过最大的链路进行消化处理,更加合理的解决了负荷分担不均的问题。Compared with the related art, the technical solution of the present invention includes: collecting the traffic of each link in the first load sharing method for the first preset duration, and obtaining the load sharing parameter of the system; when the load sharing parameter is greater than or equal to the preset load sharing At the threshold, the load sharing is determined to be uneven, and the second load sharing method is configured to distribute the traffic to the traffic distribution link for traffic distribution. In the embodiment of the present invention, when the load sharing parameter exceeds the load sharing threshold, the second load sharing method is used to solve the problem of uneven load sharing; further, each type of traffic is allocated from large to small to link bandwidth from small to large. The link, the last unallocated traffic is digested by the largest link, which solves the problem of uneven load sharing.
附图概述BRIEF abstract
图1为本发明实施例实现负荷分担的方法的流程图;FIG. 1 is a flowchart of a method for implementing load sharing according to an embodiment of the present invention;
图2为本发明实施例负荷分担的装置的结构框图;2 is a structural block diagram of an apparatus for load sharing according to an embodiment of the present invention;
图3是本发明第一实施例的方法的流程图。Figure 3 is a flow chart of the method of the first embodiment of the present invention.
本发明的实施方式Embodiments of the invention
下文中将结合附图对本发明的实施方式进行详细说明。需要说明的是,在不冲突的情况下,本文中的实施例及实施例中的特征可以相互任意组合。 Embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be noted that, in the case of no conflict, the features in the embodiments and the embodiments herein may be arbitrarily combined with each other.
图1为本发明实施例实现负荷分担的方法的流程图,如图1所示,包括:FIG. 1 is a flowchart of a method for implementing load sharing according to an embodiment of the present invention. As shown in FIG. 1 , the method includes:
步骤100、统计第一预设时长内在第一负荷分担方法下的每个链路流量,获得系统的负荷分担参数;Step 100: Collect each link traffic under the first load sharing method for the first preset duration, and obtain a load sharing parameter of the system.
需要说明的是,统计链路中流量大小属于本领域技术人员的惯用技术手段。It should be noted that the size of the traffic in the statistical link belongs to the conventional technical means of those skilled in the art.
本步骤中,负荷分担参数为:In this step, the load sharing parameters are:
将统计的每个链路的流量除以每个链路自身的带宽获得每个链路相应的流量带宽比;Dividing the traffic of each link by the bandwidth of each link itself to obtain the corresponding traffic bandwidth ratio of each link;
将流量带宽比中的最大值减去流量带宽比的最小值,获得负荷分担参数。The load sharing parameter is obtained by subtracting the minimum value of the traffic bandwidth ratio from the maximum value in the traffic bandwidth ratio.
本步骤中,第一负荷分担方法包括:In this step, the first load sharing method includes:
预先设置的基于源网络之间互连的协议(SIP)、或基于目的网络之间互连的协议(DIP)、或基于用户数据报协议(UDP)端口号、或基于三元组、或基于五元组、或基于循环冗余校验码(CRC)、或基于异或的静态映射方法。Pre-set protocols based on interconnection between source networks (SIP), or protocols based on interconnection between destination networks (DIP), or based on User Datagram Protocol (UDP) port numbers, or based on triples, or based on A quintuple, or a cyclic redundancy check code (CRC), or an XOR-based static mapping method.
步骤101、当负荷分担参数大于或等于预先设置的负荷分担阈值时,确定流量在链路中分担不均,切换到第二负荷分担方法将流量分配到流量分发的链路中进行流量分发。Step 101: When the load sharing parameter is greater than or equal to the preset load sharing threshold, determine that the traffic is unevenly distributed in the link, and switch to the second load sharing method to distribute the traffic to the traffic distribution link for traffic distribution.
当负荷分担参数小于预先设置的负荷分担阈值时,该方法还包括:When the load sharing parameter is less than a preset load sharing threshold, the method further includes:
采用第一负荷分担方法进行流量分发。The first load sharing method is used for traffic distribution.
需要说明的是,第一预设时长主要根据负荷分担的流量种类及数量大小来确定,一般的种类越多、数量越大的流量分发过程,第一预设时长可以取值较小,反之,取值较大;负荷分担阈值主要根据对负荷分担的质量、链路带宽及流量数量设定,如果负荷分担要求高,则负荷分担阈值就低,反之亦然。切换到第二负荷分担方法时,一般会需要牺牲部分系统性能,因此,负荷分担阈值根据系统性能和负荷分担要求进行分析设定,根据实际情况可以进行调整。It should be noted that the first preset duration is mainly determined according to the type and quantity of the traffic shared by the load. The more the general types and the larger the number of traffic distribution processes, the smaller the first preset duration may be. The value of the load sharing threshold is set based on the quality of the load sharing, the link bandwidth, and the traffic volume. If the load sharing requirement is high, the load sharing threshold is low, and vice versa. When switching to the second load sharing method, it is generally necessary to sacrifice some system performance. Therefore, the load sharing threshold is analyzed and set according to system performance and load sharing requirements, and can be adjusted according to actual conditions.
一般情况下符合分担的第一预设时长应在10分钟到2小时的范围内比较合理,阈值不应超过5%。特殊情况下负荷分担流量速度较大且负荷流量稳定 的前提下,可以设置第一预设时长为最小值10分钟,当流量较小时可以设置第一预设时长为30分钟。当链路带宽比较大,负荷分担流量分发在每条链路上所占的带宽比重较小时,可以设置负荷分担阈值为最高值5%,当链路带宽相对于负荷分担流量比重接近1:1时,此时需要设置负荷分担阈值为0.1%较为合适。In general, the first preset duration that meets the sharing should be reasonable within the range of 10 minutes to 2 hours, and the threshold should not exceed 5%. In special cases, the load sharing flow rate is large and the load flow rate is stable. On the premise, the first preset duration can be set to a minimum value of 10 minutes, and when the flow rate is small, the first preset duration can be set to 30 minutes. When the bandwidth of the link is large, the load sharing threshold is set to a maximum value of 5%. The link bandwidth is close to 1:1. At this time, it is appropriate to set the load sharing threshold to 0.1%.
本步骤中,第二负荷的分担方法包括:In this step, the method for sharing the second load includes:
根据预设比值采样第二预设时长内负荷分担所要分发的流量;分析采样流量的种类并获得每个种类流量所占采样流量的第一比值,计算所述链路中每个链路带宽占流量分发的所有链路总带宽的第二比值;Sampling the traffic to be distributed by the load sharing in the second preset duration according to the preset ratio; analyzing the type of the sampling traffic and obtaining the first ratio of the sampling traffic of each type of traffic, and calculating the bandwidth of each link in the link The second ratio of the total bandwidth of all links distributed by the traffic;
根据第一比值和第二比值的大小将流量分发到每个链路中。Traffic is distributed to each link based on the size of the first ratio and the second ratio.
可选的,根据第一比值和第二比值的大小将流量分发到每个链路中包括:Optionally, distributing traffic to each link according to the first ratio and the second ratio includes:
将每个种类流量和链路分别按照第一比值和第二比值的大小进行排序后,按照第一比值最大到第一比值最小的顺序,将每个种类流量分配到第二比值由小至大的每个链路中。After sorting each type of traffic and link according to the first ratio and the second ratio, respectively, assigning each type of traffic to the second ratio from small to large according to the order of the first ratio up to the first ratio being the smallest. In each link.
可选的,按照第一比值最大到第一比值最小的顺序,将每个种类流量分配到第二比值由小至大的每个链路中包括:Optionally, each type of traffic is allocated to each of the links whose second ratio is from small to large according to the order that the first ratio is up to the first ratio is the smallest:
将每个种类流量和链路分别按照第一比值和第二比值的大小进行排序后,将每个种类流量根据第一比值大小由最大到最小的顺序逐个分配至第二比值最小的链路中;After sorting each type of traffic and links according to the first ratio and the second ratio, respectively, each type of traffic is allocated one by one according to the first ratio, from the largest to the smallest, to the second smallest link. ;
计算分配给第二比值最小的链路的每个种类流量的第一比值的累加和,将第二比值最小的链路的第二比值减去计算获得的累加和获得差值后,根据获得的差值确定是否继续往该链路分配分发的流量;Calculating an accumulated sum of the first ratios of each type of traffic assigned to the link having the smallest second ratio, subtracting the calculated second sum ratio of the second ratio from the calculated accumulated sum and obtaining the difference, according to the obtained The difference determines whether to continue to distribute the distributed traffic to the link;
停止往该链路分配流量时,将该链路从分配分发流量的排序中移出,更新未分配的每个种类流量的第一比值的大小排序和未分配的链路的第二比值的大小排序,以更新的第一比值排序和第二比值排序继续每个种类流量的流量分发分配,直至只剩一个链路时,将未分配的每个种类流量统一分配给该剩余的链路。When the allocation of traffic to the link is stopped, the link is removed from the ordering of the distributed distribution traffic, and the size ratio of the first ratio of each type of traffic that is not allocated is updated and the second ratio of the unallocated links is sorted. The traffic distribution allocation of each type of traffic is continued with the updated first ratio order and the second ratio sorting until each link is unassigned, and unassigned each type of traffic is uniformly allocated to the remaining links.
可选的,根据获得的差值确定是否继续往该链路分配分发的流量包括: 将第二比值最小的链路的第二比值减去计算获得的分配给第二比值最小的链路的每个种类流量的第一比值的累加和获得差值后,当差值等于零时,停止往该链路分配流量;当差值小于零时,将小于零时的对应的种类流量作为未分配的流量,停止往该链路分配流量。Optionally, determining, according to the obtained difference, whether to continue to distribute the distributed traffic to the link includes: The second ratio of the link having the smallest second ratio is subtracted from the calculated sum of the first ratios of the flow rates of each type of the link assigned to the link with the smallest second ratio, and then the difference is obtained when the difference is equal to zero. Traffic is allocated to the link; when the difference is less than zero, the corresponding type of traffic that is less than zero is used as unallocated traffic, and traffic is allocated to the link.
需要说明的是,进行负荷分担方法时,往往需要区分不同路的负荷分担的流量数据,一般的可以通过流关键字虚拟专用网络功能号(VPN ID)加上DIP或其他可以区分不同路的负荷分担的流量数据,属于本领域技术人员的公知常识。It should be noted that when performing the load sharing method, it is often necessary to distinguish the load sharing data of different paths. Generally, the flow keyword virtual private network function number (VPN ID) plus DIP or other load that can distinguish different paths can be used. The shared traffic data is a common knowledge of those skilled in the art.
进行采样时的预设比值根据系统对第二负荷分担方法的质量要求和流量分发的流量种类和数量进行设定,一般的,要求质量越高预设比值越大,但是流量种类和数量越大,采用高预设比值要求采样大量流量数据,会影响一定系统性能,因此,根据实际需求和系统性能进行设定。可以通过,当系统设备当前流量速度占最大流量速度的比重小于50%时,可设定预设比值为1:1,此时对系统设备的运行影响较小,且高采样比时可以设定的第二预设时长可以设定为较小值(如10分钟);当系统设备当前流量速度占最大流量速度的比重为80%时,可以设定采样的预设比值不超过4:1,考虑普通流量速度情况,设定预设比值为10:1且第二预设时长设定为30分钟;当系统设备当前流量速度占最大流量速度的比重为99%时,可以设定预设比值为不超过100:1,考虑普通流量速度情况下,设定预设比值为1000:1且第二预设时长为120分钟,若报文流量速度很大,则可设定预设比值为100:1且第二预设时长为60分钟;第二预设时长的取值的主要参考因数与第一预设时长的参考因数相同。The preset ratio when sampling is set according to the quality requirements of the second load sharing method and the type and quantity of traffic distributed by the system. Generally, the higher the required quality, the larger the preset ratio, but the larger the type and quantity of traffic. Using a high preset ratio to sample a large amount of traffic data will affect certain system performance. Therefore, it is set according to actual needs and system performance. It can be passed. When the current flow rate of the system device accounts for less than 50% of the maximum flow speed, the preset ratio can be set to 1:1. At this time, the impact on the operation of the system equipment is small, and the high sampling ratio can be set. The second preset duration can be set to a smaller value (such as 10 minutes); when the current flow rate of the system device accounts for 80% of the maximum flow velocity, the preset ratio of the sampling can be set to not exceed 4:1. Considering the normal flow rate, set the preset ratio to 10:1 and the second preset duration to 30 minutes. When the current flow rate of the system device accounts for 99% of the maximum flow rate, the preset ratio can be set. For the case of no more than 100:1, consider the normal flow rate, set the preset ratio to 1000:1 and the second preset duration to 120 minutes. If the message flow speed is very large, you can set the preset ratio to 100. :1 and the second preset duration is 60 minutes; the primary reference factor of the second preset duration is the same as the reference factor of the first preset duration.
在切换到所述第二负荷分担方法进行流量分发后,本发明实施例方法还包括:After switching to the second load sharing method for performing traffic distribution, the method of the embodiment of the present invention further includes:
根据流量分配到流量分发的链路、下发相应的访问控制列表(ACL)规则,根据ACL规则进行流量分发;Distribute the traffic according to the ACL rule based on the traffic distribution to the traffic distribution link and the corresponding access control list (ACL) rules.
ACL规则为ACL五元组,通过内容寻址存储器(TCAM)或前缀树(trie)表下发。The ACL rule is an ACL five-tuple, which is delivered through a content-addressable memory (TCAM) or a prefix tree (trie) table.
在进行流量分发时,本发明实施例方法还包括: The method of the embodiment of the present invention further includes:
当进行流量分发出现ACL规则不匹配时,对该种类流量采用所述第一负荷分担分流,并统计采用所述第一负荷分担分流的流量的种类数,当统计流量种类数大于匹配调整阈值时,对未分发的流量重新采用所述第二负荷的分担方法进行流量分发。When the ACL rule does not match the traffic distribution, the first load balancing is used for the traffic of the type, and the number of traffic types of the first load sharing traffic is counted. When the number of the traffic traffic types is greater than the matching adjustment threshold. And distributing the traffic of the second load by using the second load sharing method for the undistributed traffic.
需要说明的是,匹配调整阈值主要根据系统对负荷分担均匀要求程度有关,要求越高,调整数值越小,要求低时,数值较大可设置匹配调整阈值范围为0.1%~5%。对于链路冗余带宽较多的场景,当负荷分担不均时对于系统流量不会产生较坏的影响,此时可以设置匹配调整阈值为较大值5%;对于链路负荷分担流量的带宽较小时,如10M的流经过10G带宽的情况下,此时可以设置匹配调整阈值为最大值5%。仅当负荷分担流量所占带宽与链路带宽比重接近时,此时要求负荷分担均匀程度严格,否则分担不均时可能会导致其中一条链路流量分配过大丢包而其他链路则存在冗余带宽的情况,如负荷分担流量与总链路带宽比重为99:100时,此时需要匹配调整阈值为较小值,例如0.1%。It should be noted that the matching adjustment threshold is mainly related to the system's uniform requirement for load sharing. The higher the requirement, the smaller the adjustment value is. When the requirement is low, the value can be set to be 0.1% to 5%. For a scenario with a large number of links with redundant bandwidth, the system does not have a bad impact on the system traffic. In this case, you can set the matching adjustment threshold to a larger value of 5%. When it is small, if the 10M stream passes through the 10G bandwidth, the matching adjustment threshold can be set to a maximum value of 5%. When the load-sharing traffic is close to the link bandwidth, the load sharing uniformity is required to be strict. Otherwise, one link traffic may be excessively allocated and the other links may be redundant. In the case of the remaining bandwidth, such as the load sharing traffic and the total link bandwidth ratio of 99:100, the matching adjustment threshold is required to be a small value, for example, 0.1%.
本发明实施例方法通过在负荷分担参数超过负荷分担阈值时,采用第二负荷分担方法,按照第一比值最大到第一比值最小的顺序,将每个种类流量分配到第二比值由小至大的每个链路中,使每个链路负荷分担均匀,进一步地,每个种类流量按照由大至小分配到链路带宽从小到大的链路中,最后未分配的流量通过第二比值最大的链路带宽进行消化处理,更加合理的解决了负荷分担不均的问题。In the method of the embodiment of the present invention, when the load sharing parameter exceeds the load sharing threshold, the second load sharing method is adopted, and each type of traffic is allocated to the second ratio from small to large according to the order of the first ratio to the first ratio being the smallest. In each link, each link load is evenly distributed. Further, each type of traffic is allocated from the largest to the smallest link to the link bandwidth from small to large, and the last unallocated traffic passes the second ratio. The maximum link bandwidth is digested, which solves the problem of uneven load sharing.
图2为本发明实施例实现负荷分担的系统的结构框图,如图2所示,包括:统计分析单元21和判断处理单元22;其中,2 is a structural block diagram of a system for implementing load sharing according to an embodiment of the present invention. As shown in FIG. 2, the method includes: a statistical analysis unit 21 and a determination processing unit 22;
统计分析单元21,设置为:统计第一预设时长内在第一负荷分担方法下的每个链路流量,获得系统的负荷分担参数;The statistical analysis unit 21 is configured to: collect each link traffic under the first load sharing method for the first preset duration, and obtain a load sharing parameter of the system;
判断处理单元22包括判断模块221及处理模块222;其中,The determination processing unit 22 includes a determination module 221 and a processing module 222;
判断模块221,设置为:当负荷分担参数大于或等于预先设置的负荷分担阈值时,确定负荷分担不均;The determining module 221 is configured to: determine that the load sharing is uneven when the load sharing parameter is greater than or equal to a preset load sharing threshold;
处理模块222,设置为:在确定负荷分担不均时,切换到第二负荷分担 方法将流量分配到流量分发的链路中进行流量分发。The processing module 222 is configured to switch to the second load sharing when determining the load sharing unevenness The method distributes traffic to the traffic distribution link for traffic distribution.
可选的,统计分析单元21是设置为:Optionally, the statistical analysis unit 21 is configured to:
统计第一预设时长内在预先设置的基于SIP、或基于DIP、或基于UDP端口号、或基于三元组、或基于五元组、或基于CRC、或基于异或的静态映射方法下的每个链路流量,获得系统的负荷分担参数。Counting the first preset duration within a pre-set SIP-based, or DIP-based, or UDP-based port number, or triple-based, or quintuple-based, or CRC-based, or XOR-based static mapping method Link traffic, get the load sharing parameters of the system.
统计分析单元21是设置为:The statistical analysis unit 21 is set to:
将统计的每个链路的流量除以每个链路自身的带宽获得每个链路相应的流量带宽比;Dividing the traffic of each link by the bandwidth of each link itself to obtain the corresponding traffic bandwidth ratio of each link;
将流量带宽比中的最大值减去流量带宽比的最小值,获得负荷分担参数。The load sharing parameter is obtained by subtracting the minimum value of the traffic bandwidth ratio from the maximum value in the traffic bandwidth ratio.
处理模块222是设置为:在确定负荷分担不均时,根据预设比值采样第二预设时长内所述负荷分担所要分发的流量;The processing module 222 is configured to: when determining the load sharing unevenness, sample the traffic to be distributed according to the load sharing in the second preset duration according to the preset ratio;
分析采样流量的种类并获得每个种类流量所占采样流量的第一比值,计算所述链路中每个链路带宽占流量分发的所有链路总带宽的第二比值;Analyzing a type of sampling traffic and obtaining a first ratio of sampling traffic of each type of traffic, and calculating a second ratio of each link bandwidth in the link to a total bandwidth of all links distributed by the traffic;
根据第一比值和第二比值的大小将流量分发到每个链路中进行流量分发。Traffic is distributed to each link for traffic distribution according to the size of the first ratio and the second ratio.
可选的,处理模块222是设置为:在确定负荷分担不均时,Optionally, the processing module 222 is configured to: when determining load sharing unevenness,
根据预设比值采样第二预设时长内所述负荷分担所要分发的流量;And sampling the traffic to be distributed by the load sharing in the second preset duration according to the preset ratio;
分析采样流量的种类并获得每个种类流量所占采样流量的第一比值,计算所述链路中每个链路带宽占流量分发的所有链路总带宽的第二比值;Analyzing a type of sampling traffic and obtaining a first ratio of sampling traffic of each type of traffic, and calculating a second ratio of each link bandwidth in the link to a total bandwidth of all links distributed by the traffic;
将每个种类流量和链路分别按照第一比值和第二比值的大小进行排序后,按照第一比值最大到第一比值最小的顺序,将每个种类流量分配到第二比值由小至大的每个链路中。After sorting each type of traffic and link according to the first ratio and the second ratio, respectively, assigning each type of traffic to the second ratio from small to large according to the order of the first ratio up to the first ratio being the smallest. In each link.
可选地,处理模块222是设置为:在确定负荷分担不均时,Optionally, the processing module 222 is configured to: when determining load sharing unevenness,
根据预设比值采样第二预设时长内所述负荷分担所要分发的流量;And sampling the traffic to be distributed by the load sharing in the second preset duration according to the preset ratio;
分析采样流量的种类并获得每个种类流量所占采样流量的第一比值,计算所述链路中每个链路带宽占流量分发的所有链路总带宽的第二比值;Analyzing a type of sampling traffic and obtaining a first ratio of sampling traffic of each type of traffic, and calculating a second ratio of each link bandwidth in the link to a total bandwidth of all links distributed by the traffic;
将每个种类流量和链路分别按照第一比值和第二比值的大小进行排序 后,将每个种类流量根据第一比值大小由最大到最小的顺序逐个分配至第二比值最小的链路中;Sort each type of traffic and link according to the first ratio and the second ratio After that, each type of traffic is allocated one by one according to the first ratio size from the largest to the smallest, to the link with the smallest second ratio;
计算分配给第二比值最小的链路的每个种类流量的第一比值的累加和,将第二比值最小的链路的第二比值减去计算获得的所述累加和获得差值后,根据获得的差值确定是否继续往该链路分配分发的流量;Calculating an accumulated sum of the first ratios of each type of traffic assigned to the link having the smallest second ratio, subtracting the second ratio of the link having the smallest second ratio from the calculated sum obtained and obtaining the difference, according to The obtained difference determines whether to continue to distribute the distributed traffic to the link;
停止往该链路分配流量时,将该链路从分配分发流量的排序中移出,更新未分配的每个种类流量的第一比值的大小排序和未分配的链路的第二比值的大小排序,以更新的第一比值排序和第二比值排序继续每个种类流量的流量分发分配,直至只剩一个链路时,将未分配的每个种类流量统一分配给该剩余的链路。When the allocation of traffic to the link is stopped, the link is removed from the ordering of the distributed distribution traffic, and the size ratio of the first ratio of each type of traffic that is not allocated is updated and the second ratio of the unallocated links is sorted. The traffic distribution allocation of each type of traffic is continued with the updated first ratio order and the second ratio sorting until each link is unassigned, and unassigned each type of traffic is uniformly allocated to the remaining links.
处理模块222是设置为:在确定负荷分担不均时,The processing module 222 is configured to: when determining load sharing unevenness,
根据预设比值采样第二预设时长内所述负荷分担所要分发的流量;And sampling the traffic to be distributed by the load sharing in the second preset duration according to the preset ratio;
分析采样流量的种类并获得每个种类流量所占采样流量的第一比值,计算所述链路中每个链路带宽占流量分发的所有链路总带宽的第二比值;Analyzing a type of sampling traffic and obtaining a first ratio of sampling traffic of each type of traffic, and calculating a second ratio of each link bandwidth in the link to a total bandwidth of all links distributed by the traffic;
将每个种类流量和链路分别按照第一比值和第二比值的大小进行排序后,将每个种类流量根据第一比值大小由最大到最小的顺序逐个分配至第二比值最小的链路中;After sorting each type of traffic and links according to the first ratio and the second ratio, respectively, each type of traffic is allocated one by one according to the first ratio, from the largest to the smallest, to the second smallest link. ;
将第二比值最小的链路的第二比值减去计算获得的分配给第二比值最小的链路的每个种类流量的第一比值的累加和获得差值后,当差值等于零时,停止该链路的流量分配;当差值小于零时,将小于零时的对应的种类流量作为未分配的流量,停止往该链路分配流量;The second ratio of the link having the smallest second ratio is subtracted from the calculated sum of the first ratios of the flow rates of each type of the link assigned to the link with the smallest second ratio, and then the difference is obtained when the difference is equal to zero. The traffic distribution of the link; when the difference is less than zero, the corresponding type of traffic when the value is less than zero is used as the unallocated traffic, and the traffic is allocated to the link;
停止往该链路分配流量时,将该链路从分配分发流量的排序中移出,更新未分配的每个种类流量的第一比值的大小排序和未分配的链路的第二比值的大小排序,以更新的第一比值排序和第二比值排序继续每个种类流量的流量分发分配,直至只剩一个链路时,将未分配的每个种类流量统一分配给该剩余的链路。When the allocation of traffic to the link is stopped, the link is removed from the ordering of the distributed distribution traffic, and the size ratio of the first ratio of each type of traffic that is not allocated is updated and the second ratio of the unallocated links is sorted. The traffic distribution allocation of each type of traffic is continued with the updated first ratio order and the second ratio sorting until each link is unassigned, and unassigned each type of traffic is uniformly allocated to the remaining links.
本发明实施例装置,判断模块221还设置为:当负荷分担参数小于预先设置的负荷分担阈值时,确定负荷分担均匀; In the device of the embodiment of the present invention, the determining module 221 is further configured to: when the load sharing parameter is less than a preset load sharing threshold, determine that the load sharing is uniform;
处理模块222还设置为:在确定负荷分担均匀时,采用第一负荷分担方法进行流量分发。The processing module 222 is further configured to perform traffic distribution by using the first load sharing method when determining that the load sharing is uniform.
本发明实施例装置还包括规则下发单元23,设置为:在切换到第二负荷分担方法进行流量分发后,根据所述流量分配到流量分发的链路下发相应的ACL规则,根据ACL规则进行流量分发;The device of the embodiment of the present invention further includes a rule issuing unit 23, configured to: after switching to the second load sharing method for traffic distribution, assigning the corresponding ACL rule according to the traffic distribution to the traffic distribution link, according to the ACL rule Traffic distribution;
ACL规则为ACL五元组,通过内容寻址存储器(TCAM)或前缀树(trie)表下发。The ACL rule is an ACL five-tuple, which is delivered through a content-addressable memory (TCAM) or a prefix tree (trie) table.
本发明实施例装置还包括统计处理单元24,设置为:在进行流量分发时,The apparatus of the embodiment of the present invention further includes a statistical processing unit 24, configured to: when performing traffic distribution,
当进行流量分发出现ACL规则不匹配时,对该种类流量采用所述第一负荷分担分流,并统计采用所述第一负荷分担分流的流量的种类数,当统计流量种类数大于匹配调整阈值时,对未分发的流量重新采用所述第二负荷的分担方法进行流量分发。When the ACL rule does not match the traffic distribution, the first load balancing is used for the traffic of the type, and the number of traffic types of the first load sharing traffic is counted. When the number of the traffic traffic types is greater than the matching adjustment threshold. And distributing the traffic of the second load by using the second load sharing method for the undistributed traffic.
以下通过实施例对本发明实施例的工作过程进行说明。The working process of the embodiment of the present invention will be described below by way of examples.
实施例1Example 1
图3是本发明第一实施例的方法的流程图,如图3所示,3 is a flow chart of the method of the first embodiment of the present invention, as shown in FIG.
步骤300、采用预设比值为1:1,进行第二负荷分担方法的流量采样;Step 300: Perform a traffic sampling of the second load sharing method by using a preset ratio of 1:1.
本步骤中,预设比值设定为1:1说明对第二负荷分担方法的质量要求高,另外,本实施例中通过流关键字虚拟专用网络功能号(VPN ID)加上DIP识别本实施例需要采用第二负荷分担方法处理的流量数据。In this step, the preset ratio is set to 1:1, indicating that the quality requirement of the second load sharing method is high. In addition, in this embodiment, the flow keyword virtual private network function number (VPN ID) plus DIP identification implementation is implemented. For example, traffic data processed by the second load sharing method is required.
步骤301、将采样的流量数据写入缓存,分析采样流量的种类并获得每个种类流量所占采样流量的第一比值;Step 301: Write the sampled traffic data into the buffer, analyze the type of the sampled traffic, and obtain a first ratio of the sampled traffic of each type of traffic;
步骤302、计算所述链路中每个链路带宽占流量分发的所有链路总带宽的第二比值;Step 302: Calculate a second ratio of the bandwidth of each link in the link to the total bandwidth of all links distributed by the traffic.
步骤303、根据第二负荷分担方法将每个种类流量分发的相应的链路中;包括:Step 303: Distribute each type of traffic in a corresponding link according to the second load sharing method, including:
将每个种类流量和链路分别按照第一比值和第二比值的大小进行排序后,将每个种类流量根据第一比值大小由最大到最小的顺序逐个分配至第二 比值最小的链路中,根据第二比值最小的链路的第二比值减去、分配给其的每个种类流量的第一比值的和的值确定是否继续往该链路分配分发的流量;停止往该链路分配流量时,将该链路从分配分发流量的排序中移出,更新未分配的每个种类流量的第一比值的大小排序和未分配的链路的第二比值的大小排序,以更新的第一比值排序和第二比值排序继续每个种类流量的流量分发分配,直至只剩一个链路时,将未分配的每个种类流量统一分配给该剩余的链路;其中,根据第二比值最小的链路的第二比值减去、分配给其的每个种类流量的第一比值的和的值确定是否继续往该链路分配流量包括:将第二比值最小的链路的第二比值减去分配给其的每个种类流量的第一比值的和获得相应的差值,当差值等于零时,停止往该链路分配流量;当差值小于零时,将小于零时的对应的种类流量作为未分配的流量,停止往该链路分配流量。After sorting each type of traffic and links according to the first ratio and the second ratio, respectively, each type of traffic is allocated one by one according to the first ratio from the largest to the smallest. In the link with the smallest ratio, the value of the sum of the first ratios of each type of traffic assigned to the second ratio of the second ratio minus the second ratio is determined to determine whether to continue to distribute the distributed traffic to the link; When the allocation of traffic to the link is stopped, the link is removed from the ordering of the distributed distribution traffic, and the size ratio of the first ratio of each type of traffic that is not allocated is updated and the second ratio of the unallocated links is sorted. And arranging the traffic distribution distribution of each type of traffic by the updated first ratio ordering and the second ratio sorting, until only one link remains, and unassigned each type of traffic is uniformly allocated to the remaining links; Determining whether to continue to distribute traffic to the link according to a value of a sum of the first ratios of each type of traffic assigned to the second ratio of the link having the smallest second ratio, including: a link that minimizes the second ratio The second ratio minus the sum of the first ratios of each type of traffic assigned to it obtains a corresponding difference, and when the difference is equal to zero, stops distributing traffic to the link; when the difference is less than zero, it is small Type flow rate as a flow rate corresponding to zero unallocated, allocate traffic to stop the link.
步骤304、在切换到第二负荷分担方法进行流量分发后,根据流量分配到流量分发的链路下发相应的ACL规则,根据ACL规则进行流量分发;Step 304: After the traffic is distributed to the second load balancing method, the ACL rule is delivered according to the ACL rule.
步骤305、进行ACL规则匹配,在链路进行流量分发时,会进行ACL规则匹配。当ACL匹配结果为是时,根据步骤3060进行流量分发,相当于采用第二负荷方法完成流量分发,否则执行步骤3070。Step 305: Perform ACL rule matching, and perform ACL rule matching when the link performs traffic distribution. When the ACL matching result is yes, the traffic distribution is performed according to step 3060, which is equivalent to using the second load method to complete the traffic distribution. Otherwise, step 3070 is performed.
步骤3060、根据ACL规则进行流量分发;Step 3060: Perform traffic distribution according to an ACL rule.
步骤3070、对于ACL规则不匹配的流量,采用第一负荷分担分流,统计采用第一负荷分担分流的流量的种类数;Step 3070: The first load sharing offload is used for the traffic that does not match the ACL rule, and the number of types of traffic that is divided by the first load is used.
步骤3071、统计采用第一负荷分担分流的流量的种类数大于匹配调整阈值时,执行步骤300、否则,执行步骤3072。Step 3071: If the number of types of traffic that uses the first load sharing offload is greater than the matching adjustment threshold, step 300 is performed, otherwise, step 3072 is performed.
步骤3072、根据第一负荷分担方法进行流量分发。Step 3072: Perform traffic distribution according to the first load sharing method.
实施例2Example 2
进行流量负荷分担的链路数为3,3条链路的链路带宽比例为1:2:1;The number of links for traffic load sharing is 3, and the link bandwidth ratio of the three links is 1:2:1.
报文的流量为IP流量,基于SIP变化从10.10.10.0~10.10.10.254共255种流量;The traffic of the packet is IP traffic. Based on the SIP change, there are 255 traffic types from 10.10.10.0 to 10.10.10.254.
第一负荷分担方法为源IP的CRC32 mod逻辑linknum链路数的方法,这里,此处物理linknum=3逻辑linknum=1+2+1=4,通过上述取模后,确定分 流至三条链路。The first load sharing method is a method of the CRC32 mod logical linknum link number of the source IP. Here, the physical linknum=3 logical linknum=1+2+1=4, after the above modulo, the determined score Flow to three links.
假设第一预设时长为10分钟,负荷分担阈值(链路最大负荷和链路最小负荷的偏差)为0.05;Assume that the first preset duration is 10 minutes, and the load sharing threshold (the deviation between the link maximum load and the link minimum load) is 0.05;
在第一预设时长内,在第一负荷分担方法下统计三条链路的流量数分别为6200000、12800000和6400000;During the first preset duration, the traffic of the three links is counted as 6200000, 12800000, and 6400000 respectively under the first load sharing method;
将每个链路的负荷分担的流量数与链路带宽相除后得到流量带宽比分别为(62/64)、1和1,Dividing the number of traffic-sharing traffic of each link by the link bandwidth yields a traffic bandwidth ratio of (62/64), 1 and 1, respectively.
计算负荷分担参数为:流量带宽比最大值与流量带宽比最小值之差1-(62/64)=1/32<0.05,认为负荷分担效果均匀,保持采用第一负荷分担方法。The calculation load sharing parameter is: the difference between the maximum value of the flow bandwidth ratio and the minimum value of the flow bandwidth ratio is 1-(62/64)=1/32<0.05, and the load sharing effect is considered to be uniform, and the first load sharing method is maintained.
上述第一负荷分担方法,因不需要采样复杂的统计和下发流程,其分流性能很高,需要优先考虑。保持采用第一负荷分担方法是该实施场景下,进行流量分发的方案。毕竟,从第一负荷分担方法切换到第二负荷分担方法时,是需要损失部分系统性能,才能得到负荷分担均匀的效果的。The first load sharing method described above requires high sampling performance because it does not need to sample complex statistics and delivery processes, and needs to be prioritized. Maintaining the first load sharing method is a scheme for performing traffic distribution in the implementation scenario. After all, when switching from the first load sharing method to the second load sharing method, it is necessary to lose part of the system performance in order to obtain a uniform load sharing effect.
实施例3Example 3
进行流量负荷分担的链路数为3,3条链路的链路带宽比例为1:2:1;The number of links for traffic load sharing is 3, and the link bandwidth ratio of the three links is 1:2:1.
报文的流量为IP流量,基于SIP变化从10.10.10.0~10.10.10.9共10种流量;The traffic of the packet is IP traffic. Based on the SIP change, there are 10 types of traffic from 10.10.10.0 to 10.10.10.9.
基于DIP变化从20.20.20.0~20.20.20.9共10种流量;10 kinds of flow rates from 20.20.20.0 to 20.20.20.9 based on DIP changes;
基于TCP源接口(sport)变化从0~9目的接口(dport)0~9共变化10*10*10*10=10000种流量;Based on the TCP source interface (sport) change from 0 to 9 destination interfaces (dport) 0 to 9 total changes 10 * 10 * 10 * 10 = 10000 kinds of traffic;
假定每条流的流量大小相同。Assume that the flow rate of each stream is the same.
第一负荷分担方法为CRC32(关键字包括sip,dip,sport,dport)mod linknum,此处物理linknum=3,逻辑linknum=1+2+1=4,通过取模后结果,将流量分流到三条链路The first load sharing method is CRC32 (keyword includes sip, dip, sport, dport) mod linknum, where physical linknum=3, logical linknum=1+2+1=4, and the traffic is diverted to the result after modulo Three links
假设第一预设时长为10分钟,负荷分担阈值为0.01;Assume that the first preset duration is 10 minutes and the load sharing threshold is 0.01;
在第一预设时长内,在第一负荷分担方法下统计三条链路的流量数分别为6200000、12800000和6400000; During the first preset duration, the traffic of the three links is counted as 6200000, 12800000, and 6400000 respectively under the first load sharing method;
将每个链路的负荷分担的流量数与链路带宽相除后得到流量带宽比分别为(62/64)、1和1,Dividing the number of traffic-sharing traffic of each link by the link bandwidth yields a traffic bandwidth ratio of (62/64), 1 and 1, respectively.
计算负荷分担参数为:流量带宽比最大值与流量带宽比最小值之差为1-(62/64)=1/32大于0.01;因此,判断负荷分担不均匀,切换到第二负荷分担方法;The load sharing parameter is calculated as follows: the difference between the maximum value of the flow bandwidth ratio and the minimum value of the flow bandwidth ratio is 1-(62/64)=1/32 is greater than 0.01; therefore, the load sharing is determined to be uneven, and the second load sharing method is switched;
根据预设比值采样第二预设时长内负荷分担所要分发的流量;这里,预设比值为1。第二预设时长为10分钟。The traffic to be distributed by the load sharing in the second preset duration is sampled according to the preset ratio; here, the preset ratio is 1. The second preset duration is 10 minutes.
经过10分钟,采样分析获得9900种流量,每种流量第一比值均由小到大分别为1/9900、1/9900、1/9900……1/9900;After 10 minutes, the sampling analysis obtained 9900 kinds of flow, and the first ratio of each flow was from 1/9900, 1/9900, 1/9900...1/9900, respectively;
3条链路的链路带宽的第二比值为0.25:0.5:0.25;The second ratio of the link bandwidth of the three links is 0.25:0.5:0.25;
按照第二负荷分担方法,将每个种类流量排序后,找到最大的流量1/9900分配到恰好满足的最小剩余带宽链路0.25,在每次分配完一种类流量时,将第二比值0.25减去该种类流量的第一比值获得差值,直到差值为零时停止往该链路分配流量;当出现小于零时,将小于零时分配的流量作为下一链路分配流量的初始种类流量;停止往该链路分配流量时,将该链路从流量分发的排序中移出,更新的未分配的每个种类流量的第一比值排序和未分配的链路的第二比值排序继续未分配的每个种类流量的流量分配;在只剩一个链路时,将所有未分配的每个种类流量分配给该剩余的链路;如此分配2475个种类流量至第二比值为0.25的第一个链路;更新第一比值和第二比值后,为第二比值为0.25的另一链路分配继续分配2475个流量,为第二比值为0.5的链路分配剩余的4950个流量,分流比例完美满足链路带宽比例1:2:1,According to the second load sharing method, after sorting each type of traffic, the largest traffic 1/9900 is allocated to the minimum remaining bandwidth link 0.25 which is just satisfied, and the second ratio is reduced by 0.25 each time one type of traffic is allocated. The first ratio of the traffic of the type is obtained, and the difference is obtained until the difference is zero, and the traffic is allocated to the link; when less than zero occurs, the traffic allocated when the value is less than zero is used as the initial traffic of the next link distribution traffic. When the allocation of traffic to the link is stopped, the link is removed from the ordering of the traffic distribution, the updated unallocated first ratio ordering of each type of traffic and the second ratio ordering of the unassigned links continue unallocated Traffic distribution for each type of traffic; when there is only one link left, all unassigned traffic of each type is assigned to the remaining links; thus distributing 2475 traffic types to the first of the second ratio of 0.25 Link; after updating the first ratio and the second ratio, the other link allocation with the second ratio of 0.25 continues to allocate 2475 traffic, and the link with the second ratio of 0.5 is allocated the remaining 4950 traffic. The split ratio perfectly satisfies the link bandwidth ratio of 1:2:1,
完成流量分配后,下发ACL规则进行流量分发,在进行流量分发时,After traffic distribution is complete, ACL rules are delivered for traffic distribution.
当进行流量分发出现种类流量的ACL规则不匹配时,对该种类流量采用第一负荷分担分流,并统计采用第一负荷分担分流的流量的种类数,当统计流量种类数大于预设阈值时,对未分发的流量重新采用第二负荷的分担方法进行流量分发。When the ACL rule of the type of traffic distribution does not match, the first load balancing is used for the traffic of the type, and the number of traffic types of the traffic that is divided by the first load is used. When the number of traffic types is greater than the preset threshold, The traffic distribution is performed by re-using the second load sharing method for the undistributed traffic.
假设实际流量进入种类共10000条,则有100条路匹配ACL失败,无法通过第二负荷分担方法进行流量分发,则通过前述静态基于五元组算法映射 分流。设置重新采用第二负荷分担方法的匹配调整阈值为10.1%,此时100/10000比例小于10.1%,因此,无需重新采用第二负荷分担方法进行流量分发。100个种类流按照第一负荷分担方法进行流量分发,对整体的流量分发的负荷分担均匀效果不大。Assume that the actual traffic entry type is 10000, and 100 routes match the ACL. If the traffic cannot be distributed through the second load sharing method, the static quintuple algorithm is used to map. Diversion. The matching adjustment threshold of the second load sharing method is set to 10.1%, and the 100/10000 ratio is less than 10.1%. Therefore, it is not necessary to re-use the second load sharing method for traffic distribution. The traffic distribution of the 100 types of flows according to the first load sharing method has little effect on the load sharing of the overall traffic distribution.
本领域普通技术人员可以理解上述实施例的全部或部分步骤可以使用计算机程序流程来实现,所述计算机程序可以存储于一计算机可读存储介质中,所述计算机程序在相应的硬件平台上(如系统、设备、装置、器件等)执行,在执行时,包括方法实施例的步骤之一或其组合。One of ordinary skill in the art will appreciate that all or a portion of the steps of the above-described embodiments can be implemented using a computer program flow, which can be stored in a computer readable storage medium, such as on a corresponding hardware platform (eg, The system, device, device, device, etc. are executed, and when executed, include one or a combination of the steps of the method embodiments.
可选地,上述实施例的全部或部分步骤也可以使用集成电路来实现,这些步骤可以被分别制作成一个个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。Alternatively, all or part of the steps of the above embodiments may also be implemented by using an integrated circuit. These steps may be separately fabricated into individual integrated circuit modules, or multiple modules or steps may be fabricated into a single integrated circuit module. achieve.
上述实施例中的装置/功能模块/功能单元可以采用通用的计算装置来实现,它们可以集中在单个的计算装置上,也可以分布在多个计算装置所组成的网络上。The devices/function modules/functional units in the above embodiments may be implemented by a general-purpose computing device, which may be centralized on a single computing device or distributed over a network of multiple computing devices.
上述实施例中的装置/功能模块/功能单元以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。上述提到的计算机可读取存储介质可以是只读存储器,磁盘或光盘等。When the device/function module/functional unit in the above embodiment is implemented in the form of a software function module and sold or used as a stand-alone product, it can be stored in a computer readable storage medium. The above mentioned computer readable storage medium may be a read only memory, a magnetic disk or an optical disk or the like.
工业实用性Industrial applicability
本发明实施例通过负荷分担参数超过负荷分担阈值时,采用第二负荷分担方法,解决了负荷分担不均的问题;每个种类流量按照由大至小分配到链路带宽从小到大的链路,最后未分配的流量通过最大的链路进行消化处理,更加合理的解决了负荷分担不均的问题。 In the embodiment of the present invention, when the load sharing parameter exceeds the load sharing threshold, the second load sharing method is used to solve the problem of uneven load sharing; each type of traffic is allocated from the largest to the smallest link to the link bandwidth from small to large. Finally, the unallocated traffic is digested through the largest link, which solves the problem of uneven load sharing.

Claims (21)

  1. 一种实现负荷分担的方法,包括:A method for implementing load sharing, comprising:
    统计第一预设时长内在第一负荷分担方法下的每个链路流量,获得系统的负荷分担参数;Counting each link traffic under the first load sharing method for the first preset duration, and obtaining a load sharing parameter of the system;
    当负荷分担参数大于或等于预先设置的负荷分担阈值时,确定负荷分担不均,切换到第二负荷分担方法将流量分配到流量分发的链路中进行流量分发。When the load sharing parameter is greater than or equal to the preset load sharing threshold, the load sharing is determined to be uneven, and the second load sharing method is configured to distribute the traffic to the traffic distribution link for traffic distribution.
  2. 根据权利要求1所述的方法,其中,所述第一负荷分担方法包括:The method of claim 1, wherein the first load sharing method comprises:
    预先设置的基于源网络之间互连的协议SIP、或基于目的网络之间互连的协议DIP、或基于用户数据报协议UDP端口号、或基于三元组、或基于五元组、或基于循环冗余校验码CRC、或基于异或的静态映射方法。Pre-set protocols based on the interconnection between source networks, SIP, or protocol-based DIP based on interconnection between destination networks, or based on user datagram protocol UDP port numbers, or based on triples, or based on quintuple, or based on Cyclic Redundancy Check Code CRC, or XOR-based static mapping method.
  3. 根据权利要求1所述的方法,其中,所述获得系统的负荷分担参数包括:The method of claim 1 wherein the load sharing parameters of the obtaining system comprise:
    将所述统计的每个链路的流量除以每个链路自身的带宽获得每个链路相应的流量带宽比;Dividing the traffic of each link of the statistics by the bandwidth of each link itself to obtain a corresponding traffic bandwidth ratio of each link;
    将所述流量带宽比中的最大值减去流量带宽比的最小值,获得负荷分担参数。The load sharing parameter is obtained by subtracting the minimum value of the traffic bandwidth ratio from the maximum value in the traffic bandwidth ratio.
  4. 根据权利要求1~3任一项所述的方法,其中,所述第二负荷的分担方法包括:The method according to any one of claims 1 to 3, wherein the sharing method of the second load comprises:
    根据预设比值采样第二预设时长内所述负荷分担所要分发的流量;And sampling the traffic to be distributed by the load sharing in the second preset duration according to the preset ratio;
    分析采样流量的种类并获得每个种类流量所占采样流量的第一比值,计算所述链路中每个链路带宽占流量分发的所有链路总带宽的第二比值;Analyzing a type of sampling traffic and obtaining a first ratio of sampling traffic of each type of traffic, and calculating a second ratio of each link bandwidth in the link to a total bandwidth of all links distributed by the traffic;
    根据第一比值和第二比值的大小将流量分发到每个链路中。Traffic is distributed to each link based on the size of the first ratio and the second ratio.
  5. 根据权利要求4所述的方法,其中,所述根据第一比值和第二比值的大小将流量分发到每个链路中包括:The method of claim 4, wherein the distributing the traffic to each of the links according to the size of the first ratio and the second ratio comprises:
    将每个种类流量和链路分别按照第一比值和第二比值的大小进行排序后,按照第一比值最大到第一比值最小的顺序,将每个种类流量分配到第二 比值由小至大的每个链路中。After each type of traffic and links are sorted according to the first ratio and the second ratio, respectively, each type of traffic is allocated to the second according to the order of the first ratio and the first ratio being the smallest. The ratio is from small to large in each link.
  6. 根据权利要求5所述的方法,其中,所述按照第一比值最大到第一比值最小的顺序,将每个种类流量分配到第二比值由小至大的每个链路中包括:The method according to claim 5, wherein said assigning each type of traffic to each of the links whose second ratio is from small to large in the order that the first ratio is up to the first ratio is the smallest:
    将每个种类流量和链路分别按照第一比值和第二比值的大小进行排序后,将每个种类流量根据第一比值大小由最大到最小的顺序逐个分配至第二比值最小的链路中;After sorting each type of traffic and links according to the first ratio and the second ratio, respectively, each type of traffic is allocated one by one according to the first ratio, from the largest to the smallest, to the second smallest link. ;
    计算分配给第二比值最小的链路的每个种类流量的第一比值的累加和,将第二比值最小的链路的第二比值减去计算获得的所述累加和获得差值后,根据获得的差值确定是否继续往该链路分配分发的流量;Calculating an accumulated sum of the first ratios of each type of traffic assigned to the link having the smallest second ratio, subtracting the second ratio of the link having the smallest second ratio from the calculated sum obtained and obtaining the difference, according to The obtained difference determines whether to continue to distribute the distributed traffic to the link;
    停止往该链路分配流量时,将该链路从分配分发流量的排序中移出,更新未分配的每个种类流量的第一比值的大小排序和未分配的链路的第二比值的大小排序,以更新的第一比值排序和第二比值排序继续每个种类流量的流量分发分配,直至只剩一个链路时,将未分配的每个种类流量统一分配给该剩余的链路。When the allocation of traffic to the link is stopped, the link is removed from the ordering of the distributed distribution traffic, and the size ratio of the first ratio of each type of traffic that is not allocated is updated and the second ratio of the unallocated links is sorted. The traffic distribution allocation of each type of traffic is continued with the updated first ratio order and the second ratio sorting until each link is unassigned, and unassigned each type of traffic is uniformly allocated to the remaining links.
  7. 根据权利要求6所述的方法,其中,所述根据获得的差值确定是否继续往该链路分配分发的流量包括:The method of claim 6, wherein the determining, based on the obtained difference, whether to continue distributing the distributed traffic to the link comprises:
    将第二比值最小的链路的第二比值减去计算获得的分配给第二比值最小的链路的每个种类流量的第一比值的累加和获得差值后,当差值等于零时,停止该链路的流量分配;当差值小于零时,将小于零时的对应的种类流量作为未分配的流量,停止往该链路分配流量。The second ratio of the link having the smallest second ratio is subtracted from the calculated sum of the first ratios of the flow rates of each type of the link assigned to the link with the smallest second ratio, and then the difference is obtained when the difference is equal to zero. The traffic distribution of the link; when the difference is less than zero, the corresponding type of traffic when the value is less than zero is used as the unallocated traffic, and the traffic is allocated to the link.
  8. 根据权利要求1~3任一项所述的方法,其中,当负荷分担参数小于预先设置的负荷分担阈值时,该方法还包括:The method according to any one of claims 1 to 3, wherein when the load sharing parameter is less than a preset load sharing threshold, the method further comprises:
    采用第一负荷分担方法进行流量分发。The first load sharing method is used for traffic distribution.
  9. 根据权利要求1~3任一项所述的方法,其中,在切换到所述第二负荷分担方法进行流量分发后,该方法还包括:The method according to any one of claims 1 to 3, wherein after the switching to the second load sharing method for traffic distribution, the method further comprises:
    根据所述流量分配到流量分发的链路、下发相应的访问控制列表ACL规则,根据ACL规则进行流量分发;The traffic is distributed to the link of the traffic distribution, the corresponding ACL rule is delivered, and the traffic is distributed according to the ACL rule.
    所述ACL规则为ACL五元组,通过内容寻址存储器TCAM或前缀树trie 表下发。The ACL rule is an ACL five-tuple, through a content-addressable memory TCAM or a prefix tree trie The table is issued.
  10. 根据权利要求9所述的方法,其中,在进行流量分发时,该方法还包括:The method of claim 9, wherein when performing traffic distribution, the method further comprises:
    当进行流量分发出现ACL规则不匹配时,对该种类流量采用所述第一负荷分担分流,并统计采用所述第一负荷分担分流的流量的种类数,当统计流量种类数大于匹配调整阈值时,对未分发的流量重新采用所述第二负荷的分担方法进行流量分发。When the ACL rule does not match the traffic distribution, the first load balancing is used for the traffic of the type, and the number of traffic types of the first load sharing traffic is counted. When the number of the traffic traffic types is greater than the matching adjustment threshold. And distributing the traffic of the second load by using the second load sharing method for the undistributed traffic.
  11. 一种实现负荷分担的装置,包括:统计分析单元和判断处理单元;其中,An apparatus for implementing load sharing, comprising: a statistical analysis unit and a judgment processing unit; wherein
    统计分析单元,设置为:统计第一预设时长内在第一负荷分担方法下的每个链路流量,获得系统的负荷分担参数;The statistical analysis unit is configured to: collect statistics on each link under the first load sharing method in the first preset duration, and obtain a load sharing parameter of the system;
    判断处理单元包括判断模块及处理模块;其中,The judgment processing unit includes a judgment module and a processing module; wherein
    判断模块,设置为:当负荷分担参数大于或等于预先设置的负荷分担阈值时,确定负荷分担不均;The determining module is configured to: determine that the load sharing is uneven when the load sharing parameter is greater than or equal to a preset load sharing threshold;
    处理模块,设置为:在确定负荷分担不均时,切换到第二负荷分担方法将流量分配到流量分发的链路中进行流量分发。The processing module is configured to: when determining the load sharing unevenness, switch to the second load sharing method to distribute the traffic to the traffic distribution link for traffic distribution.
  12. 根据权利要求11所述的装置,其中,所述统计分析单元是设置为:The apparatus of claim 11 wherein said statistical analysis unit is configured to:
    统计第一预设时长内在预先设置的基于SIP、或基于DIP、或基于UDP端口号、或基于三元组、或基于五元组、或基于CRC、或基于异或的静态映射方法下的每个链路流量,获得系统的负荷分担参数。Counting the first preset duration within a pre-set SIP-based, or DIP-based, or UDP-based port number, or triple-based, or quintuple-based, or CRC-based, or XOR-based static mapping method Link traffic, get the load sharing parameters of the system.
  13. 根据权利要求11所述的装置,其中,所述统计分析单元是设置为:The apparatus of claim 11 wherein said statistical analysis unit is configured to:
    将所述统计的每个链路的流量除以每个链路自身的带宽获得每个链路相应的流量带宽比;Dividing the traffic of each link of the statistics by the bandwidth of each link itself to obtain a corresponding traffic bandwidth ratio of each link;
    将所述流量带宽比中的最大值减去流量带宽比的最小值,获得负荷分担参数。The load sharing parameter is obtained by subtracting the minimum value of the traffic bandwidth ratio from the maximum value in the traffic bandwidth ratio.
  14. 根据权利要求11~13任一项所述的装置,其中,所述处理模块是设置为:在确定负荷分担不均时, The apparatus according to any one of claims 11 to 13, wherein the processing module is configured to: when determining load sharing unevenness,
    根据预设比值采样第二预设时长内所述负荷分担所要分发的流量;And sampling the traffic to be distributed by the load sharing in the second preset duration according to the preset ratio;
    分析采样流量的种类并获得每个种类流量所占采样流量的第一比值,计算所述链路中每个链路带宽占流量分发的所有链路总带宽的第二比值;Analyzing a type of sampling traffic and obtaining a first ratio of sampling traffic of each type of traffic, and calculating a second ratio of each link bandwidth in the link to a total bandwidth of all links distributed by the traffic;
    根据第一比值和第二比值的大小将流量分发到每个链路中进行流量分发。Traffic is distributed to each link for traffic distribution according to the size of the first ratio and the second ratio.
  15. 根据权利要求11~13任一项所述的装置,其中,所述处理模块是设置为:在确定负荷分担不均时,The apparatus according to any one of claims 11 to 13, wherein the processing module is configured to: when determining load sharing unevenness,
    根据预设比值采样第二预设时长内所述负荷分担所要分发的流量;And sampling the traffic to be distributed by the load sharing in the second preset duration according to the preset ratio;
    分析采样流量的种类并获得每个种类流量所占采样流量的第一比值,计算所述链路中每个链路带宽占流量分发的所有链路总带宽的第二比值;Analyzing a type of sampling traffic and obtaining a first ratio of sampling traffic of each type of traffic, and calculating a second ratio of each link bandwidth in the link to a total bandwidth of all links distributed by the traffic;
    将每个种类流量和链路分别按照第一比值和第二比值的大小进行排序后,按照第一比值最大到第一比值最小的顺序,将每个种类流量分配到第二比值由小至大的每个链路中。After sorting each type of traffic and link according to the first ratio and the second ratio, respectively, assigning each type of traffic to the second ratio from small to large according to the order of the first ratio up to the first ratio being the smallest. In each link.
  16. 根据权利要求11~13任一项所述的装置,其中,所述处理模块是设置为:在确定负荷分担不均时,The apparatus according to any one of claims 11 to 13, wherein the processing module is configured to: when determining load sharing unevenness,
    根据预设比值采样第二预设时长内所述负荷分担所要分发的流量;And sampling the traffic to be distributed by the load sharing in the second preset duration according to the preset ratio;
    分析采样流量的种类并获得每个种类流量所占采样流量的第一比值,计算所述链路中每个链路带宽占流量分发的所有链路总带宽的第二比值;Analyzing a type of sampling traffic and obtaining a first ratio of sampling traffic of each type of traffic, and calculating a second ratio of each link bandwidth in the link to a total bandwidth of all links distributed by the traffic;
    将每个种类流量和链路分别按照第一比值和第二比值的大小进行排序后,将每个种类流量根据第一比值大小由最大到最小的顺序逐个分配至第二比值最小的链路中;After sorting each type of traffic and links according to the first ratio and the second ratio, respectively, each type of traffic is allocated one by one according to the first ratio, from the largest to the smallest, to the second smallest link. ;
    计算分配给第二比值最小的链路的每个种类流量的第一比值的累加和,将第二比值最小的链路的第二比值减去计算获得的所述累加和获得差值后,根据获得的差值确定是否继续往该链路分配分发的流量;Calculating an accumulated sum of the first ratios of each type of traffic assigned to the link having the smallest second ratio, subtracting the second ratio of the link having the smallest second ratio from the calculated sum obtained and obtaining the difference, according to The obtained difference determines whether to continue to distribute the distributed traffic to the link;
    停止往该链路分配流量时,将该链路从分配分发流量的排序中移出,更新未分配的每个种类流量的第一比值的大小排序和未分配的链路的第二比值的大小排序,以更新的第一比值排序和第二比值排序继续每个种类流量的流量分发分配,直至只剩一个链路时,将未分配的每个种类流量统一分配给该 剩余的链路。When the allocation of traffic to the link is stopped, the link is removed from the ordering of the distributed distribution traffic, and the size ratio of the first ratio of each type of traffic that is not allocated is updated and the second ratio of the unallocated links is sorted. , the traffic distribution distribution of each type of traffic is continued with the updated first ratio ordering and the second ratio sorting, until only one link remains, and unassigned each type of traffic is uniformly allocated to the The remaining links.
  17. 根据权利要求11~13任一项所述的装置,其中,所述处理模块是设置为:在确定负荷分担不均时,The apparatus according to any one of claims 11 to 13, wherein the processing module is configured to: when determining load sharing unevenness,
    根据预设比值采样第二预设时长内所述负荷分担所要分发的流量;And sampling the traffic to be distributed by the load sharing in the second preset duration according to the preset ratio;
    分析采样流量的种类并获得每个种类流量所占采样流量的第一比值,计算所述链路中每个链路带宽占流量分发的所有链路总带宽的第二比值;Analyzing a type of sampling traffic and obtaining a first ratio of sampling traffic of each type of traffic, and calculating a second ratio of each link bandwidth in the link to a total bandwidth of all links distributed by the traffic;
    将每个种类流量和链路分别按照第一比值和第二比值的大小进行排序后,将每个种类流量根据第一比值大小由最大到最小的顺序逐个分配至第二比值最小的链路中;After sorting each type of traffic and links according to the first ratio and the second ratio, respectively, each type of traffic is allocated one by one according to the first ratio, from the largest to the smallest, to the second smallest link. ;
    将第二比值最小的链路的第二比值减去计算获得的分配给第二比值最小的链路的每个种类流量的第一比值的累加和获得差值后,当差值等于零时,停止该链路的流量分配;当差值小于零时,将小于零时的对应的种类流量作为未分配的流量,停止往该链路分配流量;The second ratio of the link having the smallest second ratio is subtracted from the calculated sum of the first ratios of the flow rates of each type of the link assigned to the link with the smallest second ratio, and then the difference is obtained when the difference is equal to zero. The traffic distribution of the link; when the difference is less than zero, the corresponding type of traffic when the value is less than zero is used as the unallocated traffic, and the traffic is allocated to the link;
    停止往该链路分配流量时,将该链路从分配分发流量的排序中移出,更新未分配的每个种类流量的第一比值的大小排序和未分配的链路的第二比值的大小排序,以更新的第一比值排序和第二比值排序继续每个种类流量的流量分发分配,直至只剩一个链路时,将未分配的每个种类流量统一分配给该剩余的链路。When the allocation of traffic to the link is stopped, the link is removed from the ordering of the distributed distribution traffic, and the size ratio of the first ratio of each type of traffic that is not allocated is updated and the second ratio of the unallocated links is sorted. The traffic distribution allocation of each type of traffic is continued with the updated first ratio order and the second ratio sorting until each link is unassigned, and unassigned each type of traffic is uniformly allocated to the remaining links.
  18. 根据权利要求11~13所述的装置,其中,The apparatus according to any one of claims 11 to 13, wherein
    判断模块,还设置为:当负荷分担参数小于预先设置的负荷分担阈值时,确定负荷分担均匀;The determining module is further configured to: when the load sharing parameter is less than a preset load sharing threshold, determine that the load sharing is uniform;
    处理模块,还设置为:在确定负荷分担均匀时,采用第一负荷分担方法进行流量分发。The processing module is further configured to: when determining load sharing is uniform, use the first load sharing method to perform traffic distribution.
  19. 根据权利要求11~13所述的装置,还包括规则下发单元,设置为:在切换到第二负荷分担方法进行流量分发后,根据所述流量分配到流量分发的链路下发相应的ACL规则,根据ACL规则进行流量分发;The device according to any one of claims 11 to 13, further comprising a rule issuing unit, configured to: after switching to the second load sharing method for traffic distribution, assigning a corresponding ACL according to the traffic distribution to the link for traffic distribution Rules, traffic distribution based on ACL rules;
    所述ACL规则为ACL五元组,通过内容寻址存储器TCAM或前缀树trie表下发。 The ACL rule is an ACL quintuple, which is delivered through a content-addressable memory TCAM or a prefix tree trie table.
  20. 根据权利要求19所述的装置,其中,还包括统计处理单元,设置为:在进行流量分发时,The apparatus according to claim 19, further comprising a statistical processing unit configured to: when performing traffic distribution,
    当进行流量分发出现ACL规则不匹配时,对该种类流量采用所述第一负荷分担分流,并统计采用所述第一负荷分担分流的流量的种类数,当统计流量种类数大于匹配调整阈值时,对未分发的流量重新采用所述第二负荷的分担方法进行流量分发。When the ACL rule does not match the traffic distribution, the first load balancing is used for the traffic of the type, and the number of traffic types of the first load sharing traffic is counted. When the number of the traffic traffic types is greater than the matching adjustment threshold. And distributing the traffic of the second load by using the second load sharing method for the undistributed traffic.
  21. 一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令用于执行权利要求1-10任一项的方法。 A computer readable storage medium storing computer executable instructions for performing the method of any of claims 1-10.
PCT/CN2015/081173 2015-03-19 2015-06-10 Load sharing method and device WO2016145737A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510122821.7 2015-03-19
CN201510122821.7A CN106034086B (en) 2015-03-19 2015-03-19 Method and device for realizing load sharing

Publications (1)

Publication Number Publication Date
WO2016145737A1 true WO2016145737A1 (en) 2016-09-22

Family

ID=56918401

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/081173 WO2016145737A1 (en) 2015-03-19 2015-06-10 Load sharing method and device

Country Status (2)

Country Link
CN (1) CN106034086B (en)
WO (1) WO2016145737A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110912833A (en) * 2019-12-27 2020-03-24 国家计算机网络与信息安全管理中心 Intelligent link forwarding method
CN114124819A (en) * 2021-10-22 2022-03-01 北京乐我无限科技有限责任公司 Flow distribution control method and device, storage medium and computer equipment

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109218211B (en) * 2017-07-06 2022-04-19 创新先进技术有限公司 Method, device and equipment for adjusting threshold value in control strategy of data stream
CN111030939B (en) * 2019-12-05 2022-08-26 苏州盛科通信股份有限公司 Method and device for realizing IPFIX output based on chip

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6144639A (en) * 1996-09-03 2000-11-07 Sbc Technology Resources, Inc. Apparatus and method for congestion control in high speed networks
CN101184049A (en) * 2007-12-12 2008-05-21 中兴通讯股份有限公司 Dynamic load sharing method and system
CN102136989A (en) * 2010-01-26 2011-07-27 华为技术有限公司 Message transmission method, system and equipment
CN102739518A (en) * 2012-05-30 2012-10-17 杭州华三通信技术有限公司 Flow load sharing method and equipment
CN103491021A (en) * 2013-10-12 2014-01-01 华为技术有限公司 Method and device for sharing traffic load

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001136208A (en) * 1999-11-10 2001-05-18 Nec Shizuoka Ltd Method and system for controlling load balance
CN101110775A (en) * 2007-07-06 2008-01-23 中兴通讯股份有限公司 Method and system for dynamically regulating load distribution
CN101217491A (en) * 2008-01-04 2008-07-09 杭州华三通信技术有限公司 A method of rectification processing unit load allocation method and device
CN101656675A (en) * 2009-09-22 2010-02-24 中兴通讯股份有限公司 Load sharing method and device
CN102447619B (en) * 2011-11-10 2014-09-17 华为技术有限公司 Load sharing mode selecting method, device and system
CN102664815A (en) * 2012-05-21 2012-09-12 华为技术有限公司 Load sharing method, device and system for message traffic

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6144639A (en) * 1996-09-03 2000-11-07 Sbc Technology Resources, Inc. Apparatus and method for congestion control in high speed networks
CN101184049A (en) * 2007-12-12 2008-05-21 中兴通讯股份有限公司 Dynamic load sharing method and system
CN102136989A (en) * 2010-01-26 2011-07-27 华为技术有限公司 Message transmission method, system and equipment
CN102739518A (en) * 2012-05-30 2012-10-17 杭州华三通信技术有限公司 Flow load sharing method and equipment
CN103491021A (en) * 2013-10-12 2014-01-01 华为技术有限公司 Method and device for sharing traffic load

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110912833A (en) * 2019-12-27 2020-03-24 国家计算机网络与信息安全管理中心 Intelligent link forwarding method
CN114124819A (en) * 2021-10-22 2022-03-01 北京乐我无限科技有限责任公司 Flow distribution control method and device, storage medium and computer equipment
CN114124819B (en) * 2021-10-22 2024-02-09 北京乐我无限科技有限责任公司 Flow distribution control method and device, storage medium and computer equipment

Also Published As

Publication number Publication date
CN106034086B (en) 2020-06-16
CN106034086A (en) 2016-10-19

Similar Documents

Publication Publication Date Title
US9503382B2 (en) Scalable flow and cogestion control with openflow
US10735325B1 (en) Congestion avoidance in multipath routed flows
US10742722B2 (en) Server load balancing
EP3222005B1 (en) Passive performance measurement for inline service chaining
EP3022873B1 (en) Removing lead filter from serial multiple-stage filter used to detect large flows in order to purge flows for prolonged operation
US9608938B2 (en) Method and system for tracking and managing network flows
CN111770028A (en) Method and network device for computer network
CN108696402A (en) The dialogue-based business statistics record of virtual router
US8761182B2 (en) Targeted flow sampling
US10708272B1 (en) Optimized hash-based ACL lookup offload
US10050885B2 (en) Hash tag load balancing
WO2016145737A1 (en) Load sharing method and device
CN113132249A (en) Load balancing method and equipment
US9577939B2 (en) Method and apparatus for distributing EtherChannel load based on variance
US20190327174A1 (en) Load balancing
US10305819B2 (en) Dynamic protection of shared memory used by output queues in a network device
US20200195530A1 (en) Method and apparatus for tap aggregation and network data truncation
US20160337142A1 (en) Dynamic Protection Of Shared Memory And Packet Descriptors Used By Output Queues In A Network Device
US20080043755A1 (en) Shared and separate network stack instances
US11563698B2 (en) Packet value based packet processing
US10135951B2 (en) Methods and apparatus for providing one-arm node clustering using a port channel
RU2675212C1 (en) Adaptive load balancing during package processing
US9992110B2 (en) Dynamic switching control over multiple internet services provided for home networks
US11128564B2 (en) Systems and methods to filter out noisy application signatures to improve precision of first packet application classification
Wette et al. HybridTE: traffic engineering for very low-cost software-defined data-center networks

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15885120

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15885120

Country of ref document: EP

Kind code of ref document: A1