A flow distribution method, apparatus, electronic device, and readable storage medium

By dynamically calculating the target hash seed through networking devices, the problem of hash polarization in multi-level networks is solved, dynamic balance of traffic distribution is achieved, and operation and maintenance costs are reduced.

CN116319566BActive Publication Date: 2026-03-27INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-03
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

In multi-level networks, Hash polarization can easily occur when switches with the same type of chip are deployed at adjacent levels, leading to unbalanced load. Existing technologies cannot dynamically adjust the hash algorithm to avoid polarization, resulting in high operation and maintenance costs.

Method used

By acquiring current traffic attribute information and ECMP configuration information through networking devices, the target hash seed is dynamically calculated, and traffic is allocated using a preset hash algorithm to ensure that the result meets the preset balance requirements and avoid hash polarization.

Benefits of technology

It enables dynamic adjustment of the hash seed when traffic changes, avoiding hash polarization, reducing operation and maintenance costs, and improving load balancing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116319566B_ABST
    Figure CN116319566B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a flow distribution method and device, electronic equipment and readable storage medium, the method comprises: obtaining the flow attribute information of the current time, and obtaining the ECMP configuration information; according to the flow attribute information and the ECMP configuration information, determine the hash seed for balancing flow; the corresponding flow distribution result is calculated by using the hash seed and the preset hash algorithm;According to the flow distribution result, determine the target hash seed used;Wherein, if the target hash seed and the preset hash algorithm are used for calculation, the flow distribution result calculated meets the preset flow balance requirement;The target hash seed is configured for the networking device to distribute flow. By using the above method, by dynamically monitoring the environmental flow, the hash seed is changed when the environmental flow changes to distribute flow, which can avoid the appearance of hash polarization phenomenon.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer technology, and in particular, to a traffic distribution method, a traffic distribution device, an electronic device, and a computer readable storage medium. BACKGROUND

[0002] In network deployment, when there are multiple forwarding paths, load sharing function is often deployed. By deploying load sharing, the device can perform per-flow forwarding based on message content, or perform per-packet forwarding based on random number and rotation, so as to achieve the purpose of fully utilizing the link and improving the forwarding efficiency.

[0003] A common load sharing process includes input (traffic, message effective field), processing (calculation through Hash algorithm), and output (forwarding traffic through the corresponding output interface according to the calculation result). The result of Hash calculation directly affects the effect of load sharing, so how to make good use of Hash algorithm for calculation is particularly important in load sharing deployment. Hash generally refers to a built-in algorithm of a switch or router, which converts an arbitrary input (usually a very large set) into a fixed length output (usually a small set). In network architecture, this method can be used to solve the problem of load balancing on multiple equal cost paths, and thus improve the resource utilization in the data center.

[0004] Hash polarization, also known as Hash unevenness, refers to the phenomenon of uneven load sharing after two or more Hashes of traffic. It is common in multiple Hash scenarios across devices.

[0005] Actually, the implementation of the switch Hash function depends largely on the chip, so when switches using the same type of chip are located in adjacent levels in the network, the Hash polarization problem may occur. Therefore, when deploying ECMP (Equal Cost Multi Path) or Eth-Trunk load sharing (Eth-Trunk is also called Ethernet link aggregation Eth-Trunk, which bundles multiple Ethernet physical links together into a logical link) in a multi-level network, the risk of Hash polarization needs to be considered. SUMMARY

[0006] In view of the above problems, the present application is proposed to provide a traffic distribution method and corresponding traffic distribution device, electronic device, and computer readable storage medium which overcome the above problems or at least partially solve the above problems.

[0007] The embodiment of the present application discloses a flow distribution method, applied to a networking device, a chip of the networking device provides a preset hash algorithm, and the method comprises:

[0008] obtaining flow attribute information at the current time, and obtaining ECMP configuration information; wherein the flow attribute information comprises one or more of MAC address information, IP protocol information and port information;

[0009] determining a hash seed for balancing flow according to the flow attribute information and the ECMP configuration information;

[0010] calculating a corresponding flow distribution result by using the hash seed and the preset hash algorithm;

[0011] determining a target hash seed to be used according to the flow distribution result; wherein if the target hash seed and the preset hash algorithm are used for calculation, the flow distribution result calculated by using the target hash seed and the preset hash algorithm meets a preset flow balancing requirement;

[0012] configuring the target hash seed for the networking device to perform flow distribution.

[0013] Optionally, the networking device comprises a timer, and the obtaining of the flow attribute information at the current time comprises:

[0014] controlling the timer to perform timing to determine a flow detection time interval, and obtaining the flow attribute information at the current time in a case where the flow detection time interval meets a preset time interval condition.

[0015] Optionally, the determining of the target hash seed to be used according to the flow distribution result comprises:

[0016] if the flow distribution result calculated by using the current hash seed and the preset hash algorithm does not meet the preset flow balancing requirement, obtaining a next hash seed, and calculating a corresponding flow distribution result by using the next hash seed and the preset hash algorithm until the flow distribution result meets the preset flow balancing requirement; the preset flow balancing requirement comprises that a hash polarization phenomenon does not occur;

[0017] determining the hash seed corresponding to the flow distribution result meeting the preset flow balancing requirement as the target hash seed.

[0018] Optionally, after the hash seed corresponding to the flow distribution result meeting the preset flow balancing requirement is determined as the target hash seed, the method further comprises:

[0019] record the target hash seed and record the traffic attribute information, and establish a mapping relationship between the target hash seed and the traffic attribute information.

[0020] Optionally, the method further comprises:

[0021] acquiring the traffic attribute information at the next moment;

[0022] if the traffic attribute information at the next moment is consistent with the traffic attribute information at the current moment, determining the target hash seed as the target hash seed at the next moment based on the mapping relationship between the target hash seed and the traffic attribute information.

[0023] Optionally, the determining of the hash seed for balancing traffic according to the traffic attribute information and the ECMP configuration information comprises:

[0024] performing multiple combinations on the traffic attribute information and the ECMP configuration information to obtain multiple hash seeds for balancing traffic.

[0025] Optionally, the method further comprises:

[0026] if the target hash seed does not exist, updating the preset hash algorithm.

[0027] Embodiments of the application also disclose a traffic distribution device applied to a networking device, wherein a chip of the networking device provides a preset hash algorithm, and the device comprises:

[0028] a first acquisition module, configured to acquire traffic attribute information at a current moment and acquire ECMP configuration information; wherein the traffic attribute information comprises one or more of MAC address information, IP protocol information and port information;

[0029] a first determination module, configured to determine a hash seed for balancing traffic according to the traffic attribute information and the ECMP configuration information;

[0030] a calculation module, configured to calculate a corresponding traffic distribution result by using the hash seed and the preset hash algorithm;

[0031] a second determination module, configured to determine a target hash seed to be used according to the traffic distribution result; wherein if the target hash seed and the preset hash algorithm are used for calculation, the traffic distribution result calculated by using the target hash seed and the preset hash algorithm meets preset traffic balancing requirements.

[0032] a configuration module, configured to configure the target hash seed for the networking device to perform traffic distribution.

[0033] Optionally, the networking device comprises a timer, and the acquisition module comprises:

[0034] The timing and obtaining submodule is configured to control the timer to time to determine a flow detection time interval, and obtain the flow attribute information of the current time if the flow detection time interval meets a preset time interval condition.

[0035] Optionally, the second determining module comprises:

[0036] The obtaining and calculating submodule is configured to obtain a next hash seed if the flow distribution result calculated by using the current hash seed and the preset hash algorithm does not meet the preset flow balance requirement, and calculate a corresponding flow distribution result by using the next hash seed and the preset hash algorithm until the flow distribution result meets the preset flow balance requirement; the preset flow balance requirement comprises no hash polarization phenomenon.

[0037] The determining submodule is configured to determine the hash seed corresponding to the flow distribution result meeting the preset flow balance requirement as the target hash seed.

[0038] Optionally, the device further comprises:

[0039] The recording and establishing module is configured to record the target hash seed and the flow attribute information, and establish a mapping relationship between the target hash seed and the flow attribute information.

[0040] Optionally, the device further comprises:

[0041] The second obtaining module is configured to obtain the flow attribute information of the next time.

[0042] The third determining module is configured to determine the target hash seed as the target hash seed of the next time based on the mapping relationship between the target hash seed and the flow attribute information if the flow attribute information of the next time is consistent with the flow attribute information of the current time.

[0043] Optionally, the first determining module comprises:

[0044] The combining submodule is configured to combine the flow attribute information and the ECMP configuration information in multiple ways to obtain multiple hash seeds for balancing flow.

[0045] Optionally, the device further comprises:

[0046] The updating module is configured to update the preset hash algorithm if the target hash seed does not exist.

[0047] The embodiment of the present application further discloses an electronic device, comprising a processor, a memory, and a computer program stored in the memory and capable of running on the processor, and the computer program implements the steps of the flow distribution method when executed by the processor.

[0048] The embodiment of the present application further discloses a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program implements the steps of the flow distribution method when executed by a processor.

[0049] The embodiment of the present application has the following advantages:

[0050] In the embodiment of the present application, the networking device can acquire the flow attribute information at the current time and acquire the ECMP configuration information, can determine the hash seed for balancing the flow according to the flow attribute information and the ECMP configuration information, and calculate the corresponding flow distribution result by using the hash seed and the preset hash algorithm, and determine the target hash seed to be used according to the flow distribution result, wherein if the target hash seed and the preset hash algorithm are used for calculation, the calculated flow distribution result meets the preset flow balancing requirement, and the target hash seed can be configured for the networking device to perform flow distribution. By using the above method, the environmental flow is dynamically monitored, the target hash seed meeting the balancing requirement is calculated according to the acquired flow data and the current ECMP configuration, and is configured to the ECMP, and the balancing requirement can be that the hash polarization phenomenon does not occur. By dynamically monitoring the environmental flow, the hash seed is changed when the environmental flow changes, and flow distribution is performed, and the hash polarization phenomenon can be avoided. BRIEF DESCRIPTION OF DRAWINGS

[0051] Figure 1 is a flow distribution schematic diagram before and after the hash polarization phenomenon is optimized;

[0052] Figure 2 is a step flowchart of a flow distribution method provided by the embodiment of the present application;

[0053] Figure 3 is a step flowchart of another flow distribution method provided by the embodiment of the present application;

[0054] Figure 4 is a structural block diagram of a flow distribution device provided by the embodiment of the present application;

[0055] Figure 5 is a structural block diagram of an electronic device provided by the embodiment of the present application;

[0056] Figure 6 is a structural block diagram of a computer readable storage medium provided by the embodiment of the present application. DETAILED DESCRIPTION

[0057] In order to make the above objectives, features and advantages of the present application more obvious and easy to understand, the present application will be further described in detail below with reference to the drawings and specific embodiments. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art belong to the scope of protection of the present application.

[0058] In network deployment, load sharing function is often deployed when there are multiple forwarding paths. By deploying load sharing, the device can perform per-flow forwarding based on message content, or per-packet forwarding based on random number and rotation, to achieve the purpose of fully utilizing the link and improving the forwarding efficiency.

[0059] The common load sharing process includes input (traffic, message effective field), processing (calculation by Hash algorithm) and output (forwarding traffic through the corresponding output interface according to the calculation result). Among them, the result of Hash calculation will directly affect the effect of load sharing, so how to make good use of Hash algorithm for calculation is particularly important in load sharing deployment. Hash generally refers to hash, which is to convert an arbitrary input (usually a very large set) into a fixed length output (usually a small set) through the built-in algorithm of a switch or router. In network architecture, this method can be used to solve the problem of load balancing on multiple equal paths, and thus improve the resource utilization in the data center.

[0060] When the same type of devices are cascaded in networking, the Hash polarization problem will occur due to the same algorithm used by default, and the Hash algorithm needs to be adjusted. The Hash polarization problem is that when the traffic (with the same path attribute under the same algorithm) selected by the first level device Hash reaches the next level device, the next level device uses the same algorithm for Hash, which is not Hash. The use of different Hash algorithms by adjacent devices can solve this problem.

[0061] After multiple groups of traffic pass through two or more Hashes, the Hash polarization of the subsequent forwarding device and the polarization phenomenon that the traffic only goes through half of the link will occur. This phenomenon often occurs when the first Hash and the second Hash device are very similar (such as the same chip model and the same Hash algorithm).

[0062] For example, Figure 1As shown, in the first Hash, the A device divides the traffic into two categories by the mod 2 action of the Hash value: the Hash value is divided into odd and even. In the second Hash, the Hash value of the traffic processed by the B device is all odd, so all the traffic goes through the left link, leaving the right link empty. Similarly, the C device also appears to be polarized, Hashing all the traffic to the right link, leaving the left link empty.

[0063] The static Hash allocation result is fixed and does not change for life, and a specific flow goes through a specific path. The HashValue is calculated according to the message characteristics to determine the forwarding path member port, and subsequent dynamic changes are no longer changed. Whether the traffic of the characteristics is interrupted or the link load is already unbalanced, static Hash does not care about the load of the forwarding path. When the bandwidth of each micro flow is significantly different and dynamically changes, the load of each forwarding link is significantly different and unbalanced.

[0064] The static configuration Hash method is easy to appear in the existing networking environment. The default configuration cannot achieve the expected shunting effect, and even if the default configuration can avoid the polarization Hash phenomenon in some environment, the polarization phenomenon will reappear when the environment changes. In addition, for solving the Hash polarization problem by configuration, the pressure on operation and maintenance is large, and the learning and maintenance cost is high.

[0065] In order to solve the above problems, the present application provides a traffic distribution method and a corresponding traffic distribution device, an electronic device, and a computer readable storage medium which overcome the above problems or at least partially solve the above problems.

[0066] One of the core ideas of the embodiment of the present application is that the networking device can obtain the traffic attribute information at the current time and obtain the ECMP configuration information. The Hash seed for balancing the traffic can be determined according to the traffic attribute information and the ECMP configuration information. The corresponding traffic distribution result is calculated by using the Hash seed and the preset Hash algorithm. The target Hash seed is determined according to the traffic distribution result. If the target Hash seed and the preset Hash algorithm are used for calculation, the calculated traffic distribution result meets the preset traffic balancing requirement, and the target Hash seed can be configured for the networking device for traffic distribution. By using the above method, the environmental traffic is dynamically monitored. The target Hash seed meeting the balancing requirement is calculated according to the obtained traffic data and the current ECMP configuration, and is configured to the ECMP. The balancing requirement can be that the Hash polarization phenomenon does not appear. By dynamically monitoring the environmental traffic, the Hash seed is changed when the environmental traffic changes, and the Hash polarization phenomenon can be avoided.

[0067] Reference Figure 2, a flow distribution method provided by an embodiment of the present application is shown, and the method is applied to a networking device, a chip of the networking device provides a preset hash algorithm, and the method can include the following steps.

[0068] In step 201, flow attribute information at a current time is obtained, and ECMP configuration information is obtained.

[0069] The flow attribute information includes one or more of MAC address information, IP protocol information, and port information.

[0070] In a networking environment, a mechanism of the networking device can detect flow attribute information in the environment in real time, such as IP and MAC attributes, can collect flow attribute information at a current time, and can obtain ECMP configuration information of the networking device, where the ECMP configuration information can be configured ECMP load sharing information. ECMP exists in a network environment in which multiple different links reach a same destination address. If a traditional routing technology is used, data packets to the destination address can only use one of the links, and other links are in a backup state or an invalid state, and in a dynamic routing environment, switching between the links needs a certain time, and an equal-cost multi-path routing protocol can use multiple links at the same time in the network environment. The biggest feature of ECMP is to achieve multi-path load balancing and link backup in an equal-cost case, and ECMP functions are basically supported in static routing and OSPF.

[0071] The networking device can be a router or a switch.

[0072] In step 202, a hash seed for balancing flow is determined according to the flow attribute information and the ECMP configuration information.

[0073] After the flow attribute information is collected, a hash seed for balancing flow can be calculated in combination with current ECMP configuration information.

[0074] In step 203, a corresponding flow distribution result is calculated by using the hash seed and the preset hash algorithm.

[0075] The corresponding flow distribution result is calculated by using the hash seed and the preset hash algorithm.

[0076] In step 204, a target hash seed to be used is determined according to the flow distribution result.

[0077] The target hash seed to be used is determined according to the calculated flow distribution result. If the target hash seed and the preset hash algorithm are used for calculation, the calculated flow distribution result meets preset flow balancing requirements. The preset flow balancing requirements are preset flow balancing standards to be reached.

[0078] Step 205, configuring the target hash seed for the networking device for traffic distribution.

[0079] The target hash seed is configured for the networking device for traffic distribution, so that the traffic distribution result meets the preset traffic balance requirement.

[0080] In summary, in the embodiment of the application, the networking device can obtain the traffic attribute information at the current time and obtain the ECMP configuration information, can determine the hash seed for balancing the traffic according to the traffic attribute information and the ECMP configuration information, and can calculate the corresponding traffic distribution result by using the hash seed and the preset hash algorithm, and can determine the target hash seed to be used according to the traffic distribution result, wherein if the target hash seed and the preset hash algorithm are used for calculation, the calculated traffic distribution result meets the preset traffic balance requirement, and the target hash seed can be configured for the networking device for traffic distribution. By using the above method, the environmental traffic is dynamically monitored, the target hash seed meeting the balance requirement is calculated according to the obtained traffic data and the current ECMP configuration, and is configured to the ECMP, and the balance requirement can be that the hash polarization phenomenon does not occur. By dynamically monitoring the environmental traffic, the hash seed is changed for traffic distribution when the environmental traffic changes, and the hash polarization phenomenon can be avoided.

[0081] Referring to Figure 3 , a step flowchart of another traffic distribution method provided by the embodiment of the application is shown, which is applied to a networking device, and a chip of the networking device provides a preset hash algorithm, and can specifically include the following steps:

[0082] Step 301, obtaining the traffic attribute information at the current time and obtaining the ECMP configuration information.

[0083] The traffic attribute information includes one or more of MAC address information, IP protocol information and port information; the port information includes port queue information and port load information. The ECMP configuration information can be the configured ECMP load sharing information. The networking device can be a router or a switch.

[0084] In the embodiment of the application, the traffic attribute information at the current time can be obtained, and the ECMP configuration information of the networking device can be obtained.

[0085] In an optional embodiment of the application, the networking device includes a timer, and step 301 of obtaining the traffic attribute information at the current time can specifically include the following sub-steps:

[0086] Sub-step S11, controlling the timer to time to determine a traffic detection time interval, and obtaining the traffic attribute information at the current time in the case that the traffic detection time interval meets a preset time interval condition.

[0087] The networking device is provided with a timer, and the timer can be controlled to determine a flow detection time interval. The flow detection time interval is an interval time for which flow detection is performed. In a case where the flow detection time interval meets a preset time interval condition, flow attribute information at a current time can be obtained. In a specific implementation, flow attribute information of a current network environment can be obtained at intervals.

[0088] In step 302, a hash seed for balancing flow is determined according to the flow attribute information and the ECMP configuration information.

[0089] In an embodiment of the present application, after the flow attribute information is collected, the hash seed for balancing flow can be calculated in combination with the current ECMP configuration information.

[0090] In an optional embodiment of the present application, step 302 of determining the hash seed for balancing flow according to the flow attribute information and the ECMP configuration information can specifically include the following sub-steps:

[0091] In sub-step S21, the flow attribute information and the ECMP configuration information are combined in multiple ways to obtain multiple hash seeds for balancing flow.

[0092] In an embodiment of the present application, the flow attribute information and the ECMP configuration information can be combined in multiple ways to obtain multiple hash seeds.

[0093] In one example, the source IP can be used to determine the hash seed; in another example, the destination IP can be used to determine the hash seed.

[0094] In step 303, a corresponding flow distribution result is calculated by using the hash seed and a preset hash algorithm.

[0095] In an embodiment of the present application, the hash seed and the preset hash algorithm can be used to calculate a corresponding flow distribution result. The flow distribution result is used to balance and distribute flow to each branch.

[0096] In step 304, if the flow distribution result calculated by using the current hash seed and the preset hash algorithm does not meet the preset flow balancing requirement, the next hash seed is obtained, and a corresponding flow distribution result is calculated by using the next hash seed and the preset hash algorithm, until the flow distribution result meets the preset flow balancing requirement.

[0097] The preset flow balancing requirement includes that no hash polarization phenomenon occurs.

[0098] In the embodiment of the present application, if the flow distribution result calculated by using the current hash seed and the preset hash algorithm does not meet the preset flow balance requirement, the next hash seed can be obtained, and the corresponding flow distribution result is calculated by using the next hash seed and the preset hash algorithm, until the calculated flow distribution result meets the preset flow balance requirement.

[0099] In the specific implementation, the hash seed for balancing the flow is calculated, the hash calculation is performed by using the hash seed, the corresponding hash result, i.e., the flow distribution result, is obtained, when it is found that the hash result does not meet the preset flow balance requirement, the next hash seed is calculated, and the hash calculation is performed by using the next hash seed, the corresponding hash result is obtained, if the hash result meets the preset flow balance requirement, the hash calculation process can be stopped, otherwise, the next hash seed is obtained.

[0100] In step 305, the hash seed corresponding to the calculated flow distribution result meeting the preset flow balance requirement is determined as the target hash seed.

[0101] In the embodiment of the present application, the hash seed corresponding to the calculated flow distribution result meeting the preset flow balance requirement is determined as the target hash seed.

[0102] In the embodiment of the present application, the hash seed corresponding to the calculated flow distribution result meeting the preset flow balance requirement is determined as the target hash seed.

[0103] In the optional embodiment of the present application, after the hash seed corresponding to the calculated flow distribution result meeting the preset flow balance requirement is determined as the target hash seed, the following steps can be specifically performed:

[0104] The target hash seed is recorded, the flow attribute information is recorded, and the mapping relationship between the target hash seed and the flow attribute information is established.

[0105] In the embodiment of the present application, the target hash seed and the corresponding flow attribute information can also be recorded, and the mapping relationship between the target hash seed and the flow attribute information is stored in the networking device.

[0106] In the optional embodiment of the present application, the following steps can also be specifically performed:

[0107] The flow attribute information at the next moment is obtained, if the flow attribute information at the next moment is consistent with the flow attribute information at the current moment, the target hash seed is determined as the target hash seed at the next moment based on the mapping relationship between the target hash seed and the flow attribute information.

[0108] In the embodiment of the present application, when the flow detection time interval meets the preset time interval condition, the flow attribute information at the next moment can be obtained. If the flow attribute information at the next moment is consistent with the flow attribute information at the current moment, the target hash seed can be directly determined as the target hash seed at the next moment based on the established mapping relationship between the target hash seed and the flow attribute information.

[0109] When the preset flow balance requirement is met once, the flow attribute information and the target hash seed corresponding to the moment are recorded, and when the newly obtained flow attribute information is consistent with the record, the recorded target hash seed is directly configured to the networking device, so that the hash calculation can be reduced and the waste of computing resources can be avoided.

[0110] In an optional embodiment of the present application, the following steps can be further performed:

[0111] If the target hash seed does not exist, the preset hash algorithm is updated.

[0112] If the calculated flow distribution results do not meet the preset flow balance requirement, it means that the target hash seed does not exist, and the preset hash algorithm can be updated at this time.

[0113] Step 306: The target hash seed is configured to the networking device for flow distribution.

[0114] After the target hash seed is determined, the target hash seed can be configured to the networking device for flow distribution.

[0115] The present application combines the ECMP configuration and the flow attribute to calculate the hash seed value currently required to be configured in real time. Through real-time load metric factors (port bandwidth load, queue size), the load balancing effect is optimized in the time and bandwidth space dimensions, and a dynamic and intelligent Hash mechanism is provided.

[0116] To sum up, in the embodiment of the application, the networking device can obtain the traffic attribute information at the current time and obtain the ECMP configuration information, can determine the hash seed for balancing the traffic according to the traffic attribute information and the ECMP configuration information, and calculate the corresponding traffic distribution result by using the hash seed and the preset hash algorithm, and determine the target hash seed to be used according to the traffic distribution result, wherein if the target hash seed and the preset hash algorithm are used for calculation, the calculated traffic distribution result meets the preset traffic balancing requirement, and the target hash seed can be configured for the networking device to perform traffic distribution. By using the above method, the environmental traffic is dynamically monitored, the target hash seed meeting the balancing requirement is calculated according to the obtained traffic data and the current ECMP configuration, and is configured to the ECMP, and the balancing requirement can be that the hash polarization phenomenon does not occur. By dynamically monitoring the environmental traffic, the hash seed is changed when the environmental traffic changes, and traffic distribution is performed, which can avoid the hash polarization phenomenon.

[0117] In the old mechanism, because of the polarization hash problem in the environment, the operation and maintenance personnel or even the developers need to manually configure according to the configuration, the traffic and the algorithm, the operation and maintenance cost is large, and it is also difficult to configure the suitable hash seed. The application calculates the target hash seed meeting the balancing requirement according to the traffic and the algorithm, and configures the target hash seed to the ECMP, which can reduce the operation and maintenance cost. The environmental traffic is monitored in real time, the hash seed is changed when the environment changes, and traffic distribution is performed, which can save the labor cost, improve the efficiency, and also can quickly solve the hash polarization problem in the complex network environment.

[0118] It should be noted that, for the method embodiment, in order to simply describe, it is expressed as a series of action combinations, but those skilled in the art should know that the embodiment of the application is not limited by the action order described, because according to the embodiment of the application, certain steps can be performed in other order or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions involved are not necessarily necessary for the embodiment of the application.

[0119] Referring to Figure 4 , a structure block diagram of a traffic distribution device provided by the embodiment of the application is shown, which is applied to a networking device, and a chip of the networking device provides a preset hash algorithm, and can specifically include the following modules:

[0120] The first obtaining module 401 is configured to obtain the traffic attribute information at the current time and obtain the ECMP configuration information, wherein the traffic attribute information includes one or more of MAC address information, IP protocol information and port information;

[0121] The first determining module 402 is configured to determine a hash seed for balancing traffic according to the traffic attribute information and the ECMP configuration information;

[0122] The calculating module 403 is configured to calculate a corresponding traffic distribution result by using the hash seed and a preset hash algorithm.

[0123] The second determining module 404 is configured to determine a target hash seed according to the traffic distribution result; wherein, if the target hash seed and the preset hash algorithm are used for calculation, the traffic distribution result calculated by using the target hash seed and the preset hash algorithm meets a preset traffic balancing requirement.

[0124] The configuring module 405 is configured to configure the target hash seed for the networking device to perform traffic distribution.

[0125] In some embodiments of the present application, the networking device comprises a timer, and the obtaining module comprises:

[0126] The timing and obtaining sub-module is configured to control the timer to perform timing to determine a traffic detection time interval, and obtain the traffic attribute information at a current time in a case that the traffic detection time interval meets a preset time interval condition.

[0127] In some embodiments of the present application, the second determining module comprises:

[0128] The obtaining and calculating sub-module is configured to, if the traffic distribution result calculated by using the current hash seed and the preset hash algorithm does not meet the preset traffic balancing requirement, obtain a next hash seed, and calculate a corresponding traffic distribution result by using the next hash seed and the preset hash algorithm until the traffic distribution result meets the preset traffic balancing requirement; the preset traffic balancing requirement comprises that a hash polarization phenomenon does not occur.

[0129] The determining sub-module is configured to determine the hash seed corresponding to the traffic distribution result meeting the preset traffic balancing requirement as the target hash seed.

[0130] In some embodiments of the present application, the apparatus further comprises:

[0131] The recording and establishing module is configured to record the target hash seed and the traffic attribute information, and establish a mapping relationship between the target hash seed and the traffic attribute information.

[0132] In some embodiments of the present application, the apparatus further comprises:

[0133] The second obtaining module is configured to obtain the traffic attribute information at a next time.

[0134] a third determining module, configured to, if the traffic attribute information at the next time is consistent with the traffic attribute information at the current time, determine the target hash seed as the target hash seed at the next time based on a mapping relationship between the target hash seed and the traffic attribute information.

[0135] In some embodiments of the present application, the first determining module comprises:

[0136] a combining sub-module, configured to combine the traffic attribute information and the ECMP configuration information in multiple ways to obtain multiple hash seeds for balancing traffic.

[0137] In some embodiments of the present application, the apparatus further comprises:

[0138] an updating module, configured to, if the target hash seed does not exist, update the preset hash algorithm.

[0139] In summary, in the embodiments of the present application, the networking device can obtain the traffic attribute information at the current time and obtain the ECMP configuration information, can determine the hash seed for balancing traffic according to the traffic attribute information and the ECMP configuration information, and can calculate the corresponding traffic distribution result by using the hash seed and the preset hash algorithm, and can determine the target hash seed to be used according to the traffic distribution result, wherein if the target hash seed and the preset hash algorithm are used for calculation, the traffic distribution result calculated by using the target hash seed and the preset hash algorithm meets the preset traffic balancing requirement, and the target hash seed can be configured for the networking device to perform traffic distribution. By using the above method, the environmental traffic is dynamically monitored, the target hash seed meeting the balancing requirement is calculated according to the obtained traffic data and the current ECMP configuration, and the target hash seed is configured to the ECMP, and the balancing requirement can be that the hash polarization phenomenon does not occur. By dynamically monitoring the environmental traffic, the hash seed is changed when the environmental traffic changes, and the hash polarization phenomenon can be avoided.

[0140] For the apparatus embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the related parts refer to the part of the method embodiment.

[0141] The embodiments of the present application further provide an electronic device, as shown in the accompanying drawings, comprising a processor 501, a memory 502, and a computer program stored in the memory and capable of running on the processor, wherein the computer program is executed by the processor to implement each process of the above traffic distribution method embodiment and achieve the same technical effects, and thus the details are not described herein again. Figure 5

[0142] The embodiments of the present application further provide a computer readable storage medium, as shown in the accompanying drawings, comprising a computer program, wherein the computer program is stored in the computer readable storage medium and capable of being executed by a processor to implement each process of the above traffic distribution method embodiment and achieve the same technical effects, and thus the details are not described herein again. Figure 6 ​As shown, the computer program 601 is stored in the computer readable storage medium, which, when executed by the processor, implements each process of the above-mentioned traffic distribution method embodiment and can achieve the same technical effects. To avoid repetition, details are not described herein.

[0143] Each embodiment in the specification is described in a progressive manner, and each embodiment focuses on the difference from other embodiments. The same or similar parts between embodiments can be referred to each other.

[0144] Those skilled in the art should understand that the embodiments of the present embodiment can be provided as a method, device or computer program product. Therefore, the embodiments of the present embodiment can be in the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the embodiments of the present embodiment can be in the form of a computer program product implemented on one or more computer usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer usable program code.

[0145] The embodiments of the present embodiment are described with reference to flowcharts and / or block diagrams according to the method, terminal device (system) and computer program product of the embodiments of the present embodiment. It should be understood that each flow and / or block in the flowchart and / or block diagram, and the combination of flows and / or blocks in the flowchart and / or block diagram can be realized by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device realize a function specified in one or more flows and / or blocks in the flowchart and / or block diagram. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that performs the function specified in one or more flows or blocks.

[0146] These computer program instructions can also be stored in a computer readable storage medium that can guide the computer or other programmable data processing terminal device to work in a specific way, so that the instructions stored in the computer readable storage medium produce a product including instruction apparatus, which realizes the function specified in one or more flows and / or blocks in the flowchart and / or block diagram. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that performs the function specified in one or more flows or blocks.

[0147] These computer program instructions can also be loaded into a computer or other programmable data processing terminal device, so that a series of operation steps are performed on the computer or other programmable terminal device to generate a computer implemented process, so that the instructions executed on the computer or other programmable terminal device provide a function for realizing the function specified in one or more flows and / or blocks in the flowchart and / or block diagram. Figure 1 one or more flows and / or blocksFigure 1 the functions specified in the block or blocks.

[0148] While preferred embodiments of the application have been described, those skilled in the art will appreciate that other modifications and changes can be made thereto without departing from the scope of the application. It is therefore intended to cause the appended claims to cover all such modifications and changes as fall within the scope of the embodiments of the application.

[0149] Finally, it should be noted that the terms "first", "second", and the like, herein do not denote any order, quantity, combination, or importance, but rather are used to distinguish one element from another, and do not imply translating or implying any actual relationship or sequence among such elements. Moreover, the terms "include", "contain", or any other variants thereof are intended to cover non-exclusive inclusion, so that processes, methods, articles, or terminal devices including a series of elements not only include those elements, but also include other elements not explicitly listed, or inherent to such processes, methods, articles, or terminal devices. Without more limitations, the element defined by the statement "including a" does not exclude the presence of additional identical elements in the processes, methods, articles, or terminal devices including the element.

[0150] The above describes in detail the flow distribution method and the flow distribution device, the electronic device and the computer readable storage medium provided by the application, the principle and the implementation mode of the application are described by applying specific examples in the text, the above embodiment is only used to help understanding the method of the application and its core idea; at the same time, for the general technical personnel in the art, according to the idea of the application, the specific implementation mode and the application range will have the change, according to the above, the content of the specification should not be understood as the limitation of the application.

Claims

1. A flow allocation method, characterized in that, Applied to networking equipment, wherein the chip of the networking equipment provides a preset hash algorithm, the method includes: Obtain the current traffic attribute information and ECMP configuration information; wherein, the traffic attribute information includes one or more of MAC address information, IP protocol information, and port information; the ECMP configuration information includes ECMP load balancing information; the port information includes port queue information and port load information; Based on the traffic attribute information and the ECMP configuration information, a hash seed for traffic balancing is determined; The corresponding traffic allocation result is calculated using the hash seed and the preset hash algorithm; the traffic allocation result is used to evenly distribute traffic to each branch. Based on the traffic allocation result, a target hash seed is determined; wherein, if the target hash seed and the preset hash algorithm are used for calculation, the calculated traffic allocation result meets the preset traffic balancing requirements; Configure the target hash seed for traffic allocation to the network devices; The step of determining the hash seed for traffic balancing based on the traffic attribute information and the ECMP configuration information includes: The traffic attribute information and the ECMP configuration information are combined in various ways to obtain multiple hash seeds for traffic balancing.

2. The method according to claim 1, characterized in that, The networking device includes a timer, and the step of obtaining the traffic attribute information at the current moment includes: The timer is controlled to determine the traffic detection time interval, and if the traffic detection time interval meets the preset time interval condition, the traffic attribute information at the current moment is obtained.

3. The method according to claim 1, characterized in that, The step of determining the target hash seed based on the traffic allocation result includes: If the traffic allocation result calculated using the current hash seed and the preset hash algorithm does not meet the preset traffic balance requirement, then the next hash seed is obtained, and the corresponding traffic allocation result is calculated using the next hash seed and the preset hash algorithm, until the traffic allocation result meets the preset traffic balance requirement; the preset traffic balance requirement includes no hash polarization phenomenon. The hash seed corresponding to the calculated traffic allocation result that meets the preset traffic balancing requirements is determined as the target hash seed.

4. The method according to claim 3, characterized in that, After determining the hash seed corresponding to the calculated traffic allocation result that meets the preset traffic balancing requirements as the target hash seed, the method further includes: Record the target hash seed and the traffic attribute information, and establish a mapping relationship between the target hash seed and the traffic attribute information.

5. The method according to claim 4, characterized in that, The method further includes: Obtain the traffic attribute information at the next moment; If the traffic attribute information at the next moment is consistent with the traffic attribute information at the current moment, then based on the mapping relationship between the target hash seed and the traffic attribute information, the target hash seed is determined as the target hash seed at the next moment.

6. The method according to claim 3, characterized in that, The method further includes: If the target hash seed does not exist, the preset hash algorithm is updated.

7. A flow distribution device, characterized in that, Applied to networking equipment, the chip of the networking equipment provides a preset hash algorithm, and the device includes: The first acquisition module is used to acquire traffic attribute information at the current moment and ECMP configuration information; wherein, the traffic attribute information includes one or more of MAC address information, IP protocol information and port information; the ECMP configuration information includes ECMP load balancing information; and the port information includes port queue information and port load information. The first determining module is used to determine the hash seed for traffic balancing based on the traffic attribute information and the ECMP configuration information. The calculation module is used to calculate the corresponding traffic allocation result using the hash seed and the preset hash algorithm; the traffic allocation result is used to evenly distribute traffic to each branch. The second determining module is used to determine the target hash seed to be used based on the traffic allocation result; wherein, if the target hash seed and the preset hash algorithm are used for calculation, the calculated traffic allocation result meets the preset traffic balancing requirements; The configuration module is used to configure the target hash seed for traffic allocation of the networking devices; The first determining module includes: The combination submodule is used to combine the traffic attribute information and the ECMP configuration information in various ways to obtain multiple hash seeds for traffic balancing.

8. An electronic device, characterized in that, include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the steps of a traffic allocation method as described in any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, which, when executed by a processor, implements the steps of a traffic allocation method as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Load balancing hash computation for network switches

    CN102571558A

  • Method for avoiding Hash polarization in data center network and chip implementation device

    CN107682268A