Load balancing method and system
By configuring response coordination configuration information and query delivery targets in a distributed coordination system, the problem that load balancer becomes a system bottleneck is solved, and efficient and secure client communication with real servers is achieved.
Patent Information
- Application Number
- CN202411733308.7
- 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
The connected load balancers in distributed coordination systems are easily a system bottleneck and limit system performance.
By determining the response coordination configuration information of the distributed coordination system for each real server, querying the delivery target of the target real server, and determining the delivery path of the response message based on the delivery target, the flexible delivery of the response message is realized by real server returning the response message.
Improves communication security between the client and the real server, reduces the pressure on the load balancer, and avoids the load balancer becoming a bottleneck in the system performance.
Smart Images

Figure CN119544718A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of communication technology, and in particular to a load balancing method and system. Background Art
[0002] In today's network environment, load balancing technology is essential for the efficient operation of network services. Load balancers can distribute network requests or data traffic to multiple servers or processing units to balance the load, prevent single point of failure, and improve overall performance, availability, and scalability.
[0003] Network layer load balancing (four layers) and application layer load balancing (seven layers) are common types. Network layer load balancing has the advantages of fast processing speed and low resource consumption. Its working mode is "forwarding", which can directly forward the underlying data format (such as IP data packets or Ethernet frames) carrying TCP messages to the real server, and maintain the same TCP channel between the client and the real server that responds to the request. Application layer load balancing can only be a proxy, and two independent TCP channels are required to maintain communication between the real server, load balancer, and client, which makes its performance inferior to that of network layer load balancer, and its performance is difficult to meet the growing network needs. Summary of the invention
[0004] The present invention provides a load balancing method and system to solve the problem that a load balancer connected in a distributed coordination system easily becomes a system bottleneck and limits system performance.
[0005] According to one aspect of the present invention, a load balancing method is provided, the method comprising:
[0006] Determine the response coordination configuration information configured by the distributed coordination system for each real server, the distributed coordination system supports connection with several real servers and several load balancers, each response coordination configuration information is used to indicate that after each real server completes processing of the client request message, the corresponding delivery target of the response message returned by each real server is the client that sends the client request message or the load balancer that forwards the client request message to the real server;
[0007] Based on the response coordination configuration information corresponding to the target real server, query the delivery target corresponding to the target real server, the delivery target corresponding to the target real server is the target client that sends the client request message to the target real server or the target load balancer that forwards the client request message sent by the target client to the target real server;
[0008] When the transfer target corresponding to the target real server is the target load balancer, the response message corresponding to the client request message returned by the target real server is forwarded to the load balancer, and the response message corresponding to the client request message returned by the target real server is forwarded to the target client through the load balancer;
[0009] When the transfer target corresponding to the target real server is the target client, the response message corresponding to the client request message is directly returned to the target client through the target real server.
[0010] According to another aspect of the present invention, there is provided a load balancing system, the system comprising:
[0011] The real server configuration is to determine the response coordination configuration information configured by the distributed coordination system for each real server. The distributed coordination system supports connection with a plurality of real servers and a plurality of load balancers. Each response coordination configuration information is used to indicate that after each real server completes processing of a client request message, the corresponding delivery target of the response message returned by each real server is the client that sends the client request message or the load balancer that forwards the client request message to the real server.
[0012] The load balancer is configured to query a delivery target corresponding to the target real server based on the response coordination configuration information corresponding to the target real server, the delivery target corresponding to the target real server being a target client that sends a client request message to the target real server or a target load balancer that forwards a client request message sent by the target client to the target real server;
[0013] The real server is further configured to forward the response message corresponding to the client request message to the load balancer when the delivery target corresponding to the target real server is the target load balancer; and to return the response message corresponding to the client request message directly to the target client when the delivery target corresponding to the target real server is the target client;
[0014] The load balancer is also configured to forward a response message corresponding to a client request message returned by the target real server to the target client when the transfer target corresponding to the target real server is the target load balancer.
[0015] The technical solution of the embodiment of the present invention is to determine the response coordination configuration information configured by the distributed coordination system for each real server, and the distributed coordination system supports connection with several real servers and several load balancers. Each response coordination configuration information is used to indicate that after each real server completes processing of the client request message, the delivery target corresponding to the response message returned by each real server is the client that sends the client request message or the load balancer that forwards the client request message to the real server; based on the response coordination configuration information corresponding to the target real server, the delivery target corresponding to the target real server is queried, and the delivery target corresponding to the target real server is the target client that sends the client request message to the target real server or the target load balancer that forwards the client request message sent by the target client to the target real server, thereby realizing the determination of the real server return based on the response coordination configuration information configured on the real server. The delivery target of the response message determines the data transmission path in the request-response process between the client and the real server, and at the same time, it is convenient to flexibly configure the communication connection between the client and the real server according to actual needs; when the delivery target corresponding to the target real server is the target load balancer, the response message corresponding to the client request message returned by the target real server is forwarded to the load balancer, and the response message corresponding to the client request message returned by the target real server is forwarded to the target client through the load balancer, thereby realizing communication between the client and the real server through the load balancer and improving the security of communication; when the delivery target corresponding to the target real server is the target client, the response message corresponding to the client request message is directly returned to the target client through the target real server, thereby realizing direct communication between the client and the real server, improving data processing efficiency, reducing the pressure on the load balancer, and avoiding the load balancer from becoming a system bottleneck.
[0016] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0018] Figure 1 A flow chart of a load balancing method provided in Embodiment 1 of the present invention;
[0019] Figure 2A schematic diagram of the structure of a load balancing system provided in Embodiment 2 of the present invention. DETAILED DESCRIPTION
[0020] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0021] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention 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 interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0022] It is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.
[0023] Embodiment 1
[0024] Figure 1 This is a flow chart of a load balancing method provided in the first embodiment of the present invention. The embodiment of the present invention is applicable to the case where a load balancer connected to a distributed coordination system needs to perform load balancing when a client communicates with a real server connected to the distributed coordination system. The method can be executed by a load balancing system, which can be implemented in the form of hardware and / or software. Figure 1 As shown, the method includes:
[0025] S101. Determine the response coordination configuration information configured for each real server in the distributed coordination system. The distributed coordination system supports connection with several real servers and several load balancers. Each response coordination configuration information is used to indicate that after each real server completes processing of the client request message, the corresponding delivery target of the response message returned by each real server is the client that sends the client request message or the load balancer that forwards the client request message to the real server.
[0026] In the embodiment of the present invention, the distributed coordination system may refer to a highly available system that can be used as long as most nodes are alive, and is used to manage and coordinate data interactions between nodes. A Watch mechanism exists in the distributed coordination system to view changes in data in the system, and when data in the distributed coordination system changes, it can be immediately updated to the local cache.
[0027] A real server can be a physical hardware device or computer that provides services to clients. A load balancer can refer to a network device or software that distributes network requests or data traffic to multiple servers or processing units to ensure that these servers or processing units can handle the load evenly, avoid single points of failure, and improve overall performance, availability, and scalability. Both real servers and load balancers can be connected to a distributed coordination system.
[0028] The delivery target may be a target to which the real server returns a response message corresponding to the client request message. The delivery target may be a client that sends a client request message to the real server, or a load balancer that forwards the client request message to the real server.
[0029] Specifically, it is necessary to determine the configuration information configured in each real server connected to the distributed coordination system that can identify the delivery target of the response message returned by the real server, as the response coordination configuration information configured for each real server. The response coordination configuration information determines the data transmission path in the request response process between the client and the real server, and is closely related to the working level of the load balancer. Exemplarily, the response coordination configuration information configured for each real server can be queried through the Watch mechanism in the distributed coordination system.
[0030] S102. Based on the response coordination configuration information corresponding to the target real server, query the delivery target corresponding to the target real server. The delivery target corresponding to the target real server is the target client that sends the client request message to the target real server or the target load balancer that forwards the client request message sent by the target client to the target real server.
[0031] In an embodiment of the present invention, the target real server may refer to a real server connected to the distributed coordination system and actually communicating with the target client. The target load balancer may refer to a load balancer connected to the distributed coordination system and used to forward the client request message sent by the target client to the target real server. The client request message may refer to a data packet containing request information sent by the client, which follows a specific protocol format.
[0032] Specifically, according to the response coordination configuration information of the target real server, it can be queried that the delivery target of the response message corresponding to the client request message returned by the target real server is the target load balancer or the target client.
[0033] As an option, before querying the delivery target corresponding to the target real server based on the response coordination configuration information corresponding to the target real server, the method further includes:
[0034] The virtual IP used for communication between the real server and the client is determined as the target address, and the client request message of the target client is sent to the target load balancer.
[0035] Specifically, when the target client sends a client request message to the target real server for communication, the target client can use the virtual IP that communicates with the target real server as the target address, and then send the client request message to the target load balancer. Among them, the target address can refer to the target IP. The configuration of the virtual IP can be completed in the configuration center of the centralized distributed coordination system, without the need to configure the virtual IP on the real server, which reduces the difficulty of configuring the virtual IP. Exemplarily, the target client can ensure that the client request message is sent to the target load balancer by means of ARP spoofing, ARP proxy or routing configuration.
[0036] As an optional method, accordingly, after querying the transfer target corresponding to the target real server based on the response coordination configuration information corresponding to the target real server, the method further includes:
[0037] The client request message received from the target client is forwarded to the target real server through the target load balancer, so that the target real server returns a response message for the client request message.
[0038] Specifically, when the target load balancer receives the client request message sent by the target client to the target real server, it can forward the client request message sent by the target client to the target real server according to the load balancing policy. The load balancing policy decision needs to match the policy and resources of the distributed coordination system. Then, the target real server can respond to the client request message sent by the target client and return the corresponding response message.
[0039] Optionally, forwarding the received client request message of the target client to the target real server through the target load balancer includes:
[0040] After the target IP of the client request message of the target client is modified to the target real server IP through the target load balancer, the client request message of the target client is sent to the target real server, and the target real server is waited for to return the response message of the client request message to the target load balancer or there is no need to wait for the target real server to return the response message of the client request message to the target load balancer.
[0041] Specifically, when the target load balancer receives the client request message sent by the target client to the target real server, it needs to first modify the target IP of the client request message to the target real server IP to ensure that the client request message of the target client can be successfully forwarded to the corresponding target real server. After the target load balancer forwards the client request message to the target real server, it can choose whether to wait for the response message corresponding to the client request message returned by the target real server.
[0042] S103. When the transfer target corresponding to the target real server is the target load balancer, the response message corresponding to the client request message returned by the target real server is forwarded to the load balancer, and the response message corresponding to the client request message returned by the target real server is forwarded to the target client through the load balancer.
[0043] Specifically, when the delivery target corresponding to the target real server is queried as the target load balancer based on the response coordination configuration information corresponding to the target real server, the response message corresponding to the client request message returned by the target real server needs to be sent to the target load balancer first, and then the target load balancer forwards the response message corresponding to the client request message to the target client.
[0044] As an optional method, forwarding a response message corresponding to the client request message returned by the target real server to the load balancer, and forwarding the response message corresponding to the client request message returned by the target real server to the target client through the load balancer, including the following steps A1-A2:
[0045] Step A1: After the target real server completes processing the client request message of the target client, the response message corresponding to the client request message returned by the target real server is sent to the target load balancer, and the source IP of the response message corresponding to the client request message is the target real server IP.
[0046] Step A2: The target load balancer modifies the source IP in the response message corresponding to the client request message returned by the target real server into a virtual IP used for communication between the target real server and the target client and returns it to the target client.
[0047] Specifically, when the target real server's corresponding transmission target is the target load balancer, after the target real server generates the response message corresponding to the client request message, it needs to set the source IP of the response message corresponding to the client request message to the target real server IP, and then send the response message corresponding to the client request message to the target load balancer. Furthermore, after receiving the response message corresponding to the client request message returned by the target real server, the target load balancer needs to set the source IP of the response message corresponding to the client request message to the virtual IP used by the target real server to communicate with the target client, and then forward the response message corresponding to the client request message to the target client.
[0048] S104: When the transfer target corresponding to the target real server is the target client, the response message corresponding to the client request message is directly returned to the target client through the target real server.
[0049] Specifically, when the target client is the target real server, the response message corresponding to the client request message returned by the target real server can be directly sent to the target client. Exemplarily, a large number of static resources returned by the real server can be directly returned to the client.
[0050] As an option, the target real server directly returns the response message corresponding to the client request message to the target client, including:
[0051] The target real server sets the source IP in the response message corresponding to the target client request processed by the target real server itself to a virtual IP used for communication between the target real server and the target client and directly returns it to the target client.
[0052] Specifically, when the target real server's corresponding transmission target is the target client, after generating the response message corresponding to the client request message, the target real server needs to set the source IP of the response message corresponding to the client request message to the virtual IP used by the target real server to communicate with the target client, and then send the response message corresponding to the client request message to the target client. It should be noted that the use of the virtual IP in the communication process between the client and the real server can avoid the additional operations of encapsulating and disassembling IP packets, thereby improving the communication performance and security of the client and the real server.
[0053] As an option, the load balancing method in the embodiment of the present invention further includes:
[0054] In response to the input operation of the reference configuration field for load balancing configuration of each real server, the input value of the reference configuration field is saved and recorded to obtain the response coordination configuration information corresponding to each real server; wherein, the reference configuration field includes the virtual IP used for the real server to communicate with the client, the uniform resource locator URL used for downloading static resources, the rule expression used to determine the selection of the delivery target and the IP of the real server.
[0055] In the embodiment of the present invention, it is necessary to predetermine the virtual IP used by each real server connected to the distributed coordination system to communicate with the client, the uniform resource locator URL used for downloading static resources, the rule expression used to determine the selection of the delivery target, and the corresponding values of the IP of the real server, as the input value of the reference configuration field of each real server, and after saving the record, it can be used as the response coordination configuration information of each real server, which can be used to determine the delivery target of the response message returned by the real server. Among them, the rule expression used to determine the selection of the delivery target can be pre-set according to the actual needs of each real server connected to the distributed coordination system.
[0056] Exemplarily, the virtual IP used by each real server to communicate with the client, the uniform resource locator URL used to download static resources, and the input values corresponding to the IP of the real server can be substituted into the rule expression used to determine the delivery target to be returned by each real server.
[0057] At present, network layer load balancers mainly adopt IP tunnel protocol mode and NAT mode. In IP tunnel protocol mode, the load balancer uses IP tunnel technology to forward the client's request message to the real server. After processing the request, the real server directly returns the response message to the client. However, when using IP tunnel protocol mode, the virtual IP of the real server needs to be configured the same as the virtual IP of the load balancer, resulting in the real server node being able to communicate directly with the client through a gateway other than the load balancer, making the real service node unable to be hidden and having poor security. In NAT mode, the load balancer needs to modify the target address of the client request message and then forward the client request message to the real server, resulting in the client being unable to identify the IP of the response message returned by the real server. The response message returned by the real server needs to be forwarded to the client through the load balancer to ensure normal communication between the client and the real server. At the same time, when using NAT mode, all response messages returned by the real server to the client must pass through the load balancer, resulting in increased pressure on the load balancer, making the load balancer easily become a performance bottleneck of the system. The technical solution of the embodiment of the present invention can flexibly determine the delivery target of the response message returned by the real server by configuring the response coordination configuration information of each real server connected to the distributed coordination system, thereby improving the security of communication between the client and the real server, reducing the pressure on the load balancer, and avoiding the load balancer from becoming a performance bottleneck of the system.
[0058] The technical solution of the embodiment of the present invention is to determine the response coordination configuration information configured by the distributed coordination system for each real server, and the distributed coordination system supports connection with several real servers and several load balancers. Each response coordination configuration information is used to indicate that after each real server completes processing of the client request message, the delivery target corresponding to the response message returned by each real server is the client that sends the client request message or the load balancer that forwards the client request message to the real server; based on the response coordination configuration information corresponding to the target real server, the delivery target corresponding to the target real server is queried, and the delivery target corresponding to the target real server is the target client that sends the client request message to the target real server or the target load balancer that forwards the client request message sent by the target client to the target real server, thereby realizing the determination of the real server return based on the response coordination configuration information configured on the real server. The delivery target of the response message determines the data transmission path in the request-response process between the client and the real server, and at the same time, it is convenient to flexibly configure the communication connection between the client and the real server according to actual needs; when the delivery target corresponding to the target real server is the target load balancer, the response message corresponding to the client request message returned by the target real server is forwarded to the load balancer, and the response message corresponding to the client request message returned by the target real server is forwarded to the target client through the load balancer, thereby realizing communication between the client and the real server through the load balancer and improving the security of communication; when the delivery target corresponding to the target real server is the target client, the response message corresponding to the client request message is directly returned to the target client through the target real server, thereby realizing direct communication between the client and the real server, improving data processing efficiency, reducing the pressure on the load balancer, and avoiding the load balancer from becoming a system bottleneck.
[0059] Embodiment 2
[0060] Figure 2 This is a schematic diagram of the structure of a load balancing system provided in the second embodiment of the present invention. The embodiment of the present invention is applicable to the situation where a load balancer connected to a distributed coordination system needs to perform load balancing when a client communicates with a real server connected to the distributed coordination system. The system can be implemented in the form of hardware and / or software. Figure 2 As shown, the system includes:
[0061] The real server 201 is configured to determine the response coordination configuration information configured by the distributed coordination system for each real server. The distributed coordination system supports connection with a plurality of real servers and a plurality of load balancers. Each response coordination configuration information is used to indicate that after each real server completes processing of the client request message, the corresponding delivery target of the response message returned by each real server is the client that sends the client request message or the load balancer that forwards the client request message to the real server.
[0062] The load balancer 202 is configured to query the delivery target corresponding to the target real server based on the response coordination configuration information corresponding to the target real server, and the delivery target corresponding to the target real server is the target client that sends the client request message to the target real server or the target load balancer that forwards the client request message sent by the target client to the target real server;
[0063] The real server 201 is further configured to forward the response message corresponding to the client request message to the load balancer when the delivery target corresponding to the target real server is the target load balancer; and to return the response message corresponding to the client request message directly to the target client when the delivery target corresponding to the target real server is the target client;
[0064] The load balancer 202 is further configured to forward a response message corresponding to the client request message returned by the target real server to the target client when the transfer target corresponding to the target real server is the target load balancer.
[0065] Optionally, the load balancing system in the embodiment of the present invention further includes:
[0066] The real server 201 is further configured to, in response to an input operation of a reference configuration field for load balancing configuration of each real server, save and record the input value of the reference configuration field to obtain response coordination configuration information corresponding to each real server;
[0067] The reference configuration field includes a virtual IP used for communication between the real server and the client, a uniform resource locator URL used for downloading static resources, a regular expression used to determine and select a delivery target, and the IP of the real server.
[0068] Optionally, before querying the delivery target corresponding to the target real server based on the response coordination configuration information corresponding to the target real server, the method further includes:
[0069] The virtual IP used for communication between the real server and the client is determined as the target address, and the client request message of the target client is sent to the target load balancer; accordingly, after querying the transfer target corresponding to the target real server based on the response coordination configuration information corresponding to the target real server, it also includes:
[0070] The client request message received from the target client is forwarded to the target real server through the target load balancer, so that the target real server returns a response message for the client request message.
[0071] Optionally, forwarding the received client request message of the target client to the target real server through the target load balancer includes:
[0072] After the target IP of the client request message of the target client is modified to the target real server IP through the target load balancer, the client request message of the target client is sent to the target real server, and the target real server is waited for to return the response message of the client request message to the target load balancer or there is no need to wait for the target real server to return the response message of the client request message to the target load balancer.
[0073] Optionally, forwarding a response message corresponding to the client request message returned by the target real server to the load balancer, and forwarding the response message corresponding to the client request message returned by the target real server to the target client through the load balancer, including:
[0074] After the target real server completes processing the client request message of the target client, it sends the response message corresponding to the client request message returned by the target real server to the target load balancer, and the source IP of the response message corresponding to the client request message is the target real server IP;
[0075] The target load balancer then modifies the source IP in the response message corresponding to the client request message returned by the target real server into a virtual IP used for communication between the target real server and the target client and returns it to the target client.
[0076] Optionally, a response message corresponding to the client request message is directly returned to the target client through the target real server, including:
[0077] The target real server sets the source IP in the response message corresponding to the target client request processed by the target real server itself to a virtual IP used for communication between the target real server and the target client and directly returns it to the target client.
[0078] The technical solution of the embodiment of the present invention is to determine the response coordination configuration information configured by the distributed coordination system for each real server, and the distributed coordination system supports connection with several real servers and several load balancers. Each response coordination configuration information is used to indicate that after each real server completes processing of the client request message, the delivery target corresponding to the response message returned by each real server is the client that sends the client request message or the load balancer that forwards the client request message to the real server; based on the response coordination configuration information corresponding to the target real server, the delivery target corresponding to the target real server is queried, and the delivery target corresponding to the target real server is the target client that sends the client request message to the target real server or the target load balancer that forwards the client request message sent by the target client to the target real server, thereby realizing the determination of the real server return based on the response coordination configuration information configured on the real server. The delivery target of the response message determines the data transmission path in the request-response process between the client and the real server, and at the same time, it is convenient to flexibly configure the communication connection between the client and the real server according to actual needs; when the delivery target corresponding to the target real server is the target load balancer, the response message corresponding to the client request message returned by the target real server is forwarded to the load balancer, and the response message corresponding to the client request message returned by the target real server is forwarded to the target client through the load balancer, thereby realizing communication between the client and the real server through the load balancer and improving the security of communication; when the delivery target corresponding to the target real server is the target client, the response message corresponding to the client request message is directly returned to the target client through the target real server, thereby realizing direct communication between the client and the real server, improving data processing efficiency, reducing the pressure on the load balancer, and avoiding the load balancer from becoming a system bottleneck.
[0079] The load balancing system provided in the embodiment of the present invention can execute the load balancing method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0080] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0081] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A load balancing method, characterized in that: The method comprises: Determine the response coordination configuration information configured for each real server of the distributed coordination system, the distributed coordination system supports connection with a plurality of real servers and a plurality of load balancers, each of the response coordination configuration information is used to indicate that after each real server completes processing of the client request message, the delivery target corresponding to the response message returned by each real server is the client that sends the client request message or the load balancer that forwards the client request message to the real server; Based on the response coordination configuration information corresponding to the target real server, query the delivery target corresponding to the target real server, wherein the delivery target corresponding to the target real server is a target client that sends a client request message to the target real server or a target load balancer that forwards the client request message sent by the target client to the target real server; When the transfer target corresponding to the target real server is the target load balancer, forwarding the response message corresponding to the client request message returned by the target real server to the load balancer, and forwarding the response message corresponding to the client request message returned by the target real server to the target client through the load balancer; When the transfer target corresponding to the target real server is the target client, the response message corresponding to the client request message is directly returned to the target client through the target real server.
2. The method according to claim 1, characterized in that The method further comprises: In response to an input operation of a reference configuration field for load balancing configuration of each real server, the input value of the reference configuration field is saved and recorded to obtain response coordination configuration information corresponding to each real server; The reference configuration field includes a virtual IP used for the real server to communicate with the client, a uniform resource locator URL used to download static resources, a regular expression used to determine and select a delivery target, and the IP of the real server.
3. The method according to claim 1, characterized in that Before querying the delivery target corresponding to the target real server based on the response coordination configuration information corresponding to the target real server, the method further includes: The virtual IP used for communication between the real server and the client is determined as the target address, and the client request message of the target client is sent to the target load balancer; accordingly, after querying the transfer target corresponding to the target real server based on the response coordination configuration information corresponding to the target real server, it also includes: The received client request message of the target client is forwarded to the target real server through the target load balancer, so that the target real server returns a response message for the client request message.
4. The method according to claim 3, characterized in that Forwarding the received client request message of the target client to the target real server through the target load balancer, including: After the target IP of the client request message of the target client is modified to the target real server IP through the target load balancer, the client request message of the target client is sent to the target real server, and the target real server is waited for to return the response message of the client request message to the target load balancer or there is no need to wait for the target real server to return the response message of the client request message to the target load balancer.
5. The method according to claim 1, characterized in that Forwarding a response message corresponding to the client request message returned by the target real server to the load balancer, and forwarding the response message corresponding to the client request message returned by the target real server to the target client through the load balancer, including: After the target real server completes processing the client request message of the target client, the response message corresponding to the client request message returned by the target real server is sent to the target load balancer, and the source IP of the response message corresponding to the client request message is the target real server IP; The target load balancer then modifies the source IP in the response message corresponding to the client request message returned by the target real server into a virtual IP used for communication between the target real server and the target client and returns it to the target client.
6. The method according to claim 1, characterized in that The target real server directly returns a response message corresponding to the client request message to the target client, including: The target real server sets the source IP in the response message corresponding to the target client request processed by the target real server itself to a virtual IP used for communication between the target real server and the target client and directly returns it to the target client.
7. A load balancing system, characterized in that: The system comprises: The real server configuration is to determine the response coordination configuration information configured by the distributed coordination system for each real server, the distributed coordination system supports connection with a plurality of real servers and a plurality of load balancers, each of the response coordination configuration information is used to indicate that after each real server completes processing of a client request message, the corresponding delivery target of the response message returned by each real server is the client that sends the client request message or the load balancer that forwards the client request message to the real server; The load balancer is configured to query a delivery target corresponding to the target real server based on the response coordination configuration information corresponding to the target real server, wherein the delivery target corresponding to the target real server is a target client that sends a client request message to the target real server or a target load balancer that forwards a client request message sent by the target client to the target real server; The real server is further configured to forward the response message corresponding to the client request message to the load balancer when the delivery target corresponding to the target real server is the target load balancer; and to return the response message corresponding to the client request message directly to the target client when the delivery target corresponding to the target real server is the target client; The load balancer is further configured to forward a response message corresponding to the client request message returned by the target real server to the target client when the transfer target corresponding to the target real server is the target load balancer.
8. The system according to claim 7, characterized in that The system further comprises: The real server is further configured to, in response to an input operation of a reference configuration field for load balancing configuration of each real server, save and record the input value of the reference configuration field to obtain response coordination configuration information corresponding to each real server; The reference configuration field includes a virtual IP used for the real server to communicate with the client, a uniform resource locator URL used to download static resources, a regular expression used to determine and select a delivery target, and the IP of the real server.
9. The system according to claim 7, characterized in that Before querying the delivery target corresponding to the target real server based on the response coordination configuration information corresponding to the target real server, the method further includes: The virtual IP used for communication between the real server and the client is determined as the target address, and the client request message of the target client is sent to the target load balancer; accordingly, after querying the transfer target corresponding to the target real server based on the response coordination configuration information corresponding to the target real server, it also includes: The received client request message of the target client is forwarded to the target real server through the target load balancer, so that the target real server returns a response message for the client request message.
10. The system according to claim 9, characterized in that Forwarding the received client request message of the target client to the target real server through the target load balancer, including: After the target IP of the client request message of the target client is modified to the target real server IP through the target load balancer, the client request message of the target client is sent to the target real server, and the target real server is waited for to return the response message of the client request message to the target load balancer or there is no need to wait for the target real server to return the response message of the client request message to the target load balancer.
Citation Information
Patent Citations
Method for achieving load balancing of server cluster
CN103220354A
Method and device for forwarding VXLAN message
CN110545230A
Method for realizing transparent transmission of load balancer to client IP based on IP tunnel
CN111818151A
Message rewriting method of load balancing device and load balancing device
CN111988405A
Web access method and device based on browser
CN114024947A