Traffic distribution method and system of network communication equipment, electronic equipment and storage medium
By hashing the data flow and bandwidth management of cluster equipment, the problems of uneven distribution and equipment overload in traditional data flow distribution methods are solved, efficient network communication equipment traffic distribution is achieved, and resource utilization and system stability are optimized.
Patent Information
- Application Number
- CN202510176451.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-18
- Publication Date
- 2025-05-23
AI Technical Summary
Traditional data stream distribution methods ignore the characteristics of data streams, resulting in uneven distribution, some devices are overloaded and some devices are idle. How to efficiently manage and distribute network traffic has become an urgent problem.
By obtaining the data stream to be distributed, building multiple groups and hashing, traversing the hash table of the cluster device according to the hash value to match the target device. If it does not match, the device with the bandwidth that meets the preset conditions will be selected as the target device, and bandwidth adjustment and device expansion or fault processing will be performed if necessary.
It realizes efficient distribution of data streams, optimizes resource utilization, avoids equipment overload and idleness, and enhances the flexibility and stability of the system.
Smart Images

Figure CN120034547A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a flow distribution method, system, electronic device and storage medium for network communication equipment. Background Art
[0002] In the big data and cloud computing environment, the distribution and processing of data streams is a crucial link. Traditional data stream distribution methods often rely on simple load balancing algorithms, such as polling and random, which ignore the characteristics of the data stream itself and may lead to uneven distribution of data streams, overloading some devices, and idleness of some devices. In addition, with the rapid growth of network traffic, how to efficiently manage and distribute these data streams has become an urgent problem to be solved. Summary of the invention
[0003] The present invention aims to solve the problem of related technical limitations at least to a certain extent. To this end, the present invention proposes a flow distribution method, system, electronic device and storage medium of a network communication device, which can efficiently distribute the flow of the network communication device.
[0004] On the one hand, an embodiment of the present invention provides a traffic distribution method of a network communication device, comprising the following steps:
[0005] Get the data stream to be distributed, and construct a tuple according to the data stream; the tuple includes the source IP, destination IP, source port, destination port and protocol value corresponding to the data stream;
[0006] Perform hash processing on the tuple to obtain the hash value of the tuple corresponding to the data stream;
[0007] Based on the hash value, the hash table of each device in the preset cluster device is traversed to match the target device; if the target device is not matched, any device in the cluster device that uses a total bandwidth that meets the preset conditions is used as the target device; the hash table includes the hash value corresponding to the device receiving type data flow;
[0008] Distribute data streams to target devices in the cluster.
[0009] Optionally, when the target device is not matched, the method further comprises the following steps:
[0010] Add the hash value of the tuple corresponding to the data stream to the hash table of the target device.
[0011] Optionally, the method further comprises the following steps:
[0012] Determine the bandwidth usage of each device according to the total bandwidth used and the rated bandwidth of each device in the cluster;
[0013] When the bandwidth usage of a device in the cluster reaches a preset bandwidth threshold, the corresponding device is determined to be a high-bandwidth device;
[0014] Obtain the occupied bandwidth of each data stream received by the high-bandwidth device;
[0015] Transfer the data flow with the smallest bandwidth in the high-bandwidth device to any device in the cluster that uses a total bandwidth that meets the preset conditions;
[0016] The hash value corresponding to the transferred data stream is deleted from the hash table of the high-bandwidth device, and the corresponding hash value is added to the hash table of the device to which the transferred data stream is transferred.
[0017] Optionally, the method further comprises the following steps:
[0018] Determine the bandwidth usage of each device according to the total bandwidth used and the rated bandwidth of each device in the cluster;
[0019] When the bandwidth usage of more than half of the devices in the cluster reaches the preset bandwidth threshold, the cluster devices are expanded.
[0020] Optionally, when a faulty device occurs in the cluster device, the method further includes the following steps:
[0021] Remove the faulty device from the cluster.
[0022] The data flow of the faulty device is transferred to any device in the cluster whose total bandwidth meets the preset conditions.
[0023] Optionally, the method further comprises the following steps:
[0024] Get the bandwidth of all data streams received by each device in the cluster;
[0025] Determine the total bandwidth used by each device in the cluster based on the sum of the bandwidths of all data streams received by each device;
[0026] Arrange the devices in the cluster in ascending order according to the total bandwidth used, and obtain a device bandwidth sequence;
[0027] The preset conditions include that the total bandwidth used is less than a preset ratio threshold, or that the total bandwidth used is at the front of the device bandwidth sequence.
[0028] Optionally, the method further comprises the following steps:
[0029] Deleting the hash value corresponding to the transferred data stream from the hash table of the processing device, and adding the corresponding hash value to the hash table of the device to which the transferred data stream is transferred;
[0030] Among them, the processing equipment includes high bandwidth equipment and fault equipment.
[0031] On the other hand, an embodiment of the present invention provides a traffic distribution system for a network communication device, including:
[0032] The first module is used to obtain the data stream to be distributed and construct a tuple according to the data stream; the tuple includes the source IP, destination IP, source port, destination port and protocol value corresponding to the data stream;
[0033] The second module is used to perform hash processing on the tuple to obtain the hash value of the tuple corresponding to the data stream;
[0034] The third module is used to traverse the hash table of each device in the preset cluster device based on the hash value to match the target device; if the target device is not matched, any device in the cluster device whose total bandwidth meets the preset conditions is used as the target device; the hash table includes the hash value corresponding to the device receiving type data flow;
[0035] The fourth module is used to distribute the data stream to the target device in the cluster device.
[0036] Optionally, when the target device is not matched, the system further includes:
[0037] The fifth module is used to add the hash value of the tuple corresponding to the data stream to the hash table of the target device.
[0038] Optionally, the system further comprises:
[0039] The sixth module is used to determine the bandwidth usage rate of each device according to the total bandwidth used and the rated bandwidth of each device in the cluster device;
[0040] The seventh module is used to determine that the corresponding device is a high-bandwidth device when the bandwidth usage rate of a device in the cluster device reaches a preset bandwidth threshold;
[0041] The eighth module is used to obtain the occupied bandwidth of each data stream received by the high-bandwidth device;
[0042] The ninth module is used to transfer the data flow with the smallest bandwidth in the high-bandwidth device to any device in the cluster device whose total bandwidth meets the preset conditions;
[0043] The tenth module is used to delete the hash value corresponding to the transferred data stream from the hash table of the high-bandwidth device, and add the corresponding hash value to the hash table of the device to which the transferred data stream is transferred.
[0044] Optionally, the system further comprises:
[0045] The eleventh module is used to determine the bandwidth usage rate of each device according to the total bandwidth used and the rated bandwidth of each device in the cluster device;
[0046] The twelfth module is used to expand the capacity of the cluster devices when the bandwidth usage rate of more than half of the devices in the cluster devices reaches a preset bandwidth threshold.
[0047] Optionally, when a faulty device occurs in the cluster device, the system further includes:
[0048] The thirteenth module is used to remove a faulty device from the cluster device;
[0049] The fourteenth module is used to transfer the data flow of the failed device to any device in the cluster device whose total bandwidth meets the preset conditions.
[0050] Optionally, the system further comprises:
[0051] The fifteenth module is used to obtain the bandwidth of all data streams received by each device in the cluster;
[0052] The sixteenth module is used to determine the total bandwidth used by each device in the cluster device according to the sum of the bandwidths of all data streams received by each device;
[0053] The seventeenth module is used to sort the devices in the cluster device in ascending order according to the total bandwidth used, so as to obtain a device bandwidth sequence;
[0054] The preset conditions include that the total bandwidth used is less than a preset ratio threshold, or that the total bandwidth used is at the front of the device bandwidth sequence.
[0055] Optionally, the system further comprises:
[0056] An eighteenth module is used to delete the hash value corresponding to the transferred data flow from the hash table of the processing device, and add the corresponding hash value to the hash table of the device to which the transferred data flow is transferred;
[0057] Among them, the processing equipment includes high bandwidth equipment and fault equipment.
[0058] On the other hand, an embodiment of the present invention provides an electronic device, including: a processor and a memory; the memory is used to store programs; the processor executes the program to implement the traffic distribution method of the above-mentioned network communication device.
[0059] On the other hand, an embodiment of the present invention provides a computer storage medium, in which a program executable by a processor is stored. When the program executable by the processor is executed by the processor, it is used to implement the traffic distribution method of the above-mentioned network communication device.
[0060] The embodiment of the present invention obtains the data stream to be distributed, constructs a tuple according to the data stream; the tuple includes the source IP, destination IP, source port, destination port and protocol value corresponding to the data stream; performs hash processing on the tuple to obtain the hash value of the tuple corresponding to the data stream; traverses the hash table of each device in the preset cluster device based on the hash value to match the target device; if the target device is not matched, any device in the cluster device that uses a total bandwidth that meets the preset conditions is used as the target device; the hash table includes the hash value corresponding to the device receiving type data stream; and distributes the data stream to the target device in the cluster device. The embodiment of the present invention includes the following beneficial effects:
[0061] 1. Improve distribution efficiency: By hashing the key attributes of the data stream, a unique hash value can be quickly generated to find the matching target device in the cluster. This method is more efficient than traditional load balancing algorithms and can reduce delays in the distribution process.
[0062] 2. Optimize resource utilization: Matching the target device in the hash table of the cluster device according to the hash value of the data flow can ensure that the same type of data flow is distributed to the same device, thereby optimizing resource utilization and avoiding load imbalance between devices.
[0063] 3. Enhanced flexibility: When the target device is not matched in the hash table, any device in the cluster can be selected as the target device according to the preset conditions. This method enhances the flexibility of distribution and can adapt to cluster environments of different sizes and loads.
[0064] 4. Improve system stability: By intelligently distributing data streams, some devices can be prevented from crashing due to overload, thus improving the stability and reliability of the entire system. At the same time, this method also helps to achieve balanced distribution of data streams and extend the service life of cluster devices. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] The accompanying drawings are used to provide a further understanding of the technical solution of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the technical solution of the present invention and do not constitute a limitation on the technical solution of the present invention.
[0066] Figure 1 It is a schematic diagram of an implementation environment for traffic distribution of network communication devices provided by an embodiment of the present invention;
[0067] Figure 2 It is a flow chart of a method for distributing traffic of a network communication device provided by an embodiment of the present invention;
[0068] Figure 3 A flow chart of a flow collection example provided in an embodiment of the present invention;
[0069] Figure 4 A schematic diagram of an example of registration information provided by an embodiment of the present invention;
[0070] Figure 5 A schematic diagram of a flow distribution example provided in an embodiment of the present invention;
[0071] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0072] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0073] It should be noted that, although the functional modules are divided in the system schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the system or the order in the flowchart. The terms "first / S100", "second / S200", etc. in the specification, claims and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0074] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0075] It is understandable that the traffic distribution method of the network communication device provided in the embodiment of the present invention can be applied to any computer device with data processing and computing capabilities, and this computer device can be various types of terminals or servers. When the computer device in the embodiment is a server, the server is an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Optionally, the terminal is a smart phone, a tablet computer, a laptop computer, a desktop computer, etc., but is not limited to this.
[0076] like Figure 1FIG. 1 is a schematic diagram of an implementation environment provided by an embodiment of the present invention. Figure 1 The implementation environment includes at least one terminal 102 and a server 101. The terminal 102 and the server 101 can be connected to a network wirelessly or wired to complete data transmission and exchange.
[0077] Server 101 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as big data and artificial intelligence platforms.
[0078] In addition, the server 101 can also be a node server in the blockchain network. Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithm.
[0079] The terminal 102 may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto. The terminal 102 and the server 101 may be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiment of the present invention.
[0080] Based on the example Figure 1 In the implementation environment shown, an embodiment of the present invention provides a traffic distribution method for a network communication device. The following is explained using the application of the traffic distribution method of the network communication device in the server 101 as an example. It can be understood that the traffic distribution method of the network communication device can also be applied to the terminal 102.
[0081] Reference Figure 2 , Figure 2 The flow chart of the traffic distribution method of the network communication device applied to the server provided in the embodiment of the present invention, the execution subject of the traffic distribution method of the network communication device can be any of the aforementioned computer devices (including servers or terminals). Figure 2 , the method comprises the following steps:
[0082] S100, obtaining a data stream to be distributed, and constructing a tuple according to the data stream;
[0083] Among them, the tuple includes the source IP, destination IP, source port, destination port and protocol value corresponding to the data flow;
[0084] S200, performing hash processing on the tuple to obtain a hash value of the tuple corresponding to the data stream;
[0085] S300, traversing the hash table of each device in the preset cluster device based on the hash value, and matching to obtain the target device; if the target device is not matched, taking any device in the cluster device whose total bandwidth meets the preset conditions as the target device;
[0086] The hash table includes a hash value corresponding to a data stream of a device receiving type;
[0087] S400: Distribute the data stream to the target device in the cluster device.
[0088] Among them, in some embodiments, when the target device is not matched, the method may further include the following steps: adding the hash value of the tuple corresponding to the data stream to the hash table of the target device.
[0089] For example, in some specific implementations, the embodiments of the present invention hash each data flow according to the five-tuple (source IP, destination IP, source port, destination port, protocol value) to establish a hash table. The same hash value can be considered as the same (same type) flow, so for each received data packet, the hash value is calculated according to the five-tuple, and the hash table of each device is traversed. The hash table includes not only the five-tuple information, but also the flow status information, such as the various states of the TCP flow, which is convenient for migration. And process as follows:
[0090] (1) If the packet is not in the hash table of any device, it means that the flow is newly established. In this case, a device with a relatively small bandwidth (for example, any one of the three devices with the smallest bandwidth, or a device with a total bandwidth less than a preset ratio threshold) is selected to process the traffic (at the beginning, no one has any traffic, so any one is selected). The data packet is forwarded to the device for processing, and the five-tuple hash of the device is added to the hash table of the device.
[0091] (2) If the packet is in the hash table of a certain device, it will be forwarded to this device.
[0092] It should be noted that, in some embodiments, the method may further include the following steps: obtaining the bandwidth of all data streams received by each device in the cluster device; determining the total bandwidth used by each device in the cluster device according to the sum of the bandwidths of all data streams received by each device; sorting the devices in the cluster device in ascending order according to the total bandwidth used to obtain a device bandwidth sequence; wherein the preset conditions include that the total bandwidth used is less than a preset ratio threshold, or that the total bandwidth used is at the front of the sequence in the device bandwidth sequence.
[0093] Exemplarily, in some specific implementations, the embodiments of the present invention also calculate the traffic received per second by calculating the flows received by each device in the cluster in real time, including the bandwidth of all flows received per second in the device and the bandwidth of each flow, and sorts the actual total bandwidth used by each device from small to large.
[0094] It should be noted that, in some embodiments, the method may further include the following steps: determining the bandwidth usage rate of each device based on the total bandwidth used and the rated bandwidth of each device in the cluster device; when the bandwidth usage rate of a device in the cluster device reaches a preset bandwidth threshold, determining that the corresponding device is a high-bandwidth device; obtaining the occupied bandwidth of each data stream received by the high-bandwidth device; transferring the data stream with the smallest occupied bandwidth in the high-bandwidth device to any device in the cluster device whose total bandwidth used meets the preset conditions; deleting the hash value corresponding to the transferred data stream from the hash table of the high-bandwidth device, and adding the corresponding hash value in the hash table of the device to which the transferred data stream is transferred.
[0095] For example, in some specific implementations, a threshold value, such as 95%, can be set for bandwidth usage of each device. When the bandwidth usage reaches the threshold value, the flow with small bandwidth is selected and transferred to the device with small bandwidth according to the occupied bandwidth of each flow, the bandwidth of the flow of this device and the hash value in the hash table are reduced, and the bandwidth of the device with small bandwidth is increased.
[0096] It should be noted that, in some embodiments, the method may further include the following steps: determining the bandwidth usage of each device in the cluster based on the total bandwidth used and the rated bandwidth of each device in the cluster; when the bandwidth usage of more than half of the devices in the cluster reaches a preset bandwidth threshold, expanding the cluster devices.
[0097] For example, in some specific implementations, when half of the cluster device bandwidth utilization reaches a set bandwidth threshold, bandwidth usage is close to a bottleneck, which means that bandwidth adjustments will become more frequent. At this time, the device capacity must be expanded and new devices must be added to process services.
[0098] It should be noted that, in some embodiments, when a faulty device appears in the cluster device, the method may further include the following steps: removing the faulty device from the cluster device; transferring the data flow of the faulty device to any device in the cluster device whose total bandwidth meets the preset conditions.
[0099] For example, in some specific implementations, when a device fails and needs to be removed from the cluster, the flows in the hash table need to be distributed to devices with lower bandwidth usage, and the device needs to be removed.
[0100] It should be noted that in some embodiments, the hash value corresponding to the transferred data stream is deleted from the hash table of the processing device, and the corresponding hash value is added to the hash table of the device to which the transferred data stream is transferred; wherein the processing device includes a high-bandwidth device and a faulty device.
[0101] For example, in some specific implementations, when a data stream is transferred, in order to facilitate the subsequent processing of the same type of data stream, the hash tables of the transferred data stream in the two transferred devices may be updated.
[0102] In order to explain the principle of the technical solution of the present invention in detail, the overall process of the present invention is described below in combination with some specific embodiments. It is easy to understand that the following is an explanation of the technical principle of the present invention and cannot be regarded as a limitation of the present invention.
[0103] First of all, it should be noted that in order to achieve high availability of communication services, multiple devices can be used to form a cluster to process services. The processing methods of this cluster are:
[0104] 1. Active / standby mode, i.e. one active and multiple standby or one active and one standby mode. In this case, generally only one machine is processing business at the same time, and other devices are used for backup. This method wastes bandwidth and does not utilize the resources of the standby machine. When the business bandwidth is large, the machine load may be high, affecting the business.
[0105] 2. Distribution method, that is, the devices in the cluster undertake business at the same time to reduce the bandwidth of a single device. This method adopts a certain distribution strategy to evenly distribute traffic to each device in the cluster, which can make better use of bandwidth. However, it is difficult to ensure that the same flow is distributed to the same machine while trying to ensure that the bandwidth of each device does not occupy too much. In addition, the distribution method also involves a capacity expansion and fault switching function when more machines are added, that is, when it is detected that the bandwidth utilization of the device is too high, a new device is added to the cluster. When a device in the cluster is detected to have a fault, the traffic in the faulty device is distributed to other devices in the cluster, and the faulty device in the device is removed.
[0106] Specifically, Figure 3 As shown, a device with high performance is added between the cluster device and the external network to handle the distribution of the external network data stream. The solution of the embodiment of the present invention can implement the distribution strategy of the method of the present invention on this device. Specifically, Figure 4 As shown, the method of the present invention can be implemented as follows:
[0107] 1. For each data flow, hash the five-tuple (source IP, destination IP, source port, destination port, protocol value) and build a hash table. The same hash value can be considered as the same flow. Therefore, for each received data packet, the hash value is calculated according to the five-tuple and the hash table of each device is traversed. The hash table includes not only the five-tuple information, but also the flow status information, such as the various states of the TCP flow, which is convenient for migration. And process as follows:
[0108] (1) If the packet is not in the hash table of any device, it means that the flow is newly established. Select the device with the smallest bandwidth in the cluster from step 2 to process the traffic (at the beginning, no one has any traffic, so any one is selected). Forward the packet to the device for processing and add the five-tuple hash of the device to the hash table of the device.
[0109] Specifically, at the beginning, all devices have no traffic and the hash tables are empty. When the device traverses to the first device with no traffic, it directly forwards the data.
[0110] (2) If the packet is in the hash table of a certain device, it will be forwarded to this device.
[0111] 2. Calculate the flows received by each device in the cluster in real time, calculate the traffic received per second, including the bandwidth of all flows received by the device per second and the bandwidth of each flow, and sort the actual total bandwidth used by each device from small to large.
[0112] Specifically, each device calculates the number of packets received per second, the number of bytes in each packet, and the total number of bytes. The total number of bytes is divided by 8 to get the rate in bps, and then divided by 1024 to convert it to kbps. This is how it is handled regardless of whether it is a peak value or not.
[0113] 3. Set a threshold for bandwidth usage of each device, such as 95%. When bandwidth usage reaches the threshold, select the flow with small bandwidth and transfer it to the device with small bandwidth according to the occupied bandwidth of each flow calculated in step 2. Reduce the bandwidth of this flow and the hash value in the hash table of this device, and increase it on the device with small bandwidth.
[0114] Specifically, this threshold can be set according to your needs or configured to make necessary adjustments based on the scenario. Follow the steps below when migrating:
[0115] (1) Select a flow with smaller bandwidth based on bandwidth conditions, which will have less impact.
[0116] (2) Synchronize the five-tuple information and flow status information to the device to be transferred, and add the five-tuple hash table to the new device that receives the traffic. At this time, both devices have the five-tuple information, which may cause both devices to have it for a short period of time, but the traffic will only be forwarded to one of them, which will not affect it. Then delete the five-tuple information in the hash table of the original device, and only delete the five-tuple information of the flow on the new device.
[0117] 4. When the bandwidth utilization of half of the cluster devices reaches the set bandwidth threshold, the bandwidth utilization is close to the bottleneck, which means that the bandwidth adjustment in step 3 will become more and more frequent. At this time, it is necessary to expand the equipment and add new equipment to handle the business.
[0118] Specifically, when expanding equipment, some flows will be migrated from cluster equipment that has reached the bandwidth threshold. The migration method is the same as migrating to equipment with small bandwidth in the above steps. It can be automated. When adding equipment, when other equipment reaches the threshold based on bandwidth usage, flows with small bandwidth are selected and migrated to the new equipment.
[0119] 5. When a device fails and needs to be removed from the cluster, the flows in the hash table need to be distributed to devices with lower bandwidth usage and the device needs to be removed.
[0120] Specifically, the purpose of distributing to low-load devices is to ensure that traffic is shared as evenly as possible, which can minimize high-load situations. Since each device has traffic statistics, it is very convenient to select the device with the lowest traffic. The method to ensure that the switch is not lost is still the same. First synchronize the hash table so that two devices have the same five-tuple hash in a short period of time, and then delete the faulty device.
[0121] In summary, the present invention uses a dynamic planning and adjustment method to dynamically adjust the flow storage of each device, so as to make full use of the bandwidth resources of each device as much as possible when different flow bandwidths are occupied differently. The five-tuple is calculated by hash value and the hash value is used. By searching the hash table, it is ensured that each flow will only be on the same device, and the flow matching rate is also accelerated. At the same time, it supports adding and deleting devices.
[0122] On the other hand, Figure 5 As shown, an embodiment of the present invention provides a traffic distribution system 900 for a network communication device, which may include:
[0123] The first module 901 is used to obtain the data stream to be distributed and construct a tuple according to the data stream; the tuple includes the source IP, destination IP, source port, destination port and protocol value corresponding to the data stream;
[0124] The second module 902 is used to perform hash processing on the tuple to obtain a hash value of the tuple corresponding to the data stream;
[0125] The third module 903 is used to traverse the hash table of each device in the preset cluster device based on the hash value to match the target device; if the target device is not matched, any device in the cluster device whose total bandwidth meets the preset conditions is used as the target device; the hash table includes the hash value corresponding to the device receiving type data flow;
[0126] The fourth module 904 is used to distribute the data stream to the target device in the cluster device.
[0127] In some embodiments, when the target device is not matched, the system may further include:
[0128] The fifth module is used to add the hash value of the tuple corresponding to the data stream to the hash table of the target device.
[0129] In some embodiments, the system may further include:
[0130] The sixth module is used to determine the bandwidth usage rate of each device according to the total bandwidth used and the rated bandwidth of each device in the cluster device;
[0131] The seventh module is used to determine that the corresponding device is a high-bandwidth device when the bandwidth usage rate of a device in the cluster device reaches a preset bandwidth threshold;
[0132] The eighth module is used to obtain the occupied bandwidth of each data stream received by the high-bandwidth device;
[0133] The ninth module is used to transfer the data flow with the smallest bandwidth in the high-bandwidth device to any device in the cluster device whose total bandwidth meets the preset conditions;
[0134] The tenth module is used to delete the hash value corresponding to the transferred data stream from the hash table of the high-bandwidth device, and add the corresponding hash value to the hash table of the device to which the transferred data stream is transferred.
[0135] In some embodiments, the system may further include:
[0136] The eleventh module is used to determine the bandwidth usage rate of each device according to the total bandwidth used and the rated bandwidth of each device in the cluster device;
[0137] The twelfth module is used to expand the capacity of the cluster devices when the bandwidth usage rate of more than half of the devices in the cluster devices reaches a preset bandwidth threshold.
[0138] In some embodiments, when a faulty device occurs in a cluster device, the system may further include:
[0139] The thirteenth module is used to remove a faulty device from the cluster device;
[0140] The fourteenth module is used to transfer the data flow of the failed device to any device in the cluster device whose total bandwidth meets the preset conditions.
[0141] In some embodiments, the system may further include:
[0142] The fifteenth module is used to obtain the bandwidth of all data streams received by each device in the cluster;
[0143] The sixteenth module is used to determine the total bandwidth used by each device in the cluster device according to the sum of the bandwidths of all data streams received by each device;
[0144] The seventeenth module is used to sort the devices in the cluster device in ascending order according to the total bandwidth used, so as to obtain a device bandwidth sequence;
[0145] The preset conditions include that the total bandwidth used is less than a preset ratio threshold, or that the total bandwidth used is at the front of the device bandwidth sequence.
[0146] In some embodiments, the system may further include:
[0147] An eighteenth module is used to delete the hash value corresponding to the transferred data flow from the hash table of the processing device, and add the corresponding hash value to the hash table of the device to which the transferred data flow is transferred;
[0148] Among them, the processing equipment includes high bandwidth equipment and fault equipment.
[0149] The contents of the method embodiments of the present invention are all applicable to the device embodiments. The functions specifically implemented by the device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0150] On the other hand, an embodiment of the present invention further provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the above-mentioned traffic distribution method of the network communication device when executing the computer program. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.
[0151] It can be understood that the contents of the above method embodiments are all applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0152] like Figure 6 As shown, Figure 6 The hardware structure of an electronic device 1000 of another embodiment is illustrated. The electronic device 1000 includes:
[0153] The processor 1001 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (application-specific integrated circuit, aSIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present invention;
[0154] The memory 1002 may be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 1002 may store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 1002, and the processor 1001 calls and executes the network node population optimization method of the embodiment of the present invention;
[0155] Input / output interface 1003, used to implement information input and output;
[0156] The communication interface 1004 is used to realize the communication interaction between the device and other devices. The communication can be realized through a wired manner (such as USB, network cable, etc.) or a wireless manner (such as mobile network, WIFI, Bluetooth, etc.);
[0157] A bus 1005 , which transmits information between various components of the device (e.g., the processor 1001 , the memory 1002 , the input / output interface 1003 , and the communication interface 1004 );
[0158] The processor 1001 , the memory 1002 , the input / output interface 1003 and the communication interface 1004 are connected to each other in communication within the device via the bus 1005 .
[0159] The electronic device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0160] The contents of the method embodiments of the present invention are all applicable to the electronic device embodiments. The functions specifically implemented by the electronic device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0161] Another aspect of an embodiment of the present invention further provides a computer-readable storage medium, wherein the storage medium stores a program, and the program is executed by a processor to implement the above method.
[0162] It should be noted that the computer-readable medium shown in the embodiment of the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (Compact Disc Read to Only Memory, CD to ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than computer readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0163] The contents of the method embodiments of the present invention are all applicable to the computer-readable storage medium embodiments. The functions specifically implemented by the computer-readable storage medium embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0164] The embodiment of the present invention also discloses a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device can read the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the above method.
[0165] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0166] It should be noted that, although several modules of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to an embodiment of the present invention, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.
[0167] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD to ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation of the present invention.
[0168] In some selectable embodiments, the function / operation mentioned in the block diagram may not occur in the order mentioned in the operation diagram. For example, depending on the function / operation involved, the two boxes shown in succession can actually be executed substantially simultaneously or the boxes can sometimes be executed in reverse order. In addition, the embodiment presented and described in the flow chart of the present invention is provided by way of example, for the purpose of providing a more comprehensive understanding of technology. The disclosed method is not limited to the operation and logic flow presented herein. Selectable embodiments are expected, wherein the order of various operations is changed and the sub-operation of a part for which is described as a larger operation is performed independently.
[0169] In addition, although the present invention is described in the context of functional modules, it should be understood that, unless otherwise specified, one or more of the functions and / or features can be integrated into a single physical device and / or software module, or one or more functions and / or features can be implemented in a separate physical device or software module. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the present invention. More specifically, in view of the properties, functions and internal relationships of the various functional modules in the device disclosed herein, the actual implementation of the module will be understood within the conventional skills of the engineer. Therefore, those skilled in the art can implement the present invention set forth in the claims without excessive experimentation using ordinary techniques. It is also understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of the present invention, which is determined by the full scope of the appended claims and their equivalents.
[0170] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0171] The logic and / or steps represented in the flowchart or otherwise described herein, for example, may be considered as an ordered list of executable instructions for implementing logical functions, and may be embodied in any computer-readable medium for use by an instruction execution device, apparatus or device (such as a computer-based device, a device including a processor, or other device that can fetch instructions from an instruction execution device, apparatus or device and execute the instructions), or in conjunction with such instruction execution device, apparatus or device. For purposes of this specification, "computer-readable medium" may be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution device, apparatus or device, or in conjunction with such instruction execution device, apparatus or device.
[0172] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.
[0173] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution device. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0174] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0175] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
[0176] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the embodiments. Those skilled in the art can make various equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of the present invention.
Claims
1. A method for distributing traffic of a network communication device, characterized in that: The following steps are involved: Obtain a data stream to be distributed, and construct a tuple according to the data stream; the tuple includes a source IP, a destination IP, a source port, a destination port, and a protocol value corresponding to the data stream; Performing hash processing on the tuple to obtain a hash value of the tuple corresponding to the data stream; Based on the hash value, the hash table of each device in the preset cluster device is traversed to match the target device; if the target device is not matched, any device in the cluster device whose total bandwidth meets the preset conditions is used as the target device; the hash table includes the hash value corresponding to the device receiving type data flow; The data stream is distributed to the target device in the cluster device.
2. The method for distributing traffic of a network communication device according to claim 1, characterized in that: When the target device is not matched, the method further comprises the following steps: The hash value of the tuple corresponding to the data stream is added to the hash table of the target device.
3. The method for distributing traffic of a network communication device according to claim 1, characterized in that: The method further comprises the following steps: Determine the bandwidth usage rate of each device in the cluster device according to the total bandwidth used and the rated bandwidth of each device; When the bandwidth usage rate of a device in the cluster device reaches a preset bandwidth threshold, determining the corresponding device as a high-bandwidth device; Obtaining the occupied bandwidth of each of the data streams received by the high-bandwidth device; Transferring the data flow with the smallest occupied bandwidth in the high-bandwidth device to any device in the cluster device whose total bandwidth usage meets the preset condition; The hash value corresponding to the transferred data flow is deleted from the hash table of the high-bandwidth device, and the corresponding hash value is added to the hash table of the device to which the transferred data flow is transferred.
4. The method for distributing traffic of a network communication device according to claim 1, characterized in that: The method further comprises the following steps: Determine the bandwidth usage rate of each device in the cluster device according to the total bandwidth used and the rated bandwidth of each device; When the bandwidth usage rate of more than half of the devices in the cluster device reaches a preset bandwidth threshold, the cluster device is expanded.
5. The method for distributing traffic of a network communication device according to claim 1, characterized in that: When a faulty device occurs in the cluster device, the method further comprises the following steps: Removing the faulty device from the cluster device; The data flow of the faulty device is transferred to any device in the cluster device whose total bandwidth usage meets the preset condition.
6. The method for distributing traffic of a network communication device according to claim 1, 3 or 5, characterized in that: The method further comprises the following steps: Obtaining the bandwidth of each device in the cluster device receiving all the data streams; Determine the total bandwidth used by each device in the cluster device according to the sum of the bandwidths received by each device for all the data streams; Arrange the devices in the cluster device in ascending order according to the total bandwidth used, to obtain a device bandwidth sequence; The preset condition includes that the total bandwidth used is less than a preset ratio threshold, or that the total bandwidth used is at the front of the device bandwidth sequence.
7. The method for distributing traffic of a network communication device according to claim 3 or 5, characterized in that: The method further comprises the following steps: Deleting the hash value corresponding to the transferred data flow from the hash table of the processing device, and adding the corresponding hash value to the hash table of the device to which the transferred data flow is transferred; The processing device includes a high bandwidth device and a fault device.
8. A traffic distribution system for a network communication device, characterized in that: include: A first module is used to obtain a data stream to be distributed and construct a multi-tuple according to the data stream; The tuple includes the source IP, destination IP, source port, destination port and protocol value corresponding to the data flow; A second module is used to perform hash processing on the tuple to obtain a hash value of the tuple corresponding to the data stream; A third module is used to traverse the hash table of each device in the preset cluster device based on the hash value to match and obtain the target device; If the target device is not matched, any device in the cluster whose total bandwidth meets the preset conditions is used as the target device; the hash table includes the hash value corresponding to the device receiving type data flow; The fourth module is used to distribute the data stream to the target device in the cluster device.
9. An electronic device, characterized in that: including a processor and a memory; The memory is used to store programs; The processor executes the program to implement the method according to any one of claims 1 to 7.
10. A computer storage medium storing a program executable by a processor, characterized in that: The program executable by the processor is used to implement the method according to any one of claims 1 to 7 when executed by the processor.