Flow shunting method and device based on load balancing
By acquiring and adjusting the priority sequence of processing nodes, we ensure that load balancing can still be maintained in the event of failure, solving the problem of load imbalance in C-IWF and achieving special load balancing processing for special service traffic.
Patent Information
- Application Number
- CN202411448427.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-16
- Publication Date
- 2024-12-10
AI Technical Summary
The existing C-IWF traffic proxy network elements are difficult to meet the special load balancing rules for specific traffic allocation, and it is difficult to ensure load balancing when handling node failures.
By obtaining the initial priority sequence of the processing node and adjusting it to the target priority sequence according to the preset priority adjustment rules, ensuring that load balancing can still be maintained when processing node failures, and using routing equipment to route traffic according to the target priority sequence.
It realizes the load balancing state when handling node failures, ensures special load balancing processing of special service traffic, and solves the problem of load imbalance.
Smart Images

Figure CN119109875A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network security technology, and in particular to a method and device for traffic diversion based on load balancing. Background Art
[0002] 5G converged private network services are developing rapidly, and the need for interconnection between private networks and large networks is becoming increasingly urgent, but this has also brought about a series of issues such as network security, operator control, and national supervision. In order to solve these problems, relevant operators have proposed the architecture concept of Customized-Inter Working Function (C-IWF), that is, deploying a traffic interconnection gateway between private networks and large networks. This not only ensures the security of large networks and private networks, but also simplifies the complexity of network connection. In order to ensure the stability and high availability of C-IWF, it is usually necessary to add a load balancer to deploy a high-availability cluster, realize traffic load balancing, and distribute it to multiple nodes in the cluster for processing.
[0003] Generally, C-IWF traffic proxy network elements provide traffic proxy services to other network elements by providing proxy IP (Internet Protocol), and at the same time have certain security requirements, that is, the designated proxy services need to be divided into designated processing nodes to ensure that the proxy services are processed normally. However, the load balancing methods commonly used by C-IWF traffic proxy network elements, such as route equal-cost routing, dedicated load balancers, etc., all perform hashing on the overall traffic, so it is difficult to meet the needs of special load balancing rules for specific traffic allocation; at the same time, in the face of cluster expansion or contraction or failure, the above methods are also difficult to ensure load balancing.
[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of the present application provide a traffic diversion method and device based on load balancing, so as to at least solve the technical problem in the related art that when any processing node in multiple processing nodes fails, the traffic load cannot be reasonably distributed, resulting in load imbalance.
[0006] According to one aspect of an embodiment of the present application, a traffic diversion device is provided, including: an acquisition module, used to obtain an initial priority sequence corresponding to the traffic of a target network element processed by multiple processing nodes in a current cycle; an adjustment module, used to adjust the initial priority sequence according to a preset priority adjustment rule to obtain a target priority sequence for the traffic of a target network element processed by multiple processing nodes in a next cycle; and a sending module, used to send the target priority sequence to a routing device.
[0007] Optionally, an initial priority sequence corresponding to traffic of a target network element processed by multiple processing nodes in the current cycle is obtained, including: obtaining a first quantity of traffic of the target network element processed by each processing node in the current cycle; determining the initial priorities of the multiple processing nodes based on the first quantity of traffic of the target network element processed by each processing node in the current cycle, wherein the smaller the first quantity of traffic of the target network element processed by the processing node in the current cycle, the higher the corresponding initial priority; the larger the first quantity of traffic of the target network element processed by the processing node in the current cycle, the lower the corresponding initial priority; and sorting the initial priorities of the multiple processing nodes in descending order to obtain an initial priority sequence.
[0008] Optionally, the initial priority sequence is adjusted according to a preset priority adjustment rule to obtain a target priority sequence for multiple processing nodes to process the traffic of the target network element in the next cycle, including: determining the first processing node with the highest initial priority based on the initial priority sequence, and taking the initial priority of the first processing node as the target priority of the first processing node; organizing all second processing nodes except the first processing node in the multiple processing nodes into a first directed circle in order from high to low in terms of initial priority in a preset direction; keeping the position of each second processing node in the first directed circle unchanged, and assigning the initial priority corresponding to each second processing node to the next second processing node in a preset direction to obtain the target priority of each second processing node; and forming a target priority sequence for multiple processing nodes to process the traffic of the target network element in the next cycle by the target priorities of the first processing node and each second processing node.
[0009] Optionally, the initial priority sequence is adjusted according to a preset priority adjustment rule to obtain a target priority sequence for multiple processing nodes to process the traffic of the target network element in the next cycle. The method also includes: when at least one second processing node other than the first processing node with the highest initial priority among the multiple processing nodes fails, the initial priority of the first processing node is used as the target priority of the first processing node; all the second processing nodes among the multiple processing nodes except the first processing node and the failed second processing node are sequentially arranged in order from high to low in terms of initial priority to form a second directed circle in a preset direction; the position of each second processing node in the second directed circle is kept unchanged, the initial priority corresponding to each second processing node is sequentially assigned to the next second processing node in a preset direction, and the initial priority of the second processing node whose initial priority is higher than the initial priority of the failed second processing node is reduced by one level to obtain the target priority of each second processing node; the target priorities of the first processing node and each second processing node form a target priority sequence for multiple processing nodes to process the traffic of the target network element in the next cycle.
[0010] Optionally, the target processing node is the first processing node.
[0011] Optionally, the initial priority sequence is adjusted according to a preset priority adjustment rule to obtain a target priority sequence for multiple processing nodes to process the traffic of the target network element in the next cycle. The method also includes: in the event that a first processing node with the highest initial priority among the multiple processing nodes fails, the initial priorities of multiple second processing nodes other than the first processing node among the multiple processing nodes are reduced by one level, and a second target processing node with the highest initial priority among the multiple second processing nodes is determined, and the reduced initial priority of the second target processing node is used as the target priority of the second target processing node; all second processing nodes except the second target processing node among the multiple second processing nodes are sequentially arranged in order from high to low in terms of initial priority to form a third directed circle in a preset direction; the position of each second processing node in the third directed circle is kept unchanged, and the initial priority corresponding to each second processing node is sequentially assigned to the next second processing node in a preset direction to obtain the target priority of each second processing node; the target priorities of the second target processing node and each second processing node form a target priority sequence for multiple processing nodes to process the traffic of the target network element in the next cycle.
[0012] Optionally, the target processing node is a second target processing node.
[0013] According to another aspect of the embodiment of the present application, a traffic diversion device based on load balancing is also provided, which includes: an acquisition module, used to obtain an initial priority sequence corresponding to the traffic of target network elements processed by multiple processing nodes in the current cycle, wherein the initial priority sequence is obtained by arranging the initial priorities of the traffic of target network elements processed by each processing node in the current cycle in sequence from high to low; an adjustment module, used to adjust the initial priority sequence according to a preset priority adjustment rule, and obtain a target priority sequence for the traffic of target network elements processed by multiple processing nodes in the next cycle, wherein the first target priority in the target priority sequence is the same as the first initial priority in the initial priority sequence, the second target priority in the target priority sequence is the same as the last initial priority in the initial priority sequence, and the third target priority to the last target priority in the target priority sequence are the same as the second target priority to the second to last target priorities in the initial priority sequence; a sending module, used to send the target priority sequence to a routing device, wherein the routing device is used to route the traffic of the target network element in the next cycle to the corresponding target processing node according to the target priority sequence.
[0014] According to another aspect of an embodiment of the present application, a non-volatile storage medium is also provided, which includes a stored computer program, wherein the device where the non-volatile storage medium is located executes any one of the load balancing-based traffic diversion methods by running the computer program.
[0015] According to another aspect of an embodiment of the present application, a computer program product is also provided, which includes a stored computer program, wherein the computer program implements any one of the load balancing-based traffic diversion methods when executed by a processor.
[0016] In an embodiment of the present application, the load balancing controller adjusts the initial priority sequence corresponding to the traffic of the target network element processed by multiple processing nodes in the current cycle according to the preset priority adjustment rule, so as to obtain the target priority sequence of the traffic of the target network element processed by multiple processing nodes in the next cycle, wherein the first target priority in the target priority sequence is the same as the first initial priority in the initial priority sequence, the second target priority in the target priority sequence is the same as the last initial priority in the initial priority sequence, and the third target priority to the last target priority in the target priority sequence are the same as the second target priority to the last target priority in the initial priority sequence. The target priority sequence finally obtained can ensure that the system can still be in a load balancing state even if at least one processing node fails in the multiple processing nodes in the next cycle, so as to achieve the purpose of performing special load balancing processing on special business traffic in the cluster load balancing scenario, thereby solving the technical problem that the traffic load cannot be reasonably distributed when any processing node fails in multiple processing nodes in the related technology, resulting in load imbalance. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0018] Figure 1 It is a hardware structure block diagram of a computer terminal (or mobile device) for implementing a traffic diversion method based on load balancing according to an embodiment of the present application;
[0019] Figure 2 It is a schematic diagram of a process of an optional load balancing-based traffic diversion method according to an embodiment of the present application;
[0020] Figure 3 is a schematic diagram of an optional initial priority sequence of multiple nodes;
[0021] Figure 4is a schematic diagram of an optional initial priority sequence when node 1 fails;
[0022] Figure 5 It is an optional comparison diagram of the initial priority sequence and the target priority sequence of multiple nodes;
[0023] Figure 6 is a schematic diagram of an optional target priority sequence when node 1 fails;
[0024] Figure 7 is a schematic diagram of an optional target priority sequence when both node 1 and node 2 fail at the same time;
[0025] Figure 8 It is a structural schematic diagram of an optional traffic diversion device based on load balancing according to an embodiment of the present application;
[0026] Fig. 9 It is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0027] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0029] In addition, the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, data for analysis, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. For example, an interface is set up between this system and the relevant user or organization. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain relevant information after receiving the consent information fed back by the aforementioned user or organization.
[0030] In order to better understand the embodiments of the present application, the technical terms involved in the embodiments of the present application are explained as follows:
[0031] IWF (Customized-Inter Working Function): Traffic interworking gateway is a gateway device used for traffic interworking between different communication networks. It can solve the protocol differences between different networks, realize traffic conversion and transmission, and thus realize the interworking between different networks. It plays an important role in the field of mobile communications.
[0032] Example 1
[0033] According to an embodiment of the present application, a method embodiment of a traffic diversion method based on load balancing is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0034] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 The hardware structure block diagram of a computer terminal (or mobile device) for implementing a traffic diversion method based on load balancing is shown. Figure 1 As shown, the computer terminal 10 (or mobile device 10) may include one or more (102a, 102b, ..., 102n are used to illustrate) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1More or fewer components as shown, or with Figure 1 Different configurations shown.
[0035] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10 (or mobile device). As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).
[0036] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the load-balanced traffic diversion method in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, the load-balanced traffic diversion method of the above-mentioned application is realized. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0037] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0038] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 (or mobile device).
[0039] In the above operating environment, Figure 2 is a flow chart of an optional load balancing-based traffic diversion method according to an embodiment of the present application, such as Figure 2As shown, the method at least includes steps S202-S206, wherein:
[0040] Step S202, obtaining initial priority sequences corresponding to the traffic of the target network element processed by multiple processing nodes in the current cycle.
[0041] In the technical solution provided in step S202, the load balancing controller can obtain the initial priority sequence corresponding to the traffic of the target network element processed by multiple processing nodes in the current cycle, and the above-mentioned initial priority sequence can be arranged in order from large to small by the initial priorities corresponding to the traffic of the target network element processed by each processing node in the current cycle (i.e., a period of time). Among them, the target network element (i.e., 5G network element) can also be a new wireless (New Radio, NR) system or NR network, and the processing node can be a node set by the load balancing controller for the target network element to provide traffic proxy services, so each processing node corresponds to a proxy service IP address.
[0042] Step S204, adjusting the initial priority sequence according to a preset priority adjustment rule to obtain a target priority sequence for multiple processing nodes to process traffic of a target network element in the next cycle.
[0043] In the technical solution provided in step S204, the above-mentioned target priority sequence can also be formed by arranging the initial priorities corresponding to the traffic of each processing node processing the target network element in the next cycle (i.e., the next period of time after the current cycle, whose time length is the same as the time length of the current cycle) in order from large to small. The relationship between the above-mentioned initial priority sequence and the target priority sequence is: the first target priority in the target priority sequence is the same as the first initial priority in the initial priority sequence, the second target priority in the target priority sequence is the same as the last initial priority in the initial priority sequence, and the third target priority to the last target priority in the target priority sequence is the same as the second target priority to the second to last target priority in the initial priority sequence.
[0044] Step S206: Send the target priority sequence to the routing device.
[0045] In the technical solution provided in step S206, the above-mentioned routing device and the load balancing controller can establish a BGP (Border Gateway Protocol) neighbor (i.e., two BGP routers that exchange routing information with each other). Therefore, the load balancing controller can send the target priority sequence to the routing device, and after obtaining the target priority, the routing device can, when receiving the traffic of the target network element in the next cycle, route the traffic in the next cycle to the corresponding target processing node according to the target priority sequence, thereby achieving a load balancing effect.
[0046] The above method of this embodiment is further introduced below.
[0047] As an optional implementation, in the technical solution provided in the above step S202, the load balancing controller may obtain the initial priority sequence according to the following method, including:
[0048] Step S2021, obtaining a first quantity of traffic of a target network element processed by each processing node in a current cycle;
[0049] Step S2022, determining initial priorities of the plurality of processing nodes based on a first quantity of traffic of the target network element processed by each processing node in the current cycle;
[0050] Step S2023, sorting the initial priorities of the multiple processing nodes in descending order to obtain an initial priority sequence.
[0051] According to the technical solution provided by the above steps S2021-S2023, it is not difficult to see that the load balancing controller determines the priority of each processing node according to the minimum flow connection number algorithm. Therefore, the smaller the first number of flows of the target network element processed by the processing node in the current cycle, the higher the corresponding initial priority; the more the first number of flows of the target network element processed by the processing node in the current cycle, the lower the corresponding initial priority.
[0052] It should be noted that in actual application scenarios, in addition to obtaining the above-mentioned initial priority sequence through the above-mentioned steps S2021-S2023, priority determination based on traffic service requirements can also be used, that is, determining the initial priority according to the importance of different traffic services, etc., which will not be elaborated here.
[0053] As an optional implementation, in the technical solution provided in the above step S204, when the multiple processing nodes are in a normal state, the load balancing controller can adjust the initial priority sequence according to the following method to obtain the target priority sequence, including:
[0054] Step 1: determining a first processing node with the highest initial priority based on the initial priority sequence, and using the initial priority of the first processing node as the target priority of the first processing node;
[0055] Step 2: In descending order of initial priorities, all second processing nodes except the first processing node in the plurality of processing nodes are sequentially grouped into a first directed circle according to a preset direction;
[0056] Step 3: Keep the position of each second processing node in the first directed circle unchanged, and assign the initial priority corresponding to each second processing node to the next second processing node in sequence according to the preset direction to obtain the target priority of each second processing node;
[0057] Step 4: The target priorities of the first processing node and each second processing node form a target priority sequence for the multiple processing nodes to process the traffic of the target network element in the next cycle.
[0058] The priority adjustment rules provided in the above steps are explained below through the following example.
[0059] Assume that the processing system for processing the signaling traffic of the 5G network element includes four processing nodes, namely node 1, node 2, node 3, and node 4, and in three cycles (first cycle: Flow1, Flow2, Flow3, Flow4, second cycle: Flow5, Flow6, Flow7, Flow8, third cycle: Flow9, Flow10, Flow11, Flow12), the four processing nodes all process the signaling traffic of the 5G network element according to the following initial priority sequence: the initial priority sequence of Flow1 in the first cycle, Flow5 in the second cycle, and Flow9 in the third cycle is {1,2,3,4}; the initial priority sequence of Flow2 in the first cycle, Flow6 in the second cycle, and Flow10 in the third cycle is {4,1,2,3}; the initial priority sequence of Flow3 in the first cycle, Flow7 in the second cycle, and Flow11 in the third cycle is {3,4,1,2}; the initial priority sequence of Flow4 in the first cycle, Flow8 in the second cycle, and Flow12 in the third cycle is {2,3,4,1}, as shown in the following figure. Figure 3 , the current load balancing result of the processing system is 4:4:4:4. The larger the numerical value, the lower the priority; the smaller the numerical value, the higher the priority, and the processing node with the highest priority is the main processing node, and the remaining processing nodes are backup processing nodes.
[0060] However, according to this priority setting method, once any of the four nodes fails, load imbalance will occur. For example, when processing node 1 fails, all flows that choose node 1 as the main processing node need to select the processing node with the highest priority from the backup processing nodes for processing. In this way, the load balancing result of the entire processing system is as follows: Figure 4 As shown, the load balancing result is 6:3:3, that is, the system is in a load imbalance state.
[0061] The load balancing controller adjusts the priority according to the priority adjustment rules provided in the above four steps provided in the embodiment of the present application. Figure 3 As shown (i.e. Figure 5 If the initial priority sequence of Flow1, Flow2, Flow3, and Flow4 in the first cycle is adjusted, the priority sequences of Flow5, Flow6, Flow7, and Flow8 in the second cycle can be set to {1,4,2,3}, {3,1,4,2}, {2,3,1,4}, {4,2,3,1} respectively, according to their respective priority sequences: {1,2,3,4}, {4,1,2,3}, {3,4,1,2}, {2,3,4,1}; and the priority sequences of Flow5, Flow6, Flow7, and Flow8 in the third cycle can be set to {1,3,4,2}, {2,1,3,4}, {4,2,1,3}, {3,4,2,1} respectively, as shown in the following figure. Figure 5 As shown in the right figure. Figure 5 It is not difficult to see from Flow5 in the left and right figures that the priority adjustment rule provided in the embodiment of the present application is to first ensure that the initial priority of node 1 remains unchanged, and then shift the priority sequence {2,3,4} of the remaining nodes 2, 3, and 4 to the right, and assign them to the next node in turn (sort the initial priority in order from high to low, and form a directed circle with the remaining nodes 2, 3, and 4 in a clockwise or counterclockwise direction, keeping the positions of nodes 2, 3, and 4 in the directed circle unchanged, and assign the initial priorities {2,3,4} corresponding to nodes 2, 3, and 4 in a clockwise or counterclockwise direction to the next node in turn), and obtain the target priority sequence of {1,4,2,3}. Similarly, through the above Figure 5It is not difficult to see from Flow9 in the left and right figures that the priority adjustment rule provided in the embodiment of the present application is to first ensure that the initial priority of node 1 remains unchanged, and then, shift the priority sequence {4,2,3} of the remaining nodes 2, 3, and 4 to the right, and assign them to the next node in turn (sort the initial priority in order from high to low, and form a directed circle with the remaining nodes 2, 3, and 4 in a clockwise or counterclockwise direction, keep the positions of nodes 2, 3, and 4 in the directed circle unchanged, and assign the initial priorities {4,2,3} corresponding to nodes 2, 3, and 4 to the next node in a clockwise or counterclockwise direction), and the target priority sequence is {1,3,4,2}.
[0062] According to the target priority sequence of the processing system obtained above, when node 1 fails, all flows that select node 1 as the main processing node need to select the processing node with the highest priority from the backup processing nodes for processing. In this way, the load balancing result of the entire processing system is as follows: Figure 6 As shown, the load balancing result is 3:3:3, that is, the system is in a load balancing state.
[0063] As another optional implementation, in the technical solution provided in the above step S204, when at least one second processing node other than the first processing node with the highest initial priority among the multiple processing nodes is in an abnormal state, the load balancing controller may adjust the initial priority sequence according to the following method to obtain a target priority sequence, including:
[0064] Step 1: taking the initial priority of the first processing node as the target priority of the first processing node;
[0065] Step 2: All second processing nodes except the first processing node and the second processing node with a fault in the plurality of processing nodes are sequentially grouped into a second directed circle in a preset direction according to the order of initial priorities from high to low;
[0066] Step 3: Keep the position of each second processing node in the second directed circle unchanged, assign the initial priority corresponding to each second processing node to the next second processing node in sequence according to the preset direction, and reduce the initial priority of the second processing node whose initial priority is higher than the initial priority of the second processing node with the fault by one level, so as to obtain the target priority of each second processing node;
[0067] Step 4: The target priority sequence for the multiple processing nodes to process the traffic of the target network element in the next cycle is formed by the target priority of the first processing node and the target priorities of all the second processing nodes except the first processing node and the failed second processing node.
[0068] The priority adjustment rules provided in the above steps are explained below through the following example.
[0069] by Figure 6 Taking the priority sequence of the system shown as an example, if node 1 (priority 3) in Flow6 fails, the load balancing controller adjusts the priority sequence of the remaining nodes according to the priority adjustment rules provided in the above four steps provided in the embodiment of the present application, and the original sequence {4,2,3} can be adjusted to {2,1,3}. If node 1 (priority 4) in Flow8 fails, the load balancing controller adjusts the priority sequence of the remaining nodes according to the priority adjustment rules provided in the above four steps provided in the embodiment of the present application, and the original sequence {2,3,1} can be adjusted to {3,2,1}.
[0070] It should be noted that when the target priority sequence adjusted when the above-mentioned multiple processing nodes are in a normal state and at least one second processing node among the multiple processing nodes except the first processing node with the highest initial priority is in an abnormal state is sent to the routing device, when the routing device receives the traffic of the target network element in the next cycle, it can route the traffic of the target network element to the first processing node with the highest priority according to the target priority sequence.
[0071] As another optional implementation, in the technical solution provided in the above step S204, when the first processing node with the highest initial priority among the multiple processing nodes is in an abnormal state, the load balancing controller can adjust the initial priority sequence according to the following method to obtain the target priority sequence, including:
[0072] Step 1: lowering the initial priorities of multiple second processing nodes except the first processing node among the multiple processing nodes by one level, determining a second target processing node with the highest initial priority among the multiple second processing nodes, and using the lowered initial priority of the second target processing node as the target priority of the second target processing node;
[0073] Step 2: All the second processing nodes except the second target processing node in the plurality of second processing nodes are sequentially grouped into a third directed circle according to a preset direction in the order of initial priorities from high to low;
[0074] Step 3: Keep the position of each second processing node in the third directed circle unchanged, and assign the initial priority corresponding to each second processing node to the next second processing node in sequence according to the preset direction to obtain the target priority of each second processing node;
[0075] Step 4: The second target processing nodes and the target priorities of the second processing nodes form a target priority sequence for the multiple processing nodes to process the traffic of the target network element in the next cycle.
[0076] The priority adjustment rules provided in the above steps are explained below through the following example.
[0077] by Figure 6 Taking the priority sequence of the system shown as an example, if node 1 (priority 1) in Flow5 fails, the load balancing controller adjusts the priority sequence of the remaining nodes according to the priority adjustment rules provided in the above four steps provided in the embodiment of the present application, and the original priority sequence {4,2,4} can be adjusted to {2,1,3}. If node 1 (priority 1) in Flow9 fails, the load balancing controller adjusts the priority sequence of the remaining nodes according to the priority adjustment rules provided in the above four steps provided in the embodiment of the present application, and the original priority sequence {3,4,2} can be adjusted to {2,3,1}.
[0078] It should be noted that when the target priority sequence adjusted when the first processing node with the highest initial priority among the above-mentioned multiple processing nodes is in an abnormal state is sent to the routing device, when the routing device receives the traffic of the target network element in the next cycle, it can route the traffic of the target network element to the second target processing node with the highest priority according to the target priority sequence.
[0079] For example, Figure 7 It is a schematic diagram of the target priority sequence adjusted according to the above-mentioned multiple processing nodes except the first processing node with the highest initial priority being in an abnormal state, and at least one second processing node other than the first processing node with the highest initial priority being in an abnormal state. It is not difficult to see that when two nodes (node 1 and node 2) among the four nodes fail, the load balancing result of the processing system is 6:6, and the processing system is still in a load-balanced state. If the priority adjustment rule of the embodiment of the present application is not used to adjust the initial priority sequence of the processing system, the load balancing result of the entire processing system will be 7:5, and the processing system is still in a load-unbalanced state.
[0080] Based on the scheme defined in the above steps S202 to S206, it can be known that in an embodiment, the load balancing controller adjusts the initial priority sequence corresponding to the traffic of the target network element processed by multiple processing nodes in the current cycle according to the preset priority adjustment rule, so as to obtain the target priority sequence of the traffic of the target network element processed by multiple processing nodes in the next cycle, wherein the first target priority in the target priority sequence is the same as the first initial priority in the initial priority sequence, the second target priority in the target priority sequence is the same as the last initial priority in the initial priority sequence, and the third target priority to the last target priority in the target priority sequence is the same as the second target priority to the last target priority in the initial priority sequence. The target priority sequence finally obtained can ensure that even if at least one processing node fails in the multiple processing nodes in the next cycle, the system can still be in a load balancing state, so as to achieve the purpose of performing special load balancing processing on special traffic of the service in the cluster load balancing scenario, thereby solving the technical problem that the traffic load cannot be reasonably distributed when any processing node fails in multiple processing nodes in the related technology, resulting in load imbalance.
[0081] Example 2
[0082] Based on Embodiment 1 of the present application, an embodiment of a traffic diversion device based on load balancing is also provided, and when the device is running, the traffic diversion method based on load balancing of the above embodiment is executed. Figure 8 is a schematic diagram of the structure of an optional traffic diversion device based on load balancing according to an embodiment of the present application, such as Figure 8 As shown, the traffic distribution device based on load balancing includes at least an acquisition module 82, an adjustment module 84 and a sending module 86, wherein:
[0083] The acquisition module 82 is used to acquire the initial priority sequence corresponding to the traffic of the target network element processed by multiple processing nodes in the current cycle.
[0084] The above initial priority sequence is obtained by arranging the initial priorities of the traffic of the target network element processed by each processing node in the current cycle in order from high to low;
[0085] The adjustment module 84 is used to adjust the initial priority sequence according to a preset priority adjustment rule to obtain a target priority sequence for multiple processing nodes to process traffic of the target network element in the next cycle.
[0086] Among them, the first target priority in the target priority sequence is the same as the first initial priority in the initial priority sequence, the second target priority in the target priority sequence is the same as the last initial priority in the initial priority sequence, and the third target priority to the last target priority in the target priority sequence are the same as the second target priority to the second to last target priorities in the initial priority sequence.
[0087] The sending module 86 is used to send the target priority sequence to the routing device.
[0088] The above-mentioned routing device is used to route the traffic of the target network element in the next cycle to the corresponding target processing node according to the target priority sequence.
[0089] It should be noted that the various modules in the above-mentioned traffic diversion device can be program modules (for example, a set of program instructions that implement a certain specific function) or hardware modules. For the latter, it can be expressed in the following forms, but is not limited to this: the expression form of each of the above-mentioned modules is a processor, or the functions of each of the above-mentioned modules are implemented by a processor.
[0090] Example 3
[0091] According to an embodiment of the present application, a non-volatile storage medium is also provided, in which a program is stored, wherein when the program is running, the device where the non-volatile storage medium is located is controlled to execute the load balancing-based traffic diversion method in Example 1.
[0092] Optionally, the device where the non-volatile storage medium is located implements the following steps by running the program: obtaining an initial priority sequence corresponding to multiple processing nodes processing the traffic of the target network element in the current cycle, wherein the initial priority sequence is obtained by arranging the initial priorities of each processing node in processing the traffic of the target network element in the current cycle in order from high to low; adjusting the initial priority sequence according to a preset priority adjustment rule to obtain a target priority sequence for multiple processing nodes to process the traffic of the target network element in the next cycle, wherein the first target priority in the target priority sequence is the same as the first initial priority in the initial priority sequence, the second target priority in the target priority sequence is the same as the last initial priority in the initial priority sequence, and the third target priority to the last target priority in the target priority sequence are the same as the second target priority to the second to last target priorities in the initial priority sequence; sending the target priority sequence to a routing device, wherein the routing device is used to route the traffic of the target network element in the next cycle to the corresponding target processing node according to the target priority sequence.
[0093] According to an embodiment of the present application, a computer program product is also provided, which includes a stored computer program, wherein when the computer program is executed by a processor, the load balancing-based traffic diversion method in Example 1 is implemented.
[0094] Optionally, the computer program executes the following steps: obtaining an initial priority sequence corresponding to multiple processing nodes processing traffic of a target network element in a current cycle, wherein the initial priority sequence is obtained by arranging the initial priorities of each processing node in processing traffic of the target network element in the current cycle in order from high to low; adjusting the initial priority sequence according to a preset priority adjustment rule to obtain a target priority sequence for multiple processing nodes to process traffic of the target network element in the next cycle, wherein the first target priority in the target priority sequence is the same as the first initial priority in the initial priority sequence, the second target priority in the target priority sequence is the same as the last initial priority in the initial priority sequence, and the third target priority to the last target priority in the target priority sequence are the same as the second target priority to the second to the last target priority in the initial priority sequence; sending the target priority sequence to a routing device, wherein the routing device is used to route the traffic of the target network element in the next cycle to the corresponding target processing node according to the target priority sequence.
[0095] According to an embodiment of the present application, a processor is also provided, which is used to run a program, wherein the load balancing-based traffic diversion method in Example 1 is executed when the program is running.
[0096] Optionally, the following steps are executed when the program is running: obtaining an initial priority sequence corresponding to multiple processing nodes processing the traffic of the target network element in the current cycle, wherein the initial priority sequence is obtained by arranging the initial priorities of each processing node in processing the traffic of the target network element in the current cycle in order from high to low; adjusting the initial priority sequence according to a preset priority adjustment rule to obtain a target priority sequence for multiple processing nodes to process the traffic of the target network element in the next cycle, wherein the first target priority in the target priority sequence is the same as the first initial priority in the initial priority sequence, the second target priority in the target priority sequence is the same as the last initial priority in the initial priority sequence, and the third target priority to the last target priority in the target priority sequence are the same as the second target priority to the second to last target priorities in the initial priority sequence; sending the target priority sequence to a routing device, wherein the routing device is used to route the traffic of the target network element in the next cycle to the corresponding target processing node according to the target priority sequence.
[0097] According to an embodiment of the present application, an electronic device is also provided, wherein: Fig. 9 is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present application, such as Fig. 9 As shown, the electronic device includes one or more processors; a memory for storing one or more programs, which, when the one or more programs are executed by the one or more processors, enables the one or more processors to run the programs, wherein the programs are configured to execute the load balancing-based traffic diversion method in the above-mentioned embodiment 1 when running.
[0098] Optionally, the processor is configured to execute the following steps through a computer program: obtaining an initial priority sequence corresponding to multiple processing nodes processing the traffic of the target network element in the current cycle, wherein the initial priority sequence is obtained by arranging the initial priorities of each processing node in processing the traffic of the target network element in the current cycle in order from high to low; adjusting the initial priority sequence according to a preset priority adjustment rule to obtain a target priority sequence for multiple processing nodes to process the traffic of the target network element in the next cycle, wherein the first target priority in the target priority sequence is the same as the first initial priority in the initial priority sequence, the second target priority in the target priority sequence is the same as the last initial priority in the initial priority sequence, and the third target priority to the last target priority in the target priority sequence are the same as the second target priority to the second to last target priorities in the initial priority sequence; sending the target priority sequence to a routing device, wherein the routing device is used to route the traffic of the target network element in the next cycle to the corresponding target processing node according to the target priority sequence.
[0099] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0100] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0101] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0102] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed over multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0103] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0104] If the integrated unit 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 application, or the part that contributes to the relevant technology or all or part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes 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 each embodiment method of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk, etc. Various media that can store program codes.
[0105] The above are only preferred implementations of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A traffic diversion method based on load balancing, characterized in that: include: Acquire an initial priority sequence corresponding to the traffic of the target network element processed by the multiple processing nodes in the current cycle, wherein the initial priority sequence is obtained by arranging the initial priorities of the traffic of the target network element processed by each processing node in the current cycle in order from high to low; The initial priority sequence is adjusted according to a preset priority adjustment rule to obtain a target priority sequence for the multiple processing nodes to process the traffic of the target network element in the next cycle, wherein the first target priority in the target priority sequence is the same as the first initial priority in the initial priority sequence, the second target priority in the target priority sequence is the same as the last initial priority in the initial priority sequence, and the third target priority to the last target priority in the target priority sequence are the same as the second target priority to the last target priority in the initial priority sequence; The target priority sequence is sent to a routing device, wherein the routing device is used to route the traffic of the target network element in the next cycle to a corresponding target processing node according to the target priority sequence.
2. The method according to claim 1, characterized in that Obtaining the initial priority sequence corresponding to the traffic of the target network element processed by multiple processing nodes in the current cycle, including: Acquire a first quantity of traffic of a target network element processed by each of the processing nodes in a current cycle; Determine the initial priorities of the multiple processing nodes based on the first quantity of traffic of the target network element processed by each of the processing nodes in the current cycle, wherein the smaller the first quantity of traffic of the target network element processed by the processing node in the current cycle, the higher the corresponding initial priority; the larger the first quantity of traffic of the target network element processed by the processing node in the current cycle, the lower the corresponding initial priority; The initial priorities of the multiple processing nodes are sorted in descending order to obtain the initial priority sequence.
3. The method according to claim 1, characterized in that The initial priority sequence is adjusted according to a preset priority adjustment rule to obtain a target priority sequence for the multiple processing nodes to process traffic of the target network element in the next cycle, including: Determine a first processing node with the highest initial priority based on the initial priority sequence, and use the initial priority of the first processing node as the target priority of the first processing node; All second processing nodes except the first processing node in the plurality of processing nodes are sequentially grouped into a first directed circle according to a preset direction in a descending order of initial priorities; Keeping the position of each second processing node in the first directed circle unchanged, assigning the initial priority corresponding to each second processing node to the next second processing node in sequence according to a preset direction, so as to obtain the target priority of each second processing node; The target priorities of the first processing node and each of the second processing nodes constitute a target priority sequence for the multiple processing nodes to process traffic of the target network element in the next cycle.
4. The method according to claim 1, characterized in that: The initial priority sequence is adjusted according to a preset priority adjustment rule to obtain a target priority sequence for the multiple processing nodes to process traffic of the target network element in the next cycle, and the method further includes: In the event that at least one second processing node other than a first processing node with the highest initial priority among the plurality of processing nodes fails, using the initial priority of the first processing node as a target priority of the first processing node; All second processing nodes except the first processing node and the second processing node having a fault in the plurality of processing nodes are sequentially grouped into a second directed circle in a preset direction according to the order of initial priorities from high to low; Keeping the position of each second processing node in the second directed circle unchanged, assigning the initial priority corresponding to each second processing node to the next second processing node in sequence according to the preset direction, and reducing the initial priority of the second processing node whose initial priority is higher than the initial priority of the second processing node that fails by one level, so as to obtain the target priority of each second processing node; The target priorities of the first processing node and each of the second processing nodes constitute a target priority sequence for the multiple processing nodes to process traffic of the target network element in the next cycle.
5. The method according to claim 3 or 4, characterized in that: The target processing node is the first processing node.
6. The method according to claim 1, characterized in that The initial priority sequence is adjusted according to a preset priority adjustment rule to obtain a target priority sequence for the multiple processing nodes to process traffic of the target network element in the next cycle, and the method further includes: In the event that a first processing node with the highest initial priority among the plurality of processing nodes fails, the initial priorities of a plurality of second processing nodes other than the first processing node among the plurality of processing nodes are reduced by one level, and a second target processing node with the highest initial priority among the plurality of second processing nodes is determined, and the reduced initial priority of the second target processing node is used as the target priority of the second target processing node; All the second processing nodes except the second target processing node in the plurality of second processing nodes are sequentially grouped into a third directed circle according to a preset direction in the order of initial priorities from high to low; Keeping the position of each second processing node in the third directed circle unchanged, assigning the initial priority corresponding to each second processing node to the next second processing node in sequence according to the preset direction, so as to obtain the target priority of each second processing node; The second target processing nodes and the target priorities of the respective second processing nodes constitute a target priority sequence for the multiple processing nodes to process traffic of the target network elements in the next cycle.
7. The method according to claim 6, characterized in that The target processing node is the second target processing node.
8. A traffic diversion device based on load balancing, characterized in that: include: An acquisition module, used to acquire an initial priority sequence corresponding to traffic of a target network element processed by multiple processing nodes in a current cycle, wherein the initial priority sequence is obtained by arranging the initial priorities of the traffic of the target network element processed by each processing node in the current cycle in order from high to low; An adjustment module, used for adjusting the initial priority sequence according to a preset priority adjustment rule to obtain a target priority sequence for the multiple processing nodes to process the traffic of the target network element in the next cycle, wherein the first target priority in the target priority sequence is the same as the first initial priority in the initial priority sequence, the second target priority in the target priority sequence is the same as the last initial priority in the initial priority sequence, and the third target priority to the last target priority in the target priority sequence are the same as the second target priority to the last target priority in the initial priority sequence; A sending module is used to send the target priority sequence to a routing device, wherein the routing device is used to route the traffic of the target network element in the next cycle to the corresponding target processing node according to the target priority sequence.
9. A non-volatile storage medium, characterized in that: The non-volatile storage medium stores a computer program, wherein the device where the non-volatile storage medium is located executes the load balancing-based traffic diversion method described in any one of claims 1 to 7 by running the computer program.
10. A computer program product, characterized in that include: A computer program, wherein when the computer program is executed by a processor, it implements the load balancing-based traffic diversion method described in any one of claims 1 to 7.
