Load balancing method and device, computer equipment and readable storage medium
By receiving and processing data flow in the switch, determining the target load balancing server, and forwarding the data flow to the server, the problem of high load balancing implementation in traditional technology is solved, and efficient load balancing effect is achieved without additional hardware.
Patent Information
- Application Number
- CN202411721832.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2044-11-28
AI Technical Summary
In traditional technology, the implementation cost of load balancing in data centers is high, mainly due to the need to add additional hardware load balancing equipment.
By receiving data streams from different clients in the switch and obtaining five-tuple information of data streams for each client, the target load balancing server corresponding to the data stream of each client is determined, and the data stream is forwarded to the target server. The target server then determines the target application server corresponding to the received data flow through the pre-trained neural network model, and forwards the data flow to the application server for processing.
The load balancing of data flow is realized without the need for additional hardware load balancing equipment, thereby reducing the load balancing implementation cost.
Smart Images

Figure CN119544714A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a load balancing method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art
[0002] With the development of mobile Internet, the traffic in data centers has shown explosive growth, and data centers generally have large-scale concurrent business scenarios, so load balancing is required within them.
[0003] In traditional technology, when performing load balancing processing, it is generally achieved by adding additional hardware load balancing devices and using the hardware load balancing devices to achieve load balancing within the data center; however, the cost of hardware load balancing devices is high, resulting in a high cost for load balancing implementation. Summary of the invention
[0004] Based on this, it is necessary to provide a load balancing method, apparatus, computer device, computer readable storage medium and computer program product that can reduce the cost of implementing load balancing in order to address the above technical problems.
[0005] In a first aspect, the present application provides a load balancing method, applied to a switch, comprising:
[0006] Receive data streams sent by different clients;
[0007] Get the five-tuple information of each client's data stream;
[0008] Determine the target load balancing server corresponding to the data flow of each client according to the quintuple information of the data flow of each client;
[0009] The data stream of each client is forwarded to the corresponding target load balancing server; each target load balancing server is used to determine the target application server corresponding to the received data stream, and forward the received data stream to the corresponding target application server for processing.
[0010] In one embodiment, determining the target load balancing server corresponding to the data flow of each client according to the quintuple information of the data flow of each client includes:
[0011] Calculate the hash value of the data stream of each client according to the five-tuple information of the data stream of each client;
[0012] From the load balancing server list, a load balancing server associated with the hash value of the data flow of each client is screened out as a target load balancing server corresponding to the data flow of each client.
[0013] In one embodiment, the step of selecting a load balancing server associated with a hash value of the data flow of each client from a list of load balancing servers as a target load balancing server corresponding to the data flow of each client includes:
[0014] When it is detected that the number of the clients is greater than the number of the load balancing servers in the load balancing server list, obtaining an expanded load balancing server list of the load balancing server list;
[0015] From the expanded load balancing server list, a load balancing server associated with the hash value of the data flow of each client is screened out as a target load balancing server corresponding to the data flow of each client.
[0016] In one embodiment, the method further comprises:
[0017] In the case of detecting that the switch and the target load balancing server corresponding to the data flow of the target client fail to communicate, re-determining the target load balancing server corresponding to the data flow of the target client; the target client is one of the different clients;
[0018] The data stream of the target client is forwarded to the re-determined target load balancing server.
[0019] In one embodiment, re-determining the target load balancing server corresponding to the data flow of the target client includes:
[0020] Deleting the target load balancing server corresponding to the data flow of the target client from the load balancing server list to obtain an updated load balancing server list;
[0021] From the updated load balancing server list, a load balancing server associated with the hash value of the data flow of the target client is screened out as the re-determined target load balancing server.
[0022] In one embodiment, forwarding the data stream of each client to the corresponding target load balancing server includes:
[0023] The data stream of each client is forwarded to the corresponding target load balancing server, so that each target load balancing server determines the target application server corresponding to the received data stream through a pre-trained neural network model, and forwards the received data stream to the corresponding target application server for processing through the corresponding current gateway. In the event of a failure of the current gateway, the received data stream is forwarded to the corresponding target application server for processing through an equivalent gateway of the current gateway.
[0024] In one of the embodiments, the load balancing server list corresponding to the switch includes multiple load balancing servers, the multiple load balancing servers are used to publish the same public network IP to the unstacked switch, and there are multiple equal-cost routes between the switch and the multiple load balancing servers;
[0025] The step of determining, according to the five-tuple information of the data stream of each client, a target load balancing server corresponding to the data stream of each client comprises:
[0026] For the data flow of each client, according to the border gateway protocol routing principle and the five-tuple information of the data flow of each client, select a target route from multiple equal-cost routes between the switch and the multiple load balancing servers;
[0027] The load balancing server associated with the target route selected for the data flow of each client is respectively used as the target load balancing server corresponding to the data flow of each client.
[0028] In a second aspect, the present application also provides a load balancing device, including:
[0029] A data receiving module, used to receive data streams sent by different clients;
[0030] An information acquisition module, used to obtain the five-tuple information of the data stream of each client;
[0031] A device determination module, used to determine a target load balancing server corresponding to the data flow of each client according to the five-tuple information of the data flow of each client;
[0032] The data forwarding module is used to forward the data stream of each client to the corresponding target load balancing server; each target load balancing server is used to determine the target application server corresponding to the received data stream, and forward the received data stream to the corresponding target application server for processing.
[0033] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0034] Receive data streams sent by different clients;
[0035] Get the five-tuple information of each client's data stream;
[0036] Determine the target load balancing server corresponding to the data flow of each client according to the quintuple information of the data flow of each client;
[0037] The data stream of each client is forwarded to the corresponding target load balancing server; each target load balancing server is used to determine the target application server corresponding to the received data stream, and forward the received data stream to the corresponding target application server for processing.
[0038] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:
[0039] Receive data streams sent by different clients;
[0040] Get the five-tuple information of each client's data stream;
[0041] Determine the target load balancing server corresponding to the data flow of each client according to the quintuple information of the data flow of each client;
[0042] The data stream of each client is forwarded to the corresponding target load balancing server; each target load balancing server is used to determine the target application server corresponding to the received data stream, and forward the received data stream to the corresponding target application server for processing.
[0043] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0044] Receive data streams sent by different clients;
[0045] Get the five-tuple information of each client's data stream;
[0046] Determine the target load balancing server corresponding to the data flow of each client according to the quintuple information of the data flow of each client;
[0047] The data stream of each client is forwarded to the corresponding target load balancing server; each target load balancing server is used to determine the target application server corresponding to the received data stream, and forward the received data stream to the corresponding target application server for processing.
[0048] The above-mentioned load balancing method, apparatus, computer equipment, computer-readable storage medium and computer program product receive data streams sent by different clients through a switch, and obtain the five-tuple information of the data stream of each client, then determine the target load balancing server corresponding to the data stream of each client according to the five-tuple information of the data stream of each client, and forward the data stream of each client to the corresponding target load balancing server; each target load balancing server first determines the target application server corresponding to the received data stream, and then forwards the received data stream to the corresponding target application server for processing. In this way, in a network architecture composed of switches and load balancing servers, the data stream of each client is forwarded to the corresponding target load balancing server through the switch, and the received data stream is forwarded to the corresponding target application server for processing through each target load balancing server, so that load balancing of the data stream can be achieved without adding additional hardware load balancing equipment, thereby reducing the cost of load balancing implementation. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0050] Figure 1 An application environment diagram of a load balancing method in an embodiment;
[0051] Figure 2 A schematic diagram of a load balancing method in one embodiment;
[0052] Figure 3 A schematic flow chart of the steps of determining a target load balancing server corresponding to a data flow of each client in an embodiment;
[0053] Figure 4 is a flow chart of a load balancing method in another embodiment;
[0054] Figure 5 A schematic diagram of a switch stack architecture in one embodiment;
[0055] Figure 6A schematic diagram of a switch stacking architecture in one embodiment;
[0056] Figure 7 A schematic diagram of downlink traffic load balancing in one embodiment;
[0057] Figure 8 A schematic diagram of uplink traffic load balancing in one embodiment;
[0058] Fig. 9 is a structural block diagram of a load balancing device in one embodiment;
[0059] Fig.10 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0060] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application 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 application and are not used to limit the present application.
[0061] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0062] With the development of mobile Internet, especially the popularization of short video applications, traditional IDC (Internet Data Center) is facing the test of explosive growth of north-south traffic. Correspondingly, the surge in north-south traffic has also introduced problems such as sudden increase in east-west traffic and data persistence within IDC. Large traffic, high concurrency, massive data storage and frequent access are severe challenges faced by Internet companies in the new situation, and the 7×24H continuity of services has increased the complexity of the challenges. To meet these challenges, most Internet companies will adopt a distributed architecture, split the business and deploy it on a sufficient number of servers, and use decentralized "points" to divert requests and concurrency, and achieve the purpose of multi-point redundant backup. Since the business requires a unified entrance, in the above distributed business deployment scenario, it is necessary to add a load balancing device in front of the business cluster to provide a unified entrance to users externally and distribute business requests to the backend server internally.
[0063] Load balancing within a data center is generally implemented by hardware load balancing devices or load balancing software (LVS, Nginx, Haproxy). The implementation method using hardware load balancing devices is simple and has good forwarding performance, but there are problems such as high construction cost and poor elasticity and scalability, and it is rarely used in large-scale cluster scenarios. Common software load balancing implementation methods have problems such as low forwarding performance, single point failure and poor horizontal scalability; GSLB (Global Server LoadBalance) combined with software load balancing solutions can solve the problem of single point failure of servers, but GSLB scheduling control delays, slow DNS (Domain Name System) cache updates during failures, poor scalability of load balancing servers, and stacked upstream switches still have logical single point failure problems. In the existing data center load balancing technology, there is a lack of an implementation method in which both servers and network devices have high reliability, simple network architecture, efficient forwarding, and flexible horizontal expansion. Based on this, the present application proposes a new load balancing method.
[0064] The load balancing method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the switch 101 communicates with the load balancing server 102 through the network, the load balancing server 102 communicates with the application server 103 through the network, and the number of switches 101, load balancing servers 102, and application servers 103 is multiple. Specifically, refer to Figure 1 For a single switch, the switch 101 receives data streams sent by different clients, obtains the five-tuple information of the data stream of each client, and then determines the target load balancing server 102 corresponding to the data stream of each client according to the five-tuple information of the data stream of each client, and finally forwards the data stream of each client to the corresponding target load balancing server 102. Each target load balancing server 102 is used to determine the target application server 103 corresponding to the received data stream, and forward the received data stream to the corresponding target application server 103 for processing. Among them, the switch 101 refers to a device that completes the information exchange function in the communication system; the load balancing server 102 refers to a server that realizes the load balancing function, and the application server 103 refers to a server that processes the data stream sent by the client; the load balancing server 102 and the application server 103 can be independent physical servers, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services.
[0065] In addition, in order to more clearly illustrate the load balancing method provided in the embodiment of the present application, some terms are explained as follows:
[0066] Switch stacking: Multiple switches that support stacking are connected together through stacking cables, logically virtualizing them into a switching device that participates in data forwarding as a whole.
[0067] BGP (Border Gateway Protocol): Border Gateway Protocol, a routing protocol running between autonomous systems, mainly responsible for exchanging inter-domain routing protocols.
[0068] iBGP (Internel BGP): Internal Border Gateway Protocol. If two routers are located in the same autonomous system (same AS), their neighbor relationship is an iBGP neighbor relationship.
[0069] eBGP: External Border Gateway Protocol. If two routers are located in different autonomous systems (different ASs), their neighbor relationship is an eBGP neighbor relationship.
[0070] IGP (Interior Gateway Protocol): Interior Gateway Protocol, whose main function is to discover and calculate routing information within an autonomous domain, including RIP, OSPF, IS-IS, IGRP, etc.
[0071] In an exemplary embodiment, Figure 2 As shown, a load balancing method is provided, which is applied to Figure 1 The switch in the example is used to illustrate, including the following steps S201 to S204. Among them:
[0072] Step S201: receiving data streams sent by different clients.
[0073] The client may refer to any type of client, such as a service client.
[0074] The data stream sent by the client refers to the data stream that the client requests the application server to process, and specifically refers to the data stream of the same session of the client, such as a business data stream.
[0075] Each switch can receive data streams sent by multiple clients. There is an IGP protocol between different switches, and the data streams received by different switches are also balanced.
[0076] Exemplarily, when a client sends a data stream to an application server, the client first sends the data stream to a corresponding switch; the switch can receive data streams sent by different clients.
[0077] Step S202, obtaining quintuple information of the data stream of each client.
[0078] The five-tuple information refers to the source IP (Internet Protocol) address, the destination IP address, the source port number, the destination port number and the transmission protocol.
[0079] The five-tuple information of the data stream of the same session of the client is consistent, that is, the data streams with the same five-tuple information are the same session, so that the data streams of the same session of the client can be fixedly forwarded to the same load balancing server.
[0080] Exemplarily, the switch performs information extraction processing on the data stream of each client according to the five-tuple information extraction instruction to obtain the five-tuple information of the data stream of each client; or, the switch inputs the data stream of each client into a pre-trained information extraction model, performs information extraction processing on the data stream of each client through the information extraction model, and obtains the five-tuple information of the data stream of each client.
[0081] Step S203: determining the target load balancing server corresponding to the data flow of each client according to the five-tuple information of the data flow of each client.
[0082] The data flow of the same session of the client is fixedly sent to the same target load balancing server, that is, the same session will be forwarded along the same path, and different sessions will be forwarded along different paths, thereby achieving load balancing of the downstream traffic between the switch and the load balancing server. It should be noted that for the data flow of a single session of the client, load balancing will not be performed on multiple paths, that is, the switch will select the best route by default based on BGP, so the prerequisite for achieving load balancing is that the switch is configured with BGP load balancing.
[0083] The data stream of each client corresponds to the same target load balancing server, and the specific target load balancing server is determined based on the five-tuple information of the data stream of each client.
[0084] It should be noted that different load balancing servers publish the same v-IP (i.e., public IP, the IP that provides services to users) to the outside world (such as different switches); there are multiple switches, and for each switch, there are multiple equal-cost routes between the switch and multiple load balancing servers; for a single TCP (Transmission Control Protocol) connection, it will be guaranteed to be sent to the same load balancing server to ensure the continuity of the session.
[0085] Exemplarily, the switch selects a load balancing server associated with the quintuple information of each client's data flow from the load balancing server list according to the quintuple information of each client's data flow as the target load balancing server corresponding to each client's data flow.
[0086] For example, the switch determines the target load balancing server corresponding to each client's data flow based on the five-tuple information of each client's data flow through a consistent hashing algorithm.
[0087] Step S204, forwarding the data stream of each client to the corresponding target load balancing server; each target load balancing server is used to determine the target application server corresponding to the received data stream, and forward the received data stream to the corresponding target application server for processing.
[0088] The data stream of the same session of the client is fixedly sent to the same target application server, that is, the data streams of different clients will be processed by different target application servers, thereby achieving load balancing of the upstream traffic between the load balancing server and the application server.
[0089] The target application server corresponding to the data stream of each client is determined according to the four-layer / seven-layer load balancing software (such as nginx, haproxy, etc.) of the target load balancing server that receives the data stream of the client.
[0090] It should be noted that in the network architecture composed of switches, load balancing servers and application servers, switches, load balancing servers and application servers can be expanded separately according to actual needs; for example, if the number of ports on the switch is insufficient or the bandwidth is insufficient, the switch can be expanded horizontally without a limit on the number, and the newly added switches need to communicate with each load balancing server; if the performance of the load balancing server is insufficient, the load balancing server can be expanded separately, and the newly added load balancing server must communicate with the switch and application server; if the performance of the application server is insufficient, the application server can be expanded separately, and the newly added application server must communicate with the load balancing server.
[0091] Exemplarily, the switch forwards the data stream of each client to the corresponding target load balancing server; after receiving the data stream of the client, each target load balancing server determines the target application server corresponding to the received data stream through the built-in four-layer / seven-layer load balancing software, or determines the target application server corresponding to the received data stream by querying the correspondence between the data stream and the application server; then, each target load balancing server forwards the received data stream to the corresponding target application server, processes the received data stream through each target application server, and returns the processing result to the corresponding client.
[0092] For example, see Figure 1 , after the switch receives the client request, how to forward the data flow to the load balancing server, from the perspective of the load balancing server, can be called downstream traffic. The load balancing server is deployed with four-layer / seven-layer load balancing software. Here, the seven-layer load balancing service is taken as an example. As the access point of http / https service, it establishes a connection with the client, and then forwards the request to the application server for processing. From the perspective of the load balancing server, the traffic from the load balancing server to the application server can be called upstream traffic. The load balancing server and the application server are often not under the same switch, but the network is reachable. The seven-layer load balancing software supports multiple load balancing algorithms such as polling, consistent hashing, minimum number of connections, and weight. The seven-layer load balancing algorithm of the load balancing server determines which application server to forward to. The data packet of the load balancing server may be forwarded by multiple network devices and finally reach the application server. Different business scenarios have different network architectures. This application does not limit this. It only focuses on the high availability and load balancing of the three-layer network from the load balancing server to the switch. The focus of this application is to propose a method for achieving load balancing of downstream traffic (i.e., north-south traffic in the data center) and upstream traffic (i.e., east-west traffic in the data center) between the load balancing server and the switch after the switch is unstaked.
[0093] In the above load balancing method, the data streams sent by different clients are received through the switch, and the five-tuple information of the data stream of each client is obtained. Then, according to the five-tuple information of the data stream of each client, the target load balancing server corresponding to the data stream of each client is determined, and the data stream of each client is forwarded to the corresponding target load balancing server; each target load balancing server first determines the target application server corresponding to the received data stream, and then forwards the received data stream to the corresponding target application server for processing. In this way, in the network architecture composed of the switch and the load balancing server, the data stream of each client is forwarded to the corresponding target load balancing server through the switch, and the received data stream is forwarded to the corresponding target application server for processing through each target load balancing server, so that the load balancing of the data stream can be realized, without the need to add additional hardware load balancing equipment, thereby reducing the cost of load balancing.
[0094] In an exemplary embodiment, Figure 3 As shown, the above step S203, according to the five-tuple information of the data flow of each client, determines the target load balancing server corresponding to the data flow of each client, including the following steps S301 to S302. Among them:
[0095] Step S301, calculating a hash value of the data flow of each client according to the five-tuple information of the data flow of each client.
[0096] Step S302: Filter out the load balancing server associated with the hash value of each client's data flow from the load balancing server list as the target load balancing server corresponding to each client's data flow.
[0097] Among them, the hash value of each client's data stream is calculated by a consistent hashing algorithm.
[0098] The load balancing server list includes multiple selectable load balancing servers.
[0099] The load balancing server associated with the hash value of the data stream of each client refers to the load balancing server that matches the hash value of the data stream of each client.
[0100] It should be noted that the general hash load balancing algorithm implements load balancing based on the modulo of the five-tuple information of the data flow and the number of reachable paths of the equal-cost routing. This algorithm can ensure that the data packets of the same session are forwarded to the same load balancing server, but the negative impact is that if one of the paths fails, one reachable path is reduced, and the modulo result will change, which will affect the data packets under all paths, that is, the data packets of the original normal path will also be recalculated and forwarded to the new load balancing server, and then sent to the new application server for processing. If the business is a long-connected state (i.e., session), all sessions will be interrupted, including the sessions under the normal path. This application adopts a consistent hashing algorithm, which can ensure that if a path fails, only the data packets under the failed path will be re-forwarded to the new path and processed by the new load balancing server (for example, switch 1 originally forwards the data stream of client 1 to load balancing server 1. In the case of communication failure between switch 1 and load balancing server 1, switch 1 re-forwards the data stream of client 1 to a new load balancing server, such as load balancing server 2). However, data packets on other normal paths are not affected, and only the sessions on the failed path will be affected. This minimizes the scope of the failure impact. Applications generally have a failure retry mechanism, and the data packets for re-establishing the session will be scheduled to the new normal path, and the business will not be obviously aware of it.
[0101] It should be noted that when the consistent hashing algorithm is introduced, for a single switch, the target load balancing server corresponding to the data flow of each client is different.
[0102] Exemplarily, the switch calculates the hash value of each client's data flow based on the quintuple information of each client's data flow through a consistent hashing algorithm; then, from the load balancing server list, the load balancing server associated with the hash value of each client's data flow is filtered out as the target load balancing server corresponding to each client's data flow; for example, from the load balancing server list, the load balancing server corresponding to the load balancing server identifier associated with the hash value of each client's data flow is filtered out as the target load balancing server corresponding to each client's data flow.
[0103] For example, when the hash value of each load balancing server is mapped to a hash ring, the switch calculates the hash value of the client's data flow and determines the specific position of the hash value of the client's data flow on the hash ring, and then starts from this position and searches clockwise along the hash ring. The first load balancing server encountered is the target load balancing server corresponding to the client's data flow; through this method, the target load balancing server corresponding to each client's data flow can be determined.
[0104] In this embodiment, the switch determines the target load balancing server corresponding to the data flow of each client based on the quintuple information of the data flow of each client, which is conducive to achieving the load balancing effect of the downstream traffic between the switch and the load balancing server without adding additional hardware load balancing equipment, thereby reducing the cost of implementing load balancing.
[0105] In an exemplary embodiment, the above step S302, from the load balancing server list, filters out the load balancing server associated with the hash value of each client's data stream as the target load balancing server corresponding to the data stream of each client, specifically includes the following contents: when it is detected that the number of clients is greater than the number of load balancing servers in the load balancing server list, obtain an expanded load balancing server list of the load balancing server list; from the expanded load balancing server list, filter out the load balancing server associated with the hash value of each client's data stream as the target load balancing server corresponding to the data stream of each client.
[0106] The expanded load balancing server list includes the original load balancing servers and the expanded load balancing servers.
[0107] Exemplarily, when it is detected that the number of clients is greater than the number of load balancing servers in the load balancing server list, the switch can request to expand the load balancing server and filter out the load balancing server associated with the hash value of each client's data flow from the expanded load balancing server list as the target load balancing server corresponding to the data flow of each client; for example, from the expanded load balancing server list, filter out the load balancing server corresponding to the load balancing server identifier associated with the hash value of each client's data flow as the target load balancing server corresponding to the data flow of each client.
[0108] In this embodiment, when it is detected that the number of clients is greater than the number of load balancing servers in the load balancing server list, the target load balancing server corresponding to the data flow of each client is determined from the expanded load balancing server list, which is beneficial to further ensure the load balancing effect of the downstream traffic between the switch and the load balancing server, and avoid the defect of insufficient number of load balancing servers causing overload of the load balancing servers.
[0109] In an exemplary embodiment, the load balancing method provided by the present application also includes the following: when a communication failure is detected between the switch and the target load balancing server corresponding to the data flow of the target client, the target load balancing server corresponding to the data flow of the target client is re-determined; the target client is one of the different clients; and the data flow of the target client is forwarded to the re-determined target load balancing server.
[0110] In the present application, only the target load balancing server corresponding to the data flow of the target client is re-determined, and the target load balancing servers corresponding to the data flows of other clients are not re-determined.
[0111] Among them, when the target load balancing server corresponding to the data flow of the target client is re-determined, it is also determined based on the consistent hashing algorithm.
[0112] It should be noted that when a path failure occurs, the switch will not send the data to the original load balancing server. The switch will think that the original load balancing server has an abnormality (the switch does not know whether it is a network failure or a load balancing server failure). The original load balancing server (such as load balancing server 1) will be eliminated, and the data packet will be forwarded to other normal load balancing servers (such as load balancing server 2).
[0113] Exemplarily, the switch detects in real time the communication status between the switch and the target load balancing server corresponding to the data flow of each client. When it is detected that the communication between the switch and the target load balancing server corresponding to the data flow of the target client (i.e., one of the different clients) fails, the switch redetermines the target load balancing server corresponding to the data flow of the target client based on the consistent hashing algorithm, and forwards the data flow of the target client to the redetermined target load balancing server.
[0114] In this embodiment, when a communication failure is detected between the switch and the target load balancing server corresponding to the data flow of the target client, only the target load balancing server corresponding to the data flow of the target client is re-determined, and the data flow of the target client is forwarded to the re-determined target load balancing server, which can ensure the normal forwarding of the data flow of other clients, thereby achieving the effect of minimizing the scope of the fault impact.
[0115] In an exemplary embodiment, the target load balancing server corresponding to the data flow of the target client is re-determined, which specifically includes the following contents: deleting the target load balancing server corresponding to the data flow of the target client from the load balancing server list to obtain an updated load balancing server list; and filtering out the load balancing server associated with the hash value of the data flow of the target client from the updated load balancing server list as the re-determined target load balancing server.
[0116] The updated load balancing server list does not include the target load balancing server corresponding to the data flow of the target client.
[0117] Among them, deleting the target load balancing server corresponding to the data flow of the target client from the load balancing server list can ensure that the re-determined target load balancing server is not repeated with the original target load balancing server.
[0118] Exemplarily, the switch first deletes the target load balancing server corresponding to the data flow of the target client from the load balancing server list to obtain an updated load balancing server list, and then based on the consistent hashing algorithm, filters out the load balancing server corresponding to the load balancing server identifier associated with the hash value of the data flow of the target client from the updated load balancing server list as the re-determined target load balancing server.
[0119] In this embodiment, the target load balancing server corresponding to the data flow of the target client is deleted from the load balancing server list to obtain an updated load balancing server list, and the load balancing server associated with the hash value of the data flow of the target client is screened out from the load balancing server list as the re-determined target load balancing server. This can ensure that the re-determined target load balancing server is different from the original load balancing server, thereby ensuring that the data flow of the target client can be forwarded and processed smoothly.
[0120] In an exemplary embodiment, the above step S204, forwarding the data stream of each client to the corresponding target load balancing server, specifically includes the following contents: forwarding the data stream of each client to the corresponding target load balancing server, so that each target load balancing server determines the target application server corresponding to the received data stream through a pre-trained neural network model, and forwards the received data stream to the corresponding target application server for processing through the corresponding current gateway. In the event that the current gateway fails, the received data stream is forwarded to the corresponding target application server for processing through the equivalent gateway of the current gateway.
[0121] Among them, each target load balancing service determines the target application server corresponding to the received data stream based on the four-layer / seven-layer load balancing software (such as nginx, haproxy, etc.) deployed by it.
[0122] The pre-trained neural network model is a neural network model used to determine the target application server corresponding to the received data stream, and is obtained through iterative training.
[0123] There are multiple equivalent gateways between each target load balancing server and the corresponding target application server. Figure 8 , Gateway 1 is equivalent to Gateway 3, and Gateway 2 is equivalent to Gateway 4; the equivalent gateway is to achieve load balancing of the first hop path of the load balancing server's access to the application server's upstream traffic, that is, load balancing of the load balancing server's upstream traffic to the application server.
[0124] The current gateway refers to the gateway currently used by the target load balancing server; the equivalent gateway of the current gateway refers to the gateway equivalent to the current gateway.
[0125] Exemplarily, the switch forwards the data stream of each client to the corresponding target load balancing server; after receiving the data stream, each target load balancing server determines the target application server corresponding to the received data stream through a pre-trained neural network model or an internally deployed four-layer / seven-layer load balancing software, such as determining the probability of each application server corresponding to the received data stream through a pre-trained neural network model, and selecting the application server with the highest probability as the target application server corresponding to the received data stream; then forwarding the received data stream to the corresponding target application server through the corresponding current gateway (such as gateway 1) for processing; in the event that the current gateway fails, determining the equivalent gateway of the current gateway (such as gateway 3), and forwarding the received data stream to the corresponding target application server for processing through the equivalent gateway of the current gateway.
[0126] In this embodiment, each target load balancing server determines the target application server corresponding to the received data stream, and forwards the received data stream to the corresponding target application server for processing through the corresponding current gateway, which is conducive to achieving the load balancing effect of the upstream traffic between the load balancing server and the application server without adding additional hardware load balancing equipment, thereby reducing the cost of load balancing. At the same time, in the case of a failure of the current gateway, the received data stream is forwarded to the corresponding target application server for processing through the equivalent gateway of the current gateway, which can ensure the smooth forwarding and processing of the data stream.
[0127] In one of the embodiments, the load balancing server list corresponding to the switch includes multiple load balancing servers, and the multiple load balancing servers are used to publish the same public IP to the de-stacked switch, and there are multiple equivalent routes between the switch and the multiple load balancing servers; then, the above-mentioned step S203, based on the quintuple information of the data flow of each client, determines the target load balancing server corresponding to the data flow of each client, and specifically includes the following contents: for the data flow of each client, according to the border gateway protocol routing principle and the quintuple information of the data flow of each client, select a target route from the multiple equivalent routes between the switch and the multiple load balancing servers; and use the load balancing servers associated with the target routes selected for the data flow of each client as the target load balancing servers corresponding to the data flow of each client.
[0128] Among them, reference Figure 6 , different switches are stacked.
[0129] Each switch corresponds to a load balancing server list, and the load balancing server list includes multiple selectable load balancing servers.
[0130] The public IP (v-IP) is the IP that provides services to customers. Different load balancing servers publish the same public IP to the stacked switches.
[0131] There are multiple equal-cost routes between the switch and multiple load balancing servers, which means that there are multiple equal-cost paths between the switch and multiple load balancing servers. For details, refer to Figure 6 As shown by the arrows; for example, the path from switch 1 to load balancing server 1, the path from switch 1 to load balancing server 2, and the path from switch 1 to load balancing server 3 are equivalent; the path from switch 2 to load balancing server 1, the path from switch 2 to load balancing server 2, and the path from switch 2 to load balancing server 3 are equivalent.
[0132] The Border Gateway Protocol routing principle refers to the BGP routing principle, which is used to select an optimal route by default to achieve load balancing.
[0133] Among them, for a single switch, a target route needs to be selected for each client's data flow; the target route refers to the best route selected based on the Border Gateway Protocol routing principle. For example, for the data flow of switch 1 and client 1, from the path from switch 1 to load balancing server 1, the path from switch 1 to load balancing server 2, and the path from switch 1 to load balancing server 3, the path from switch 1 to load balancing server 1 is selected as the best route corresponding to the data flow of client 1.
[0134] The load balancing server associated with the target route selected for the data flow of each client refers to the load balancing server involved in the target route selected for the data flow of each client. For example, if the target route corresponding to the data flow of client 1 is the path from switch 1 to load balancing server 1, then the load balancing server associated with the target route is load balancing server 1.
[0135] Exemplarily, for the data flow of each client, the switch selects an optimal route from multiple equivalent routes between the switch and multiple load balancing servers according to the border gateway protocol routing principle and the five-tuple information of the data flow of each client, as the target route selected corresponding to the data flow of each client; then, the load balancing server associated with the target route selected for the data flow of each client is identified, and the load balancing server associated with the target route selected for the data flow of each client is used as the target load balancing server corresponding to the data flow of each client; finally, the data flow of each client is forwarded to the corresponding target load balancing server through the corresponding selected target route.
[0136] For example, for switch 1, switch 1 receives the data flow of client 1, the data flow of client 2, and the data flow of client 3, and the path from switch 1 to load balancing server 1, the path from switch 1 to load balancing server 2, the path from switch 1 to load balancing server 3, the path from switch 1 to load balancing server 4, and the path from switch 1 to load balancing server 5 are equivalent; then, based on the BGP routing principle and the five-tuple information of the data flow of client 1, the five-tuple information of the data flow of client 2, and the five-tuple information of the data flow of client 3, switch 1 selects the target route corresponding to the data flow of client 1 (such as the path from switch 1 to load balancing server 1), the target route corresponding to the data flow of client 2 (such as the path from switch 1 to load balancing server 2), and the target route corresponding to the data flow of client 3 (such as the path from switch 1 to load balancing server 4) from the path from switch 1 to load balancing server 1, the path from switch 1 to load balancing server 2, the path from switch 1 to load balancing server 3, the path from switch 1 to load balancing server 4, and the path from switch 1 to load balancing server 5. 1 to the path of load balancing server 3); then, switch 1 uses the load balancing server (such as load balancing server 1) involved in the target route corresponding to the data flow of client 1 as the target load balancing server corresponding to the data flow of client 1; uses the load balancing server (such as load balancing server 2) involved in the target route corresponding to the data flow of client 2 as the target load balancing server corresponding to the data flow of client 2; uses the load balancing server (such as load balancing server 3) involved in the target route corresponding to the data flow of client 3 as the target load balancing server corresponding to the data flow of client 3; finally, switch 1 forwards the data flow of client 1 to load balancing server 1 through the corresponding selected target route (such as the path from switch 1 to load balancing server 1); forwards the data flow of client 2 to load balancing server 2 through the corresponding selected target route (such as the path from switch 1 to load balancing server 2); and forwards the data flow of client 3 to load balancing server 1 through the corresponding selected target route (such as the path from switch 1 to load balancing server 3).
[0137] In this embodiment, for the data flow of each client, according to the border gateway protocol routing principle and the five-tuple information of the data flow of each client, a target route is selected from multiple equivalent routes between the switch and multiple load balancing servers; the load balancing server associated with the target route selected for the data flow of each client is used as the target load balancing server corresponding to the data flow of each client, which is conducive to achieving the load balancing effect of the downstream traffic between the switch and the load balancing server without adding additional hardware load balancing equipment, thereby reducing the cost of load balancing implementation.
[0138] In an exemplary embodiment, Figure 4 As shown, another load balancing method is provided, which is described by taking the method applied to a switch as an example, and includes the following steps S401 to S407. Among them:
[0139] Step S401: receiving data streams sent by different clients.
[0140] Step S402, obtaining quintuple information of the data stream of each client.
[0141] Step S403: Calculate the hash value of the data flow of each client according to the five-tuple information of the data flow of each client.
[0142] Step S404: Filter out the load balancing server associated with the hash value of the data flow of each client from the load balancing server list as the target load balancing server corresponding to the data flow of each client.
[0143] The load balancing server list corresponding to the switch includes multiple load balancing servers, and the multiple load balancing servers are used to publish the same public network IP to the de-stacked switch. There are multiple equal-cost routes between the switch and the multiple load balancing servers.
[0144] Among them, for the data flow of each client, the switch selects a target route from multiple equivalent routes between the switch and multiple load balancing servers based on the border gateway protocol routing principle and the quintuple information of each client's data flow; the load balancing server associated with the target route selected for the data flow of each client is used as the target load balancing server corresponding to the data flow of each client.
[0145] Step S405: forwarding the data stream of each client to the corresponding target load balancing server.
[0146] Among them, each target load balancing server determines the target application server corresponding to the received data stream through a pre-trained neural network model, and forwards the received data stream to the corresponding target application server for processing through the corresponding current gateway. In the event of a failure of the current gateway, the received data stream is forwarded to the corresponding target application server for processing through the equivalent gateway of the current gateway.
[0147] Step S406, when it is detected that the switch and the target load balancing server corresponding to the data flow of the target client fail to communicate, re-determine the target load balancing server corresponding to the data flow of the target client; the target client is one of the different clients.
[0148] Step S407: forwarding the data flow of the target client to the re-determined target load balancing server, so that the re-determined target load balancing server forwards the data flow of the target client to the corresponding target application server.
[0149] In the above load balancing method, in the network architecture composed of switches and load balancing servers, the data stream of each client is forwarded to the corresponding target load balancing server through the switch, and the received data stream is forwarded to the corresponding target application server for processing by each target load balancing server, so that load balancing of the data stream can be achieved without adding additional hardware load balancing equipment, thereby reducing the cost of load balancing implementation.
[0150] In order to more clearly illustrate the load balancing method provided by the embodiment of the present application, the load balancing method is specifically described below with a specific embodiment. In an exemplary embodiment, the present application also proposes a high-performance and high-availability load balancing implementation method (i.e., a load balancing implementation method under a highly available and easily scalable architecture in a data center), which specifically designs a traffic scheduling method that does not have a single point of failure problem, has the characteristics of high reliability, flexible expansion, high forwarding efficiency, etc., and can meet high concurrency and high traffic usage scenarios. The specific contents are as follows:
[0151] Large-scale clusters in data centers generally use software load balancing and link bundling to achieve this. After two physical switches are merged and stacked into a logical switch, a load balancing server / cluster is attached to it. The latter deploys load balancing software and bundles links to the upstream switch to achieve high availability of the system and traffic distribution. The specific network topology is as follows: Figure 5 As shown. In the networking, the business completely relies on stacked switches that are opaque to the outside and have logical single points: on the one hand, stacking is a "black box" technology that is opaque to the equipment manufacturer and the development environment is closed, making it difficult for the outside world to continuously improve it and do constructive work; on the other hand, although the stacked switches are two physical switches, they are still logical single points, and the stack does not support smooth upgrades. When there is an upgrade change or stack failure, all devices under the switch are disconnected from the network, seriously affecting business continuity and availability. In terms of servers, load balancing servers / clusters generally use GSLB (global load balancing) that can globally schedule traffic to solve the unified entrance and high availability of services, but there are problems such as scheduling control delays, slow DNS cache updates when failures occur, complex networking, and high costs.
[0152] In view of the shortcomings of the above load balancing method, refer to Figure 6 This application proposes a new high-availability architecture load balancing implementation method: spine-leaf + virtual-IP (public IP) architecture. Figure 6 (The application cluster server module is a logical connection), two unstacked switches are spines, and load balancing servers / clusters are leafs to form a basic network architecture. IGP (Internal Gateway Protocol) and iBGP (Internal Border Gateway Protocol) run between spines, and EBGP (External Border Gateway Protocol) and BFD (Bidirectional Forwarding Detection) run between spines and leaves to achieve routing interoperability and rapid convergence of different types of servers; the load balancing server / cluster serves as a unified service entrance, deploys virtual-IP and seven-layer software load balancing processes that provide services to the outside world, and establishes BGP peers with spines through open source routing daemons, and uses ECMP (Equal-cost multi-path) to publish v-IPs (the same public IP) to spines at equal cost. This architecture can achieve standardized horizontal expansion through different POD modules (such as switch groups, load balancing servers, and application cluster servers).
[0153] IGP+iBGP protocols run between spines to meet the mutual access requirements of servers in different network segments. EBGP and BFD protocols run between spine and load balancing server / cluster. As an external gateway protocol, BGP selects the optimal route by default and adds it to the routing table to guide data forwarding. In this method, the load balance function of BGP is enabled on the spine. After the LB (load balancing) condition in the BGP routing protocol selection principle is met, there are multi-hop equal-cost routes to the same destination v-IP, achieving the purpose of load balancing traffic (such as Figure 6 As shown by the arrows). The BGP protocol running on the spine and load balancing servers / clusters is local-specific and does not introduce other routing information, which prevents the load balancing servers / clusters from maintaining unnecessary routing tables. It also isolates fault domains and prevents network faults from causing routing convergence. EBGP can quickly detect and discover faults with the BFD protocol, solving the problem that the fault discovery mechanism of the BGP protocol itself takes a long time.
[0154] In the ECMP scenario, data flows with the same five-tuple are the same session. The hash algorithm selects all or several combinations of the five-tuple of the data flow as hash factors, and selects the path that actually carries the data after hash calculation. The five-tuple of the same session is consistent, so that the data packets of the same session are fixedly forwarded to the same load balancing server to ensure business continuity. Figure 7However, when a path fails, all current traffic (all traffic between the switch and multiple load balancing servers) will be re-hashed and redistributed to normal paths, which may cause the original hash calculation path to change. Data packets of the same session may be sent to different servers, causing services that require session maintenance to time out and reconnect or even be interrupted. In this method, ECMP load balancing consistency is enabled on the spine to avoid the above problems.
[0155] After solving the load balancing problem of external request and response packets, you also need to consider the problem of the load balancing server sending packets outward and communicating with the application server. Set the IP address of the interface of the load balancing server uplink to different spines to the default equal-cost gateway address (that is, the equal-cost default route, such as Figure 8 As shown in the figure, gateways 1-4, that is, gateway 1 is equivalent to gateway 3, and gateway 2 is equivalent to gateway 4). The IP address of the server physical network card is only used as the interface address of the switch. The access layer server communicates with other internal application servers by deploying an independent internal communication IP as the address for intercommunication with the internal application server, and publishing it to the spine through EBGP. Through the above method, the load balancing server data flow is equivalently upstreamed to different spines and internally interconnected with the application server.
[0156] In addition, the implementation steps of the high-performance and high-availability load balancing implementation method are as follows:
[0157] Step 1: The switch receives data streams sent by different clients and uses the consistent hashing algorithm to send them to a fixed load balancing server based on the TCP five-tuple information. The client establishes a session with the load balancing server. If the communication from switch 1 to load balancing server 1 fails, switch 1 will remove load balancing server 1 from the forwarding list and reselect a load balancing server using the consistent hashing algorithm. Changing the forwarding path will only affect the session on the path from switch 1 to load balancing server 1, and other sessions will not be affected.
[0158] Step 2: After the load balancing server receives the client request, the four-layer / seven-layer load balancing software (such as nginx, haproxy, etc.) determines the target application server (i.e. the IP address of the application server) to be forwarded. Different client requests will be processed by different application servers to achieve load balancing. All data packets of the same session will be sent to a fixed application server.
[0159] Step 3: There are multiple forwarding paths between load balancing server 1 and application server 1. The first hop of these paths is to the spine switch, such as Figure 8As shown in the figure, for load balancing server 1 (i.e., the leaf server in the lower left corner), there are two equivalent gateways: gateway 1 and gateway 3. If gateway 1 fails, the data packet is forwarded by gateway 3 to application server 1. In this scenario, the application layer is not aware of it, and it is just a failover of the three-layer network. If application server 1 fails and the network is unreachable, the user request will be reselected by the load balancing software and sent to other application servers.
[0160] The above embodiments can achieve the following technical effects: (1) using the spine-leaf+virtual-IP architecture and ECMP to achieve data center load balancing in large traffic and high concurrency scenarios; (2) solving the problems of high cost, single point failure and poor horizontal scalability of hardware load balancing equipment; (3) solving the problems of scheduling control delay, slow DNS cache update during failure, increased network complexity, high cost, etc. in the existing software load balancing architecture; (4) solving the single point problem of the upstream switch in the switch stacking architecture, avoiding the risk of interrupting business due to stacking switch upgrades, having fault detection and automatic switching capabilities, and high reliability; (5) making full use of the performance advantages of switch hardware forwarding, and cooperating with 7-layer load balancing software, it can provide high-performance and flexible business scheduling load balancing services.
[0161] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0162] Based on the same inventive concept, the embodiment of the present application also provides a load balancing device for implementing the load balancing method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more load balancing device embodiments provided below can refer to the limitations on the load balancing method above, and will not be repeated here.
[0163] In an exemplary embodiment, Fig. 9As shown, a load balancing device is provided, which is applied to a switch, including: a data receiving module 910, an information acquisition module 920, a device determination module 930 and a data forwarding module 940, wherein:
[0164] The data receiving module 910 is used to receive data streams sent by different clients.
[0165] The information acquisition module 920 is used to acquire the five-tuple information of the data stream of each client.
[0166] The device determination module 930 is used to determine the target load balancing server corresponding to the data flow of each client according to the five-tuple information of the data flow of each client.
[0167] The data forwarding module 940 is used to forward the data stream of each client to the corresponding target load balancing server; each target load balancing server is used to determine the target application server corresponding to the received data stream, and forward the received data stream to the corresponding target application server for processing.
[0168] In an exemplary embodiment, the device determination module 930 is also used to calculate the hash value of each client's data flow based on the five-tuple information of each client's data flow; and filter out the load balancing server associated with the hash value of each client's data flow from the load balancing server list as the target load balancing server corresponding to each client's data flow.
[0169] In an exemplary embodiment, the device determination module 930 is also used to obtain an expanded load balancing server list of the load balancing server list when it is detected that the number of clients is greater than the number of load balancing servers in the load balancing server list; from the expanded load balancing server list, the load balancing server associated with the hash value of the data stream of each client is filtered out as the target load balancing server corresponding to the data stream of each client.
[0170] In an exemplary embodiment, the load balancing device also includes a redetermining module for redetermining the target load balancing server corresponding to the data flow of the target client when a communication failure is detected between the switch and the target load balancing server corresponding to the data flow of the target client; the target client is one of the different clients; and the data flow of the target client is forwarded to the redetermined target load balancing server.
[0171] In an exemplary embodiment, the redetermination module is also used to delete the target load balancing server corresponding to the data flow of the target client from the load balancing server list to obtain an updated load balancing server list; and filter out the load balancing server associated with the hash value of the data flow of the target client from the updated load balancing server list as the redetermined target load balancing server.
[0172] In an exemplary embodiment, the data forwarding module 940 is also used to forward the data stream of each client to the corresponding target load balancing server, so that each target load balancing server determines the target application server corresponding to the received data stream through a pre-trained neural network model, and forwards the received data stream to the corresponding target application server for processing through the corresponding current gateway. In the event of a failure of the current gateway, the received data stream is forwarded to the corresponding target application server for processing through an equivalent gateway of the current gateway.
[0173] In an exemplary embodiment, the load balancing server list corresponding to the switch includes multiple load balancing servers, and the multiple load balancing servers are used to publish the same public network IP to the unstacked switch, and there are multiple equal-cost routes between the switch and the multiple load balancing servers;
[0174] The device determination module 930 is also used to select a target route from multiple equivalent routes between the switch and multiple load balancing servers for the data flow of each client according to the border gateway protocol routing principle and the five-tuple information of the data flow of each client; and use the load balancing server associated with the target route selected for the data flow of each client as the target load balancing server corresponding to the data flow of each client.
[0175] Each module in the above load balancing device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module.
[0176] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Fig.10As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (Near Field Communication, NFC) or other technologies. When the computer program is executed by the processor, a load balancing method is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0177] Those skilled in the art will understand that Fig.10 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0178] In an exemplary embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0179] In an exemplary embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0180] In an exemplary embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0181] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0182] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0183] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A load balancing method, characterized in that: Applied to a switch, the method comprises: Receive data streams sent by different clients; Get the five-tuple information of each client's data stream; Determine the target load balancing server corresponding to the data flow of each client according to the quintuple information of the data flow of each client; The data stream of each client is forwarded to the corresponding target load balancing server; each target load balancing server is used to determine the target application server corresponding to the received data stream, and forward the received data stream to the corresponding target application server for processing.
2. The method according to claim 1, characterized in that The step of determining, according to the five-tuple information of the data stream of each client, a target load balancing server corresponding to the data stream of each client comprises: Calculate the hash value of the data stream of each client according to the five-tuple information of the data stream of each client; From the load balancing server list, a load balancing server associated with the hash value of the data flow of each client is screened out as a target load balancing server corresponding to the data flow of each client.
3. The method according to claim 2, characterized in that The step of selecting, from the load balancing server list, a load balancing server associated with the hash value of the data flow of each client as a target load balancing server corresponding to the data flow of each client includes: When it is detected that the number of the clients is greater than the number of the load balancing servers in the load balancing server list, obtaining an expanded load balancing server list of the load balancing server list; From the expanded load balancing server list, a load balancing server associated with the hash value of the data flow of each client is screened out as a target load balancing server corresponding to the data flow of each client.
4. The method according to claim 1, characterized in that: The method further comprises: In the case of detecting that the communication between the switch and the target load balancing server corresponding to the data flow of the target client fails, re-determining the target load balancing server corresponding to the data flow of the target client; the target client is one of the different clients; The data stream of the target client is forwarded to the re-determined target load balancing server.
5. The method according to claim 4, characterized in that The re-determining the target load balancing server corresponding to the data flow of the target client includes: Deleting the target load balancing server corresponding to the data flow of the target client from the load balancing server list to obtain an updated load balancing server list; From the updated load balancing server list, a load balancing server associated with the hash value of the data flow of the target client is screened out as the re-determined target load balancing server.
6. The method according to any one of claims 1 to 5, characterized in that: The step of forwarding the data stream of each client to the corresponding target load balancing server includes: The data stream of each client is forwarded to the corresponding target load balancing server, so that each target load balancing server determines the target application server corresponding to the received data stream through a pre-trained neural network model, and forwards the received data stream to the corresponding target application server for processing through the corresponding current gateway. In the event of a failure of the current gateway, the received data stream is forwarded to the corresponding target application server for processing through an equivalent gateway of the current gateway.
7. The method according to any one of claims 1 to 5, characterized in that: The load balancing server list corresponding to the switch includes multiple load balancing servers, the multiple load balancing servers are used to publish the same public network IP to the unstacked switch, and there are multiple equal-cost routes between the switch and the multiple load balancing servers; The step of determining, according to the five-tuple information of the data stream of each client, a target load balancing server corresponding to the data stream of each client comprises: For the data flow of each client, according to the border gateway protocol routing principle and the five-tuple information of the data flow of each client, select a target route from multiple equal-cost routes between the switch and the multiple load balancing servers; The load balancing server associated with the target route selected for the data flow of each client is respectively used as the target load balancing server corresponding to the data flow of each client.
8. A load balancing device, characterized in that: Applied to a switch, the device comprises: A data receiving module, used to receive data streams sent by different clients; An information acquisition module, used to obtain the five-tuple information of the data stream of each client; A device determination module, used to determine a target load balancing server corresponding to the data flow of each client according to the five-tuple information of the data flow of each client; The data forwarding module is used to forward the data stream of each client to the corresponding target load balancing server; each target load balancing server is used to determine the target application server corresponding to the received data stream, and forward the received data stream to the corresponding target application server for processing.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Load balancing clustered system and method for providing services by using load balancing clustered system
CN103166870A
Method and device for expanding server cluster system and server cluster system
CN104580393A
Load balancing method of server cluster
CN108551474A
Access request processing method and system in load balancing cluster and readable medium
CN110198226A
Traffic scheduling method, VNF cluster contraction and expansion method and related devices
CN112437012A