GRPC protocol load balancing optimization method
Through the load aggregation decision-making driven by embedded data, the server generates connection adjustment instructions, and the client dynamically adjusts the load balancing of the GRPC protocol, solving the problem of load imbalance in the GRPC protocol and achieving full utilization and balance of resources.
Patent Information
- Application Number
- CN202411274939.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2024-10-29
AI Technical Summary
In the GRPC protocol, after a long connection is established between the client and the server, the load balance cannot be adjusted in real time, causing multiple clients to connect to the same server, causing load imbalance.
By burying data, the server's load aggregation decision-making server generates connection adjustment instructions, instructing the client to adjust the load balancing of the server. The client disconnects the original connection and establishes a new connection according to the instructions, realizing dynamic adjustment of load balancing.
Server-side load balancing can be effectively adjusted without additional load balancing equipment, reducing the complexity of the system architecture and improving the adequacy and balance of resource utilization.
Smart Images

Figure CN118869701A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a method for optimizing GRPC protocol load balancing in the field of communication technology. Background Art
[0002] In the process of adjusting the load balancing of the Google Remote Procedure Call (GRPC), through service registration discovery, such as container cluster management platform (Kubernetes, K8S), service management platform (Nacos), service discovery and load balancing application (Eurka) and other middleware, the client pulls the Internet Protocol (IP) address list of the server from the registration center when it starts and establishes a persistent connection. In this way, once the client establishes a persistent connection with the server, it cannot be adjusted in real time as the service call volume changes, and it is easy to cause multiple clients to connect to the same server, resulting in load imbalance. Summary of the invention
[0003] In order to solve the technical problem of load imbalance caused by multiple clients connecting to the same server in the prior art, the purpose of the present invention is to provide a method for optimizing GRPC protocol load balancing. The technical solution adopted is as follows: In a first aspect, an embodiment of the present invention provides a method for optimizing GRPC protocol load balancing, the method being applied to a server, and the method comprising: In response to the remote procedure GRPC call request sent by the client, the buried point data is determined so that the load aggregation decision server connected to the server sends a connection adjustment instruction to the server based on the buried point data; wherein the connection adjustment instruction is used to indicate the server that needs to be connected; The connection adjustment instruction is sent to the client matched with the load aggregation decision server, so that the client adjusts the load balancing degree of the server based on the connection adjustment instruction.
[0004] In combination with the first aspect above, in some possible implementations, sending the connection adjustment instruction to the client matched by the load aggregation decision server so that the client adjusts the load balancing degree of the server based on the connection adjustment instruction includes: Receiving client address information sent by the load aggregation decision server; wherein the client address information is obtained by the load aggregation decision server based on the address of the server; The connection adjustment instruction is sent to the client indicated by the client address information, so that the client adjusts the load balancing degree of the server based on the connection adjustment instruction.
[0005] In a second aspect, a method for optimizing load balancing of a GRPC protocol is provided, the method being applied to a load aggregation decision server, the method comprising: Get the buried data from the server; Determine the load information of the server based on the tracking data; Generate a connection adjustment instruction based on the load information of the server; wherein the connection adjustment instruction is used to indicate the server to be connected; The connection adjustment instruction is sent to the server.
[0006] In combination with the second aspect, in some possible implementations, determining the load information of the server based on the tracking data includes: Based on the tracking data, determine the number of requests from the server within a preset time period; Based on the number of requests, the load information is determined.
[0007] In combination with the second aspect, in some possible implementations, generating a connection adjustment instruction based on the load information of the server includes: Based on the load information, determining a load adjustment strategy of the server; Based on the load adjustment strategy, the connection adjustment instruction is generated.
[0008] In a third aspect, a method for optimizing GRPC protocol load balancing is provided, the method being applied to a client, and the method comprising: In response to the startup information, a connection is established with the server; Sending a GRPC call request to the server, so that the server responds to the GRPC call request and feeds back a connection adjustment instruction; wherein the connection adjustment instruction is used to indicate the server to be connected; Based on the connection adjustment instruction, the load balancing degree of the server is adjusted.
[0009] In combination with the third aspect, in some possible implementations, establishing a connection with the server in response to the startup information includes: In response to the startup information, selecting a target protocol address from a plurality of server-side protocol addresses; Establish a connection with the server corresponding to the target protocol address.
[0010] In combination with the third aspect, in some possible implementations, adjusting the load balancing degree of the server based on the connection adjustment instruction includes: Based on the connection adjustment instruction, determining a candidate server to be connected; If the candidate server is different from the connected server, a connection is established with the candidate server, and the connection with the connected server is closed to adjust the load balance between the candidate server and the connected server.
[0011] In combination with the third aspect above, in some possible implementations, the method further includes: Get the completion progress of the GRPC call request; When the completion progress indicates that the GRPC call request has been completed, the connection with the connected server is closed.
[0012] In a fourth aspect, a system for optimizing GRPC protocol load balancing is provided, the system comprising: On the server side, load aggregation decision server and client; Wherein, the server is used to execute the method as described in the first aspect; The load aggregation decision server is used to execute the method according to the second aspect; The client is used to execute the method as described in the third aspect.
[0013] In a fifth aspect, a computer program product is provided, which includes: a computer program code, which, when running on a computer, enables the computer to execute the method for optimizing GRPC protocol load balancing in any one of the above-mentioned possible implementations.
[0014] In a sixth aspect, a computer-readable storage medium is provided, which stores a computer program code. When the computer program code runs on a computer, the computer executes the method for optimizing the GRPC protocol load balancing in any one of the above possible implementations.
[0015] The present invention has the following beneficial effects: the server determines the buried point data in response to the remote process GRPC call request sent by the client, so that the load aggregation decision server connected to the server sends a connection adjustment instruction to the server based on the buried point data; wherein the connection adjustment instruction is used to indicate the server that needs to be connected; in this way, after the server receives the GRPC call request sent by the client, it determines the buried point data, so that the load aggregation decision server can generate and send a connection adjustment instruction to the server based on the buried point data, so as to indicate the server that needs to be connected through the connection adjustment instruction. Afterwards, the server sends the connection adjustment instruction to the client matched by the load aggregation decision server, so that the client adjusts the load balancing degree of the server based on the connection adjustment instruction. In this way, the client connects to the server that needs to be connected through the connection adjustment instruction. In this way, the load balancing degree of multiple servers can be effectively adjusted without other load balancing devices, which can not only reduce the complexity of the system architecture, but also solve the problem of load imbalance of multiple servers, so as to improve the sufficiency and balance of resource utilization. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. 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 paying creative work.
[0017] Figure 1 This is a schematic diagram of the implementation architecture of a GRPC protocol load balancing optimization method provided in the related art; Figure 2 It is another implementation architecture diagram of a GRPC protocol load balancing optimization method provided in the related art; Figure 3 It is another implementation architecture diagram of a GRPC protocol load balancing optimization method provided in the related art; Figure 4 It is a schematic diagram of the implementation flow of a method for optimizing GRPC protocol load balancing provided by an embodiment of the present invention; Figure 5 This is an interactive diagram of an implementation method of a GRPC protocol load balancing optimization method provided by an embodiment of the present invention; Figure 6 It is a schematic diagram of the implementation architecture of a method for optimizing GRPC protocol load balancing provided by an embodiment of the present invention; Figure 7 It is another implementation architecture diagram of a method for optimizing GRPC protocol load balancing provided by an embodiment of the present invention; Figure 8 It is a structural schematic diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0018] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of the method for optimizing the load balancing of the GRPC protocol proposed by the present invention, its specific implementation, structure, features and effects, in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form as described.
[0019] Among them, in the description of the embodiments of the present invention, unless otherwise specified, " / " means or, for example, A / B can mean A or B: "and / or" in the text is only a way to describe the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present invention, "multiple" refers to two or more than two.
[0020] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features.
[0021] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0022] In related technologies, GRPC load balancing can be achieved in the following three ways: Method 1: If Figure 1 As shown, the client resolves and obtains the Internet Protocol (IP) address of the server through the Domain Name System (DNS) 101, and then establishes a long connection of the Hypertext Transfer Protocol (HTTP). If there are multiple IP addresses of the server (for example, server 102, server 103 and server 104), the corresponding weight can be configured on the DNS, and when the DNS performs address resolution, the IP address is returned to the client 105 according to the weight, thereby playing a role in load balancing.
[0023] In this solution, when the server instance changes, the DNS resolution rules need to be changed; and the GRPC connection is generally established when the client is started. Once the client and server establish a connection, the client needs to be restarted to change the connection. When the load is unbalanced, it cannot be adjusted in real time.
[0024] Method 2: If Figure 2 As shown, GRPC load balancing is achieved through a load balancer 201 (such as F5, Nginx, etc.). Configure the GRPC server's IP address list on the load balancer 201 (for example, the server's IP address list includes: server 202, server 203, and server 204), and then calculate the GRPC load through the load algorithm and feed it back to the client 205, so that the client 205 can achieve GRPC load balancing. In this solution, an additional load balancer needs to be introduced, resulting in a certain degree of performance loss; and the high availability of the load balancer needs to be guaranteed, which is relatively complex in architecture; and when the server instance changes, the configuration of the load balancer needs to be adjusted.
[0025] Method 3: If Figure 3 As shown, load balancing is achieved through a service registration center 301 and a service discovery 302 (such as K8S (Kubernetes), Nacos, Eurka and other middleware). When the client 303 starts, it pulls the Internet Protocol (IP) address list of the server from the service registration center 301 (the list includes server 31, server 32 and server 33), and then selects one of the server IP addresses (such as server 33) through an algorithm (such as random, weighted random, round-robin, weighted round-robin, etc.) to establish a long connection. This solution can solve the problem that the client can perceive the changes of the server instance in real time, but the problem is that once the client establishes a long connection with the server, it cannot make real-time adjustments as the service call volume changes, and it is easy to cause multiple clients to connect to the same server, which cannot balance and fully utilize resources.
[0026] Based on this, the present invention provides a specific solution for the method of optimizing GRPC protocol load balancing. Figure 4 , which shows a schematic diagram of the implementation process of a method for optimizing GRPC protocol load balancing provided by an embodiment of the present invention. The method can be implemented by the following steps: 401, in response to the remote procedure GRPC call request sent by the client, determine the tracking data so that the load aggregation decision server connected to the server sends a connection adjustment instruction to the server based on the tracking data.
[0027] Here, the connection adjustment instruction is used to indicate the server that needs to be connected. The client can be any type of terminal, and the server can be a server. The load aggregation decision server can be implemented by multiple modules (for example, an information collection module, an information aggregation module, and a decision module). When the client starts, it selects a server through service discovery and establishes a long connection to send a GRPC call request to the server. The server thus responds to the GRPC call request, performs point statistics to obtain the point data, and sends it to the load aggregation decision server to which the server is connected, so that the load aggregation decision server generates and sends a connection adjustment instruction through the point data.
[0028] 402 : Send the connection adjustment instruction to the client matched with the load aggregation decision server, so that the client adjusts the load balancing degree of the server based on the connection adjustment instruction.
[0029] Here, after receiving the connection adjustment instruction sent by the load aggregation decision server, the server sends the connection adjustment instruction to the client so that the client can determine the server with unbalanced load, thereby adjusting the connection status of each server so that each server satisfies the load balancing.
[0030] In an embodiment of the present invention, the server determines the buried data in response to the GRPC call request sent by the client, so that the load convergence decision server sends a connection adjustment instruction to the server based on the buried data; in this way, after the server receives the GRPC call request sent by the client, it counts the buried data, so that the load convergence decision server can generate and send a connection adjustment instruction to the server based on the buried data, so as to indicate the server that needs to be connected through the connection adjustment instruction. Afterwards, the server sends the connection adjustment instruction to the client matched by the load convergence decision server, so that the client adjusts the load balancing degree of the server based on the connection adjustment instruction. In this way, the client connects to the server that needs to be connected through the connection adjustment instruction. In this way, the load balancing degree of multiple servers can be effectively adjusted without other load balancing devices, which can not only reduce the complexity of the system architecture, but also solve the problem of load imbalance of multiple servers, so as to improve the adequacy and balance of resource utilization.
[0031] In some embodiments, a method for optimizing GRPC protocol load balancing is implemented by interacting with a server, a client, and a load aggregation decision server, such as Figure 5 As shown, this can be achieved by following the steps below: 501. The client establishes a connection with the server in response to the startup information.
[0032] like Figure 7As shown, the server (for example, server 71, server 72 or server 73) registers its IP address and port to the service registration center 701. When the client 74 receives the startup information, it selects an IP address of the server through service discovery, that is, selects a server (for example, Figure 7 The server 73 in the process establishes a long connection.
[0033] In some possible implementations, the client selects a target protocol address from among the protocol addresses of multiple servers in response to the startup information, and establishes a connection with the server corresponding to the target protocol address. Here, when the client receives the startup information, that is, when the client starts, it selects an IP address from among the IP addresses of multiple servers in a random or rotating manner to obtain the target protocol address. Afterwards, the client establishes a long connection with the server represented by the target protocol address, thereby being able to establish communication with the server so as to send the GRPC call request to the server.
[0034] 502. The client sends a GRPC call request to the server.
[0035] Here, after the client establishes a persistent connection with the server, it sends a GRPC call request to the server through the persistent connection communication link.
[0036] 503. The server determines the tracking data in response to the GRPC call request sent by the client.
[0037] Here, after receiving the GRPC call request, the server responds to the GRPC request of the client and performs tracking statistics to obtain tracking data. The structure of the tracking data can be a Prometheus time series data structure, and the labels include: client IP, server IP, and the value is the number of requests.
[0038] 504, the load aggregation decision server obtains the tracking point data of the server.
[0039] Here, if Figure 7 As shown, the load aggregation decision server 75 pulls the tracking point data of each server through telemetry. The composition structure of the load aggregation decision server 75 is as follows Figure 6 As shown, the load aggregation decision server 75 includes: an information collection module 601, an information aggregation module 602 and a decision module 603, wherein the information collection module 601 is used to periodically pull the buried data of the server through the client. The information aggregation module 602 is used to aggregate and calculate the buried data of multiple servers to determine the server with unbalanced load.
[0040] 505. The load aggregation decision server determines the load information of the server based on the tracking point data.
[0041] Here, the load aggregation decision server determines the number of requests from the server within a preset time period based on the tracking data, and determines the load information based on the number of requests. The preset time period can be a custom time period, such as 1 minute. The load information may include: the number of clients connected to each server, so as to analyze whether there is a load imbalance among multiple servers. In some possible implementations, it can be achieved by Figure 6 The information aggregation module 602 in the information aggregation module determines the number of requests of the server within a preset time. For example, the information aggregation module 602 aggregates and calculates the buried data of multiple servers, calculates which servers have too high average number of requests in the past 15 minutes, and then analyzes whether it is caused by too many clients connected to this server; if so, calculates which servers have too few requests in the past 15 minutes, and then analyzes whether it is caused by too few clients connected to this server. If so, there is an imbalance in the connection between clients and servers.
[0042] 506. The load aggregation decision server generates a connection adjustment instruction based on the load information of the server.
[0043] The connection adjustment instruction is used to indicate the server that needs to be connected. The load aggregation decision server determines the load adjustment strategy of the server based on the load information; and generates the connection adjustment instruction based on the load adjustment strategy. Here, the load adjustment strategy includes: disconnecting from the connected server, and connecting to a new server, etc. Figure 6 The decision module 603 in the decision-making module 603 forms a load adjustment strategy with the result information of the aggregation analysis, and requests the server through the connection adjustment instruction. The server then sends the connection adjustment instruction to the client to issue a load change command. In this way, the load aggregation decision server generates a load adjustment instruction by analyzing the load information of each server and sends it to the server, so that the server issues a load change command to the client, so that multiple servers meet the load balancing.
[0044] 507, the load aggregation decision server sends the connection adjustment instruction to the server.
[0045] Here, the load aggregation decision server can send the connection adjustment instruction to the server in the form of a GRPC request. Figure 7 As shown, the load aggregation decision server 75 sends the load strategy (ie, the connection adjustment instruction) to the server 73 , so that the server 73 sends the load strategy to the client 74 .
[0046] 508. The server receives the client address information sent by the load aggregation decision server.
[0047] The client address information is obtained by the load aggregation decision server based on the address of the server. In some possible implementations, the load aggregation decision server can query the IP address of the client connected at this time based on the IP address of the server, that is, obtain the client IP address information, and send the client IP address information to the server.
[0048] 509. The server sends the connection adjustment instruction to the client indicated by the client address information.
[0049] Here, the server sends the connection adjustment instruction to the client indicated by the client address information, so that the client adjusts the load balancing degree of the server based on the connection adjustment instruction. The server receives the connection adjustment instruction sent by the load aggregation decision server and the client address information, and then sends the connection adjustment instruction to the client indicated by the client address information in the form of a GRPC request to issue a load change command to the client, so that the client adjusts the load connected to each server to achieve load balancing.
[0050] 510. The client adjusts the load balancing degree of the server based on the connection adjustment instruction.
[0051] Here, the client determines the candidate server to be connected based on the connection adjustment instruction; wherein the candidate server is the server with unbalanced load determined by the information aggregation module in the load aggregation decision server. Figure 7 As shown in the server 71 in . Afterwards, if the candidate server is different from the connected server, a connection is established with the candidate server, and the connection with the connected server is closed to adjust the load balance between the candidate server and the connected server. That is, if the candidate server is a connected server, the connection state is maintained; if the candidate server is not a connected server, a long connection is established with the candidate server, and when the GRPC request ends, the connection with the connected server is closed, thereby adjusting the load balance of multiple servers. As shown in Figure 7 As shown, the client 74 re-establishes a connection with the server 71 to send a new GRPC call request to the server 71, and when the GRPC call request sent to the server 73 is executed, the connection with the server 73 is closed.
[0052] After steps 501 to 510, the client may also obtain the completion progress of the GRPC call request, and close the connection with the connected server when the completion progress indicates that the GRPC call request has been completed.
[0053] Here, after receiving the command, the client executes the command to establish a connection, establishes a connection with the new server, and the new request follows the newly established connection path; at the same time, the completion progress of the GRPC call request is determined to determine whether the GRPC call request has ended. After the client establishes a connection with the new server, if the GRPC call request has been completed, the connection with the connected server is closed. Figure 7 As shown, the client 74 establishes a connection with the server (ie, the candidate server) 71 , and a new call request is transmitted through the link between the server 71 and the client 74 .
[0054] In an embodiment of the present invention, in order to keep the architecture simple and high-performance, a load balancer is not introduced. The problem of uneven load balancing of GRPC is solved by calculating the load on the server side and using GRPC two-way communication. In this way, the problem of GRPC load imbalance under the microservice architecture can be effectively solved without using other load balancing devices, which is efficient and simple in architecture. By aggregating and calculating load information in real time, the problem of GRPC load imbalance during long-term operation can be solved in a relatively real-time manner, and the strategy can be adjusted in real time to achieve full and balanced utilization of resources.
[0055] In other embodiments, the optimization of GRPC protocol load balancing can be achieved by introducing a load balancer (a load balancer refers to a centralized load device or software, such as F5, Nginx, etc.). The application program interface provided by the load balancer is used to communicate with the load balancer, and the load balancing of GRPC is achieved by changing the load strategy of the load balancer.
[0056] An embodiment of the present invention provides a system for load balancing optimization of the GRPC protocol, the system comprising: a server, a load aggregation decision server and a client; wherein the server is used to determine the buried data in response to the remote procedure GRPC call request sent by the client, so that the load aggregation decision server connected to the server sends a connection adjustment instruction to the server based on the buried data; wherein the connection adjustment instruction is used to indicate the server that needs to be connected; the connection adjustment instruction is sent to the client matched by the load aggregation decision server, so that the client adjusts the load balancing degree of the server based on the connection adjustment instruction.
[0057] In some possible implementations, the server is also used to receive client address information sent by the load aggregation decision server; wherein the client address information is obtained by the load aggregation decision server based on the address of the server; and the connection adjustment instruction is sent to the client indicated by the client address information, so that the client adjusts the load balancing degree of the server based on the connection adjustment instruction.
[0058] In some possible implementations, the load aggregation decision server is used to obtain the tracking data of the server; based on the tracking data, determine the load information of the server; based on the load information of the server, generate a connection adjustment instruction; wherein the connection adjustment instruction is used to indicate the server that needs to be connected; and send the connection adjustment instruction to the server.
[0059] In some possible implementations, the load aggregation decision server is also used to determine the number of requests of the server within a preset time period based on the tracking data; and determine the load information based on the number of requests.
[0060] In some possible implementations, the load aggregation decision server is further used to determine a load adjustment strategy of the server based on the load information; and to generate the connection adjustment instruction based on the load adjustment strategy.
[0061] In some possible implementations, the client is used to establish a connection with the server in response to startup information; send a GRPC call request to the server, so that the server responds to the GRPC call request and feeds back a connection adjustment instruction; wherein the connection adjustment instruction is used to indicate the server that needs to be connected; and adjust the load balancing degree of the server based on the connection adjustment instruction.
[0062] In some possible implementations, the client is further configured to select a target protocol address from a plurality of server protocol addresses in response to the startup information; and establish a connection with the server corresponding to the target protocol address.
[0063] In some possible implementations, the client is also used to determine a candidate server to be connected to based on the connection adjustment instruction; if the candidate server is different from the connected server, establish a connection with the candidate server, and close the connection with the connected server to adjust the load balancing between the candidate server and the connected server.
[0064] In some possible implementations, the client is further used to obtain the completion progress of the GRPC call request; when the completion progress indicates that the GRPC call request has been completed, close the connection with the connected server.
[0065] Optionally, the transmission medium can be a wired link (such as but not limited to coaxial cable, optical fiber and digital subscriber line (DSL), etc.) or a wireless link (such as but not limited to wireless Fidelity (WIFI), Bluetooth and mobile device network, etc.). It should be noted that the system provided in the above embodiment is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the computer device is divided into different functional modules to complete all or part of the functions described above. In addition, the method embodiments provided in the above embodiments belong to the same concept. The specific implementation process is detailed in the method embodiments, which will not be repeated here.
[0066] Figure 8 is a schematic diagram of the structure of a computer device provided by an embodiment of the present invention. Figure 8 As shown, the computer device 800 includes: a memory 801, a processor 802, and a computer program 803 stored in the memory 801 and running on the processor 802, wherein when the processor 802 executes the computer program 803, the computer device can execute any one of the GRPC protocol load balancing optimization methods introduced above.
[0067] In addition, an embodiment of the present invention also protects a system, which may include a memory and a processor, wherein an executable program code is stored in the memory, and the processor is used to call and execute the executable program code to perform a method for optimizing GRPC protocol load balancing provided by an embodiment of the present invention. In this embodiment, the system may be divided into functional modules according to the above method example. For example, each functional module may be corresponding to the functional modules, or two or more functions may be integrated into one processing module, and the above integrated modules may be implemented in the form of hardware. It should be noted that the division of modules in this embodiment is schematic, which is only a logical functional division, and there may be other division methods in actual implementation. It should be noted that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module, which will not be repeated here.
[0068] It should be understood that the system provided in this embodiment is used to execute the above-mentioned method of GRPC protocol load balancing optimization, so the same effect as the above-mentioned implementation method can be achieved. In the case of an integrated unit, the system may include a processing module and a storage module. Among them, when the system is applied to a device, the processing module can be used to control and manage the actions of the device. The storage module can be used to support the device to execute mutual program codes, etc. Among them, the processing module can be a processor or a controller, which can implement or execute various exemplary logical blocks, modules and circuits described in conjunction with the disclosure of the present invention. The processor can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, etc., and the storage module can be a memory.
[0069] In addition, the system provided by the embodiment of the present invention may be a chip, a component or a module, and the chip may include a connected processor and a memory; wherein the memory is used to store instructions, and when the processor calls and executes the instructions, the chip can execute a method for optimizing the load balancing of the GRPC protocol provided in the above embodiment. This embodiment also provides a computer-readable storage medium, in which a computer program code is stored, and when the computer program code is run on a computer, the computer executes the above-mentioned related method steps to implement a method for optimizing the load balancing of the GRPC protocol provided in the above embodiment.
[0070] This embodiment also provides a computer program product, when the computer program product is run on a computer, the computer executes the above-mentioned related steps to implement a method for optimizing the load balancing of the GRPC protocol provided in the above embodiment. Among them, the system, computer-readable storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding method provided above, so the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above, and will not be repeated here. Through the description of the above implementation mode, the technicians in the relevant field can understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In practical applications, the above-mentioned function allocation can be completed by different functional modules as needed, that is, the internal structure of the system is divided into different functional modules to complete all or part of the functions described above. In the embodiments provided by the present invention, it should be understood that the disclosed system and method can be implemented in other ways. For example, the system embodiment described above is only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, system or unit, which may be electrical, mechanical or other forms.
[0071] It should be noted that the sequence of the above-mentioned embodiments of the present invention is only for description and does not represent the advantages and disadvantages of the embodiments. The process depicted in the accompanying drawings does not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multi-task processing and parallel processing are also possible or may be advantageous. The various embodiments in this specification are described in a progressive manner, and the same and similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments. The above content is only a specific implementation method of the present invention, but the protection scope of the present invention is not limited to this. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be covered within the protection scope of the present invention.
Claims
1. A method for optimizing GRPC protocol load balancing, characterized in that: The method is applied to the server, and the method includes: In response to the remote procedure GRPC call request sent by the client, the buried point data is determined so that the load aggregation decision server connected to the server sends a connection adjustment instruction to the server based on the buried point data; wherein the connection adjustment instruction is used to indicate the server that needs to be connected; The connection adjustment instruction is sent to the client matched with the load aggregation decision server, so that the client adjusts the load balancing degree of the server based on the connection adjustment instruction.
2. According to a method for optimizing GRPC protocol load balancing according to claim 1, it is characterized in that: The step of sending the connection adjustment instruction to the client matched with the load aggregation decision server, so that the client adjusts the load balancing degree of the server based on the connection adjustment instruction, includes: Receiving client address information sent by the load aggregation decision server; wherein the client address information is obtained by the load aggregation decision server based on the address of the server; The connection adjustment instruction is sent to the client indicated by the client address information, so that the client adjusts the load balancing degree of the server based on the connection adjustment instruction.
3. A method for optimizing GRPC protocol load balancing, characterized in that: The method is applied to a load aggregation decision service end, and the method comprises: Get the buried data from the server; Determine the load information of the server based on the tracking data; Generate a connection adjustment instruction based on the load information of the server; wherein the connection adjustment instruction is used to indicate the server to be connected; The connection adjustment instruction is sent to the server.
4. A method for optimizing GRPC protocol load balancing according to claim 3, characterized in that: The determining the load information of the server based on the tracking data includes: Based on the tracking data, determine the number of requests from the server within a preset time period; Based on the number of requests, the load information is determined.
5. A method for optimizing GRPC protocol load balancing according to claim 3, characterized in that: The generating a connection adjustment instruction based on the load information of the server includes: Based on the load information, determining a load adjustment strategy of the server; Based on the load adjustment strategy, the connection adjustment instruction is generated.
6. A method for optimizing GRPC protocol load balancing, characterized in that: The method is applied to a client, and the method comprises: In response to the startup information, a connection is established with the server; Sending a GRPC call request to the server, so that the server responds to the GRPC call request and feeds back a connection adjustment instruction; wherein the connection adjustment instruction is used to indicate the server to be connected; Based on the connection adjustment instruction, the load balancing degree of the server is adjusted.
7. A method for optimizing GRPC protocol load balancing according to claim 6, characterized in that: The step of establishing a connection with the server in response to the startup information includes: In response to the startup information, selecting a target protocol address from a plurality of server-side protocol addresses; Establish a connection with the server corresponding to the target protocol address.
8. A method for optimizing GRPC protocol load balancing according to claim 6, characterized in that: The step of adjusting the load balancing degree of the server based on the connection adjustment instruction includes: Based on the connection adjustment instruction, determining a candidate server to be connected; If the candidate server is different from the connected server, a connection is established with the candidate server, and the connection with the connected server is closed to adjust the load balance between the candidate server and the connected server.
9. A method for optimizing GRPC protocol load balancing according to claim 6, characterized in that: The method further comprises: Get the completion progress of the GRPC call request; When the completion progress indicates that the GRPC call request has been completed, the connection with the connected server is closed.
10. A system for optimizing GRPC protocol load balancing, characterized in that: The system comprises: On the server side, load aggregation decision server and client; Wherein, the server is used to execute the method according to claim 1 or 2; The load aggregation decision server is used to execute the method according to any one of claims 3 to 5; The client is used to execute the method according to any one of claims 6 to 9.
