CN114726863B - Method, device, system and storage medium for load balancing - Google Patents

Method, device, system and storage medium for load balancing Download PDF

Info

Publication number
CN114726863B
CN114726863B CN202210448147.1A CN202210448147A CN114726863B CN 114726863 B CN114726863 B CN 114726863B CN 202210448147 A CN202210448147 A CN 202210448147A CN 114726863 B CN114726863 B CN 114726863B
Authority
CN
China
Prior art keywords
application service
xds
load balancing
agent
application
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210448147.1A
Other languages
Chinese (zh)
Other versions
CN114726863A (en
Inventor
王夕宁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba Cloud Computing Ltd
Original Assignee
Alibaba Cloud Computing Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba Cloud Computing Ltd filed Critical Alibaba Cloud Computing Ltd
Priority to CN202210448147.1A priority Critical patent/CN114726863B/en
Publication of CN114726863A publication Critical patent/CN114726863A/en
Application granted granted Critical
Publication of CN114726863B publication Critical patent/CN114726863B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • H04L67/1014Server selection for load balancing based on the content of a request

Abstract

The application provides a method, equipment, a system and a storage medium for load balancing, wherein the method is applied to a first application service in a cluster, and the first application service comprises the following steps: a first application service instance and a xDS proxy, the first application service instance comprising: a first workload and xDS client; and receiving xDS the first load balancing policy information sent by the server through the xDS proxy, forwarding the first load balancing policy information to the xDS client, and sending a call request to one or more target second application service instances in the second application service through the xDS client according to the first load balancing policy information when the first workload needs to call the second application service in the cluster, so as to realize load balancing of each second application service instance in the second application service. Through the process, load balancing can be realized in the first application service instance, and the call request is not required to be forwarded by the grid agent, so that the service response time is reduced.

Description

Method, device, system and storage medium for load balancing
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method, an apparatus, a system, and a storage medium for load balancing.
Background
In a micro-service architecture, an application may include multiple application services, each of which is focused on completing only one task, and thus, the application may be considered a collection of multiple application services. Individual application services corresponding to one application may be deployed independently, and each application service may be deployed on one or more servers.
Since different application services may be deployed on different servers, calls between different application services involve communication between different servers. To facilitate secure and reliable communication between different application services, a micro-service administration framework-service mesh (service mesh) is proposed. A service grid is a configurable infrastructure layer that serves individual service applications, aiming at handling a large number of network-based inter-process communications between different application services. Specifically, in the service grid framework, one grid agent (also referred to as a sidecar) is deployed for each application service, and all traffic going into and out of the application service passes through its corresponding grid agent. In this way, calls between application services translate into calls between grid agents.
In a load balancing scenario, when a first application service invokes a second application service, the first application service sends an invocation request to its corresponding grid agent, and the grid agent determines which workload (or referred to as a service instance) of the second application service to forward the invocation request to based on a load balancing policy, so as to ensure load balancing of each workload in the second application service. However, since all call requests need to be forwarded through the grid proxy, the service response time length increases.
Disclosure of Invention
The embodiment of the application provides a method, equipment, a system and a storage medium for load balancing, which are used for reducing service response time of service call among different application services.
In a first aspect, an embodiment of the present application provides a method for load balancing, applied to a first application service in a cluster, where the first application service includes: a first application service instance and a service discovery xDS proxy, the first application service instance comprising: a first workload and xDS client; the method comprises the following steps:
receiving xDS, by the xDS agent, first load balancing policy information sent by a server, and forwarding the first load balancing policy information to the xDS client;
When the first workload needs to call the second application service in the cluster, sending a call request to one or more target second application service instances in the second application service through the xDS client according to the first load balancing policy information so as to realize load balancing of each second application service instance in the second application service.
In a possible implementation manner, before the xDS agent receives xDS the first load balancing policy information sent by the server, the method further includes:
starting the xDS agent when receiving a starting instruction corresponding to the first application service instance;
acquiring first starting configuration information from the xDS server through the xDS agent, wherein the first starting configuration information is configuration information required for starting the first application service instance;
and starting the first application service instance according to the first starting configuration information.
In a possible implementation manner, the acquiring, by the xDS agent, the first start-up configuration information from the xDS server includes:
establishing a connection with the xDS server through the xDS agent;
receiving, by the xDS agent, second load balancing policy information from the xDS server;
And generating, by the xDS agent, the first start-up configuration information according to the second load balancing policy information, where the first start-up configuration information includes the second load balancing policy information.
In a possible implementation, establishing a connection with the xDS server through the xDS agent includes:
acquiring certificate information through the xDS proxy, and sending a connection establishment request to the xDS server according to the certificate information, wherein the connection establishment request comprises the certificate information; wherein the credential information is configured by an agent manager for the xDS agent; the agent manager is used for managing xDS agents in each application service in the cluster;
a connection setup response is received from the xDS server by the xDS agent, the connection setup response being sent after the authentication of the credential information by the xDS server is passed.
In a possible implementation manner, starting the xDS agent includes:
acquiring second start-up configuration information required to start up the xDS agent, the second start-up configuration information configured by the agent manager for the xDS agent;
and starting the xDS agent according to the second starting configuration information.
In a possible implementation manner, when the first workload needs to call a second application service in the cluster, sending, by the xDS client, a call request to one or more target second application service instances in the second application service according to the first load balancing policy information, including:
the following steps are executed by the xDS client:
intercepting the calling request when the first workload is monitored to send the calling request, and analyzing the calling request to determine the second application service to be called;
acquiring a load balancing strategy corresponding to the second application service from the first load balancing strategy information, and determining one or more target second application service instances from a plurality of second application service instances included in the second application service according to the load balancing strategy corresponding to the second application service;
and sending the call request to the one or more target second application service instances.
In a possible implementation manner, after the parsing the call request and determining the second application service to be called, the method further includes:
Determining whether a connection channel exists between the first application service and the second application service;
if the first application service does not exist, a connection channel between the first application service and the second application service is established according to the address information and the port information of the second application service.
In one possible implementation, the xDS agents in different application services in the cluster are implemented based on the same programming language framework.
In a second aspect, embodiments of the present application provide a method for load balancing, applied to a service discovery xDS server, the method comprising:
acquiring first load balancing strategy information corresponding to a first application service instance in a cluster;
and sending the first load balancing policy information to a xDS agent corresponding to the first application service instance, so that the xDS agent forwards the first load balancing policy information to xDS clients in the first application service instance, wherein the first load balancing policy information is used for realizing load balancing of each second application service instance in the second application service instance when a first workload in the first application service instance invokes the second application service in the cluster.
In a third aspect, an embodiment of the present application provides a method for load balancing, applied to a system for load balancing, where the system includes: a service discovery xDS server deployed on a control plane layer and a cluster deployed on a data plane layer, wherein the cluster comprises a first application service and a second application service, the first application service comprises a first application service instance and xDS agents, the first application service instance comprises a first workload and xDS clients, and the second application service comprises a plurality of second application service instances; the method comprises the following steps:
the service discovery xDS server obtains first load balancing policy information corresponding to the first application service instance and sends the first load balancing policy information to the xDS agent corresponding to the first application service instance;
the first application service forwards the first load balancing policy information to the xDS client through the xDS agent;
and when the first workload needs to call the second application service in the cluster, the first application service sends a call request to one or more target second application service instances in the second application service according to the first load balancing strategy information through the xDS client so as to realize load balancing of each second application service instance in the second application service.
In a fourth aspect, an embodiment of the present application provides an apparatus for load balancing, applied to a first application service in a cluster, where the first application service includes: a first application service instance and a service discovery xDS proxy, the first application service instance comprising: a first workload and xDS client; the device comprises:
the policy acquisition module is used for receiving xDS first load balancing policy information sent by the server through the xDS proxy and forwarding the first load balancing policy information to the xDS client;
and the policy execution module is used for sending a call request to one or more target second application service instances in the second application service according to the first load balancing policy information through the xDS client when the first workload needs to call the second application service in the cluster so as to realize load balancing of each second application service instance in the second application service.
In a fifth aspect, an embodiment of the present application provides an apparatus for load balancing, applied to a service discovery xDS server, the apparatus comprising:
the acquisition module is used for acquiring first load balancing strategy information corresponding to a first application service instance in the cluster;
The sending module is configured to send the first load balancing policy information to a xDS proxy corresponding to the first application service instance, so that the xDS proxy forwards the first load balancing policy information to a xDS client in the first application service instance, where the first load balancing policy information is used to implement load balancing of each second application service instance in the second application service instance when a first workload in the first application service instance invokes the second application service in the cluster.
In a sixth aspect, embodiments of the present application provide a system for load balancing, including: a service discovery xDS server deployed on a control plane layer and a cluster deployed on a data plane layer, wherein the cluster comprises a first application service and a second application service, the first application service comprises a first application service instance and xDS agents, the first application service instance comprises a first workload and xDS clients, and the second application service comprises a plurality of second application service instances;
the xDS server is configured to send first load balancing policy information to the xDS agent;
the xDS proxy is configured to forward the first load balancing policy information to the xDS client;
The xDS client is configured to send a call request to one or more target second application service instances in the second application service according to the first load balancing policy information when the first workload needs to call the second application service in the cluster, so as to implement load balancing of each second application service instance in the second application service.
In a possible implementation manner, the method further includes: an agent manager deployed at the control plane layer;
the proxy manager is configured to distribute second startup configuration information to the xDS proxy in each application service in the cluster and/or distribute certificate information to the xDS proxy in each application service in the cluster.
In a seventh aspect, embodiments of the present application provide an electronic device, including: a memory and at least one processor, the memory having stored therein a computer program configured to be executed by the at least one processor to implement the method of any of the first aspects or the method of any of the second aspects.
In an eighth aspect, embodiments of the present application provide a computer-readable storage medium having a computer program stored therein, which when executed by a processor implements the method according to any of the first aspects or the method according to any of the second aspects.
In a ninth aspect, embodiments of the present application provide a computer program product comprising a computer program which, when executed by a processor, implements a method according to any of the first aspect or a method according to any of the second aspect.
The method, the device, the system and the storage medium for load balancing are applied to a first application service in a cluster, wherein the first application service comprises the following steps: a first application service instance and a xDS proxy, the first application service instance comprising: a first workload and xDS client; the method comprises the following steps: and receiving xDS first load balancing policy information sent by a server through a xDS proxy, forwarding the first load balancing policy information to the xDS client, and sending a call request to one or more target second application service instances in the second application service through xDS client according to the first load balancing policy information when a first workload needs to call a second application service in a cluster, so as to realize load balancing of each second application service instance in the second application service. Through the process, load balancing can be realized in the first application service instance, grid agents do not need to be deployed for the first application service instance, and when the first application service instance calls the second application service, a call request does not need to be forwarded through the grid agents, so that service response time can be reduced.
Drawings
FIG. 1 is a schematic illustration of a service grid;
FIG. 2 is a schematic diagram of a system architecture according to an embodiment of the present application;
fig. 3 is a flow chart of a method for load balancing according to an embodiment of the present application;
fig. 4 is a flowchart of another method for load balancing according to an embodiment of the present application;
FIG. 5 is a schematic diagram of another system architecture according to an embodiment of the present disclosure;
fig. 6 is a flowchart of an application service start management method according to an embodiment of the present application;
FIG. 7 is a schematic diagram of yet another system architecture provided in an embodiment of the present application;
fig. 8 is a schematic structural diagram of an apparatus for load balancing according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of another apparatus for load balancing according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
The terms first, second and the like in the description of embodiments of the present application, in the claims and in the above-described figures, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the present application described herein may be implemented in other sequences than those illustrated or otherwise described herein.
It should be understood that the terms "comprises" and "comprising," and any variations thereof, as used herein, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements that are expressly listed or inherent to such process, method, article, or apparatus.
In the description of the embodiments of the present application, the term "corresponding" may indicate that there is a direct correspondence or an indirect correspondence between the two, or may indicate that there is an association between the two, or may indicate a relationship between the two and the indicated, configured, or the like.
To facilitate an understanding of the technical solution of the present application, a service grid framework and related concepts and terms will be first described in connection with fig. 1.
Fig. 1 is a schematic diagram of a service grid. The service grid 100 is primarily used to facilitate secure and reliable communication between a plurality of micro services, which are defined as applications that are broken down into a plurality of smaller services or instances and run on different clusters/machines.
As shown in fig. 1, the micro-service includes an application service instance a and an application service instance B, which form a functional application layer of the service grid 100. In one embodiment, application service instances A and B run in the form of containers/processes on a machine/workload container group (machine/pod) 108.
In one embodiment, application service instance a may be a commodity query service and application service instance B may be a commodity ordering service.
As shown in fig. 1, an application service instance a and a grid agent (sidecar) 103 coexist in a machine/workload container group 114, and an application service instance B and a grid agent 105 coexist in the machine/workload container 114. Grid agents 103 and 105 form a data plane layer (data plane) of service grid 100. Wherein the grid agent 103 is running in the form of a container/process 104, the grid agent 105 is running in the form of a container/process 106, and the grid agent 103 and the application service instance a can communicate bi-directionally, and the grid agent 105 and the application service instance B can communicate bi-directionally. In addition, two-way communication is also possible between the grid agent 103 and the grid agent 105.
In one embodiment, all traffic for application service instance A is routed through grid agent 103 to the appropriate destination and all network traffic for application service instance B is routed through grid agent 105 to the appropriate destination. It should be noted that, the network traffic mentioned herein includes, but is not limited to, traffic based on the following forms: hypertext transfer protocol (hyper text transfer protocol, HTTP), representational state transfer (representational state transfer, REST), remote procedure call (remote procedure call, RPC), remote dictionary service (remote dictionary server, redis), etc.
In one embodiment, the functionality of the extended data plane layer may be implemented by writing custom filters (filters) for the grid agents 103, 105 in the service grid 100, which may be configured to enable the service grid to properly proxy service traffic for service interworking and service remediation. Grid agent 103 and grid agent 105 may be configured to perform at least one of the following functions: service discovery (service discovery), health checking (routing), load balancing (load provisioning), authentication and authorization (authentication and authorization), and observability (observability).
As shown in fig. 1, the service grid 100 also includes a control plane layer. Wherein the control plane layer may be a set of services running in a dedicated namespace, hosted by the hosting control plane component 101 at the machine/workload container set 102. As shown in fig. 1, managed control plane component 101 is in bi-directional communication with grid agent 103 and grid agent 105. Managed control plane component 101 is configured to perform some of the functions of control management. For example, managed control plane component 101 receives data transmitted by grid agent 103 and grid agent 105, which may be further aggregated. Managed control plane component 101 may also provide user-oriented application program interfaces (application programming interface, APIs) to facilitate manipulation of network behavior, provisioning configuration data to grid agents 103 and 105, and the like.
Under the micro-service architecture, the application service instance has a dynamically allocated network address, and the network address of the application service instance is dynamically changed along with automatic expansion, failure and release and upgrade of the application service. Therefore, a mechanism is needed to support the service consumer to timely perceive and acquire the latest address of the application service instance when the address of the application service instance provided by the service provider is changed, and the mechanism is a service discovery mechanism.
The method and the device are suitable for a scene of realizing load balancing of the target application service when service call is carried out among different application services. How load balancing of target application services is achieved based on the service discovery mechanism is described below in connection with fig. 1.
The service discovery mechanism is two processes: a self-registration procedure and a service discovery procedure. In the self-registration process, each application service instance corresponds to a proxy grid, and is responsible for calling a registration interface of a service registry to register an instance address and regularly calling a heartbeat interface to renew service instance registration information. For example, in fig. 1, the application service instance a registers its own address information with the managed control plane component 101 by calling the registration interface, and the application service instance B registers its own address information with the managed control plane component 101 by calling the registration interface. In addition, the operator may configure load balancing policy information corresponding to each application service to the managed control plane component 101.
In the service discovery process, the managed control plane component 101 pushes the following information to the grid agents (e.g., grid agent 103, grid agent 105) corresponding to each application service instance: address information of each application service instance, a load balancing policy corresponding to each application service, and the like. The push information received by the grid agent is cached locally.
When a first application service (for example, the application service instance a in fig. 1) needs to call a second application service, a call request is forwarded to the grid agent 103, the grid agent 103 determines an address of the second application service and a load balancing policy of the second application service by querying locally cached push information, and selects an available application service instance (for example, the application service instance B in fig. 1) from a plurality of application service instances of the second application service based on the load balancing policy of the second application service. Further, the grid agent 103 forwards the call request to the grid agent 105 corresponding to the application service instance B. The grid agent 105 sends a call request to the application service instance B, thereby completing the call of the application service instance a to the application service instance B. Through the process, load balancing of each application service instance in the second application service is achieved.
In the service discovery process described above, communication between managed control plane component 101 and network proxy 103 may be based on (x discovery service, xDS) protocols. The hosting control plane component 101 serves as a server of the xDS protocol, and the grid agent 103 serves as a client of the xDS protocol. Among them, xDS protocols include, but are not limited to, the following:
A listener discovery service (listener discovery service, LDS);
a route discovery service (route discovery service, RDS);
a range route discovery service (scoped route discovery service, SRDS);
a virtual host discovery service (virtual host discovery service, VHDS);
cluster discovery service (cluster discovery service, CDS);
an endpoint discovery service (endpoint discovery service, EDS);
a secret discovery service (secret discovery service, SDS);
runtime discovery service (runtime discovery service, RTDS).
Based on the service grid shown in fig. 1, the grid agent realizes the service governance function, so that each application service instance can only pay attention to the application layer function of the application service instance, and does not need to pay attention to the service governance functions such as load balancing and the like, and the decoupling of the function application layer and the data plane layer is realized.
In the service grid architecture shown in fig. 1, each application service instance corresponds to a grid proxy, and these application service instances may be referred to as proxy (proxy) modes. When load balancing is realized based on the proxy mode, service response time length is increased because all call requests need to be forwarded by the grid proxy.
In order to solve the technical problems, embodiments of the present application provide a method, an apparatus, a system, and a storage medium for load balancing. In the technical scheme of the application service instance, a no-proxy (proxyless) mode can be adopted, namely, a grid proxy corresponding to the application service instance is canceled, and load balancing is realized inside the application service instance. An application scenario according to an embodiment of the present application is described below with reference to fig. 2.
Fig. 2 is a schematic diagram of a system architecture according to an embodiment of the present application. As shown in fig. 2, the system architecture includes: xDS servers deployed at the control plane layer, and micro-service architecture-based clusters deployed at the data plane layer. Wherein the xDS server corresponds to the managed control plane component 101 in fig. 1. The cluster includes a plurality of application services. A first application service and a second application service are illustrated in fig. 2 as examples. It should be understood that the number of clusters included in the system architecture may be one or more, which is not limited in this embodiment.
With continued reference to fig. 2, the first application service includes: the first application service instance comprises: a first workload and a xDS client. Wherein the first workload is used to provide a service, such as a merchandise inquiry service, a merchandise ordering service, etc. The xDS client is used as a xDS client, the xDS server is used as a xDS server, and the both are used for realizing a service discovery process based on the xDS protocol.
The first workload may invoke other application services. Taking the scenario of invoking the second application service as an example, the second application service includes a plurality of second application service instances, and 3 second application service instances are illustrated in fig. 2 as an example.
With continued reference to fig. 2, the first application service further includes: xDS agent (xDS agent). In the embodiment of the application, the xDS client and the xDS server do not directly establish a connection channel, but an xDS agent is deployed between the xDS server and the xDS client. That is, the xDS agent acts as an intermediary between the xDS client and the xDS server, i.e., the xDS agent establishes a connection with the xDS server, and the xDS agent establishes a connection with the xDS client. In this way, the xDS agent can receive xDS the server pushed load balancing policy information and provide xDS the load balancing policy information to the client. Thus, when the first workload invokes the second application service, the xDS client may send an invocation request to one or more target second application service instances of the second application service based on the load balancing policy information to implement load balancing of the second application service.
It should be appreciated that a plurality of first application service instances may be included in the first application service, only one being illustrated in fig. 2. When the first application service includes a plurality of first application service instances, each first application service instance includes a first workload and a corresponding xDS client. Each first application service instance corresponds to a xDS agent.
In the embodiment of the application, the first application service instance adopts the agent-free mode, and when the first application service instance calls the second application service, the call request does not need to be forwarded by the grid agent, so that the service response time can be reduced.
The technical scheme provided by the embodiment of the application is described in detail through specific embodiments. It should be noted that, the technical solution provided in the embodiments of the present application may include some or all of the following, and the following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be described in some embodiments.
Fig. 3 is a flow chart of a method for load balancing according to an embodiment of the present application. The method of the present embodiment can be applied to a system architecture as shown in fig. 2. The system architecture comprises: xDS servers deployed at the control plane layer and clusters deployed at the data plane layer. The cluster may be, for example, a Kubernetes cluster.
The cluster includes a plurality of application services. Taking a cluster including a first application service and a second application service as an example, the first application service includes: a first application service instance and a xDS proxy. The first application service instance includes a first workload and a xDS client. The second application service includes a plurality of second application service instances.
As shown in fig. 3, the method of the present embodiment includes:
s301: the xDS server sends the first load balancing policy information to the xDS agent.
In this embodiment, xDS servers are deployed on the control plane layer, and xDS servers adopt a managed mode for cluster management. Where the managed mode refers to that the components for implementing the cluster management function run on a separate server, rather than running in a certain cluster of the data plane layer. Optionally, the xDS server may be a component hosted in the cloud network, so that a cluster management function may be implemented in the cloud, and the operation and maintenance complexity and cost of the cluster user are reduced.
Communication between the xDS server and the xDS agent may be based on the xDS protocol. In particular, communication between the xDS server and xDS agents is via the APIs of the xDS protocol, both communication mechanisms being essentially publish/subscribe mechanisms, wherein each API allows subscription to different types of services. xDS the letter x indicates that it is a variable, possible options x include, but are not limited to: LDS, RDS, SRDS, VHDS, CDS, EDS, SDS, RTDS. Illustratively, all application service instances in the cluster register themselves to the xDS server through the EDS API. When a certain application service instance is overloaded, it may log off itself with the xDS server, and then may register again with the xDS server when it is again available.
In this embodiment, taking a scenario in which the first application service invokes the second application service as an example, the first load balancing policy information sent by the xDS server to the xDS agent at least includes a load balancing policy corresponding to the second application service. For example, the first load balancing policy information may include load balancing policies corresponding to all application services in the cluster. For another example, the first load balancing policy information may include a load balancing policy corresponding to each other application service that needs to be invoked by the first application service.
At the control plane layer, a user can configure a load balancing policy of each application service to the xDS server according to the load balancing requirement of each application service in the cluster. For example, taking the second application service as an example, assuming that the second application service includes 3 second application service instances, which are respectively a second application service instance a, a second application service instance B, and a second application service instance C, the user may configure, for example, the traffic ratio of the second application service instance a is 20%, the traffic ratio of the second application service instance B is 30%, and the traffic ratio of the second traffic service instance C is 50% to the xDS server. In this case, the load balancing policy corresponding to the second application service is used to indicate traffic ratio information corresponding to each of the 3 second application service instances.
In this embodiment, when a load balancing policy corresponding to a certain application service is changed, for example, when traffic ratio information configured by a user on a second application service is changed, or when a certain application service instance in the second application service is logged out/re-registered, the xDS server pushes updated first load balancing policy information to the xDS agent.
S302: the xDS agent forwards the first load balancing policy information to the xDS client.
In this embodiment of the application, the agent xDS acts as an intermediary between the xDS server and the xDS client, and the agent xDS forwards the first load balancing policy information to the xDS client after receiving the first load balancing policy information from the xDS server. After the xDS client receives the first load balancing information, the first load balancing information can be cached for later use when the service call is required by the first application service instance.
S303: when the first workload needs to call the second application service, a call request is sent to one or more target second application service instances in the second application service through the xDS client according to the first load balancing policy information, so that load balancing of each second application service instance in the second application service is achieved.
For example, assume that the xDS client determines, according to the first load balancing policy information, traffic ratios corresponding to 3 second application service instances in the second application service respectively as follows: 20%,30%,50%, then xDS client may determine which second application service instance or instances to send the call request to based on the traffic duty cycle. In this process, the xDS client may determine one or more target second application service instances among the plurality of second application service instances included in the second application service by combining the call condition of the client to each instance of the second application service in the history period and the first load balancing policy information, and send a call request to the one or more target second application service instances, thereby implementing load balancing of each second application service instance in the second application service.
The method for load balancing provided by the embodiment is applied to a first application service in a cluster, and the first application service comprises the following steps: a first application service instance and a xDS proxy, the first application service instance comprising: the method comprises the steps that a first workload and a xDS client side receive first load balancing strategy information sent by a xDS server through a xDS proxy, and forward the first load balancing strategy information to the xDS client side; when a first workload needs to call a second application service in a cluster, a call request is sent to one or more target second application service instances in the second application service through a xDS client according to the first load balancing policy information, so that load balancing of each second application service instance in the second application service is achieved. Through the process, load balancing can be realized in the first application service instance, grid agents do not need to be deployed for the first application service instance, and when the first application service instance calls the second application service, a call request does not need to be forwarded through the grid agents, so that service response time can be reduced.
In addition, in the embodiment of the present application, each second application service instance in the second application service may be in a proxy mode or a no-proxy mode, which is not limited in the embodiment of the present application. When the second application service instance is in the proxy mode, the second application service further comprises grid proxies corresponding to the second application service instances. When the second application service instance is in the agentless mode, the second application service instance includes: a second workload and a xDS client.
Further, in an actual application scenario, each application service in the cluster is typically implemented based on a specific language frame, and the language frames on which different application services are based are typically different. Application service instances in each application service are commonly referred to as xDS processors that are framework-specific or software development kits (Software Development Kit, SDKs). In the embodiment of the application, the first application service instance and the xDS agent can be implemented in a decoupled manner. That is, for each application service, its corresponding xDS agent need not be implemented based on the particular language framework of that application service, but rather the xDS agents in different application services in a cluster can be implemented based on the same programming language framework. Wherein, based on the same programming language framework implementation means: the method is realized by adopting the same programming language, or realized on the basis of the same programming framework, or realized on the basis of the same SDK.
Thus, instead of developing a corresponding xDS agent for each application service, a unified xDS agent is developed for all application services, and all application services in the cluster can share the code of one xDS agent, so that development cost and maintenance cost can be reduced.
It can be seen that the embodiment of the application realizes a mechanism for unified management of various application services in the cluster through the xDS server. By deploying xDS agents for application service instances, and implementing xDS agents in different application services based on the same programming language framework, unified management of each application service can be conveniently implemented even in a scenario where each application service in a cluster is based on a different programming language framework.
In addition, in the embodiment of the application, the proxy mode is allowed to be adopted by one part of application service examples in the cluster, and the non-proxy mode is adopted by the other part of application service examples. That is, even in a heterogeneous cluster (application services in proxy mode and non-proxy mode exist at the same time), unified management of each application service by the xDS server can be realized.
Based on the embodiment shown in fig. 3, the technical solution of the present application will be described in more detail below in connection with a specific embodiment.
Fig. 4 is a flowchart of another method for load balancing according to an embodiment of the present application. As shown in fig. 4, the method of the present embodiment includes:
s401: the xDS server sends the first load balancing policy information to the xDS agent.
S402: the xDS agent forwards the first load balancing policy information to the xDS client.
It should be understood that the specific implementation of S401 and S402 is similar to the embodiment shown in fig. 3, and will not be described here.
S403: and xDS client intercepts the call request when monitoring that the first workload sends the call request, and analyzes the call request to determine a second application service to be called.
The first workload may send a call request to other application services when the other application services need to be invoked. In this embodiment, the xDS client has a listening function for the first workload, and may monitor the call request sent by the first workload. After the client side xDS monitors the call request, the call request can be parsed to determine the application service to be invoked.
For example, assuming that the address+port of the second application service is "mytest.com:8888", and the call request intercepted by the xDS client is "xds:mytest.com:8888" or "xds:// mytest.com:8888", the application service to be invoked is determined to be the second application service by parsing "mytest.com:8888" in the call request.
S404: xDS the client acquires the load balancing policy corresponding to the second application service from the first load balancing policy information, and determines one or more target second application service instances from a plurality of second application service instances included in the second application service according to the load balancing policy corresponding to the second application service.
The first load balancing policy information includes identifiers of a plurality of application services and load balancing policies corresponding to the identifiers. xDS the client may extract, after determining the second application service to be invoked, a load balancing policy corresponding to the second application service from the first load balancing policy information according to the identifier of the second application service. And determining one or more target second application service instances from the plurality of second application service instances included in the second application service according to the load balancing strategy corresponding to the second application service.
For example, assume that the second application service includes: the xDS client may target the second application service instance a as the second application service instance based on the load balancing policy corresponding to the second application service, or target the second application service instance a and the second application service instance B as the second application service instance.
And S405, xDS, the client sends the call request to the one or more target second application service instances.
Because the one or more target second application service instances are determined based on the load balancing policy corresponding to the second application service, the xDS client sends the call request to the one or more target second application service instances, so that load balancing among the second application service instances in the second application service can be realized.
In some possible implementations, after S403, the method may further include: determining whether a connection channel exists between the first application service and the second application service; if the first application service does not exist, a connection channel between the first application service and the second application service is established according to the address information and the port information of the second application service. If so, in S405, the xDS client sends the call request to the one or more target second application service instances through the connection channel.
Based on the embodiment shown in fig. 4, a specific implementation of the xDS client is illustrated in connection with fig. 5. Fig. 5 is a schematic diagram of another system architecture according to an embodiment of the present application. As shown in fig. 5, in this embodiment, based on the system architecture shown in fig. 2, the xDS client may include: xDS interceptor, xDS parser, channel creator, snoop requester, sub-policy creator and sender.
The xDS interceptor is used for intercepting a call request sent by the first workload. xDS parser is used to parse the intercepted call request. The channel creator is used for establishing a connection channel between the first application service and the second application service. The monitoring requester and the sub-policy creator are used for acquiring a load balancing policy corresponding to the second application service from the first load balancing policy information. The transmitter is configured to send a call request to one or more target second application service instances in the second application service based on the load balancing policy.
Based on the system architecture shown in FIG. 5, when a first workload sends a call request (e.g., "xds: mytest.com:8888" or "xds:///mytest.com: 8888"), the call request is intercepted by a xDS interceptor and the intercepted call request is parsed by a xDS parser to determine that the application service to be invoked is a second application service (i.e., "mytest.com:8888" indicated application service). Then, the xDS client determines whether a connection channel exists between the first application service and the second application service, and if not, establishes the connection channel between the first application service and the second application service according to the address information and the port information of the second application service through the channel creator. The connection channel is used for the first application service to send a call request to the second application service. Further, the load balancing strategy corresponding to the second application service is obtained from the first load balancing strategy information through the monitoring requester and the sub-strategy creator. For example, referring to fig. 5, the CDS policy corresponding to the second application service is obtained from the first load balancing policy information by the listening requester, and then the EDS policy corresponding to the second application service is obtained by the sub-policy creator. The EDS policy serves as a sub-policy to the CDS policy. Thus, the CDS policy and the EDS policy serve as load balancing policies corresponding to the second application service. Further, the transmitter determines one or more target second application service instances from a plurality of second application service instances included in the second application service based on the CDS policy and the EDS policy, and transmits a call request to the one or more target second application service instances through the connection channel.
In this embodiment, the first load balancing policy information is provided to the xDS client through the xDS proxy, and the xDS client intercepts the call request sent by the first workload, forwards the intercepted call request to the available instance of the second application service based on the first load balancing policy, so that load balancing control is implemented inside the first application service instance, and therefore, grid proxy deployment for the first application service instance is not required, forwarding of the call request by the grid proxy is not required, and service response time is reduced.
Based on any of the above embodiments, the xDS server may also utilize xDS agents to implement unified startup management for application service instances in the cluster. The following is described in connection with fig. 6 and 7.
Fig. 6 is a flowchart of an application service start management method according to an embodiment of the present application. Fig. 7 is a schematic diagram of yet another system architecture according to an embodiment of the present application. The method of the present embodiment may be performed prior to the embodiment shown in fig. 3 or fig. 4. As shown in fig. 6, the method of the present embodiment includes:
s601: and starting the xDS agent when receiving a starting instruction corresponding to the first application service instance.
The starting instruction is used for indicating to start the first application service. For example, when the first application service instance needs to be started, the user or the control device inputs a start instruction to the first application service. After the first application service receives the start instruction corresponding to the first application service instance, the proxy is started xDS first.
In one possible implementation, the xDS agent may be started in the following manner: second boot configuration information required to boot the xDS agent is obtained, the second boot configuration information being configured by the agent manager for the xDS agent. Illustratively, the second initiation configuration information may include parameters required for the xDS agent initiation process. And further starts xDS the agent according to the second start configuration information.
This is explained with reference to fig. 7. As shown in fig. 7, an agent manager is also deployed at the control plane layer. The proxy manager may be deployed as a component of the control plane layer. The proxy manager is used for managing xDS proxies in each application service in the cluster.
In this embodiment, the proxy manager may implement unified management of the starting process of the xDS proxy in each application service. In one example, the proxy manager may distribute second boot configuration information to the xDS proxy in each application service, the second configuration information being the configuration information required for the xDS proxy boot process. For example, the agent manager may write the second startup configuration information required for each xDS agent startup procedure into the configuration file under the preset path corresponding to the xDS agent. Thus, when the xDS agent needs to be started, the second starting configuration information can be read from the configuration file under the preset path, and the xDS agent is started according to the second starting configuration information.
In this embodiment, the proxy manager is deployed on the control plane layer and is configured to configure the second start configuration information required in the start process for the xDS proxy in each application service, so that the proxy manager can implement unified management on the start process of the xDS proxy in each application service, and improve the management efficiency of the xDS proxy.
S602: first startup configuration information is obtained from the xDS server through the xDS agent, the first startup configuration information being configuration information required to startup the first application service instance.
In this embodiment, after the xDS proxy is started, the first start configuration information required to obtain the first application service instance (e.g., the first workload, xDS client) may be obtained through an interaction procedure with the xDS server. The first starting configuration information may include parameters required in the starting process of the first application service instance.
In a possible implementation manner, S602 may be implemented in the following manner:
(1) The xDS proxy establishes a connection with the xDS server.
A communication connection is established between the xDS agent and the xDS server based on the xDS protocol. The communication connection is established between the two in the following way by way of example: the xDS proxy obtains the certificate information and sends a connection establishment request to the xDS server according to the certificate information, wherein the connection establishment request comprises the certificate information. The xDS server verifies the certificate information and sends a connection setup response to the xDS agent after the verification is passed. Accordingly, the xDS proxy receives a connection setup response from the xDS server. Thus, the xDS proxy is communicatively coupled to the xDS server. In the above procedure, the certificate information is configured by the agent manager for the xDS agent.
With continued reference to fig. 7, the proxy manager may distribute certificate information to xDS proxies in the application services. For example, the agent manager may write the certificate information corresponding to each xDS agent into the configuration file under the preset path corresponding to the xDS agent. Thus, when the xDS proxy needs to establish a connection with the xDS server, the credential information may be read from the configuration file under the preset path and carried into the connection establishment request so that the xDS server authenticates the xDS proxy based on the credential information.
In this embodiment, by deploying xDS agents for each application service instance and deploying an agent manager on the control plane layer, the agent manager configures certificate information for each xDS agent, on one hand, a unified certificate issuance management mechanism for each xDS agent is implemented, and on the other hand, a unified connection mechanism between each xDS agent and the xDS server is implemented. In addition, the application service instance is enabled to support the ability to manage security certificate lifecycles locally.
(2) The xDS agent receives the second load balancing policy information from the xDS server.
Illustratively, after the xDS agent establishes a connection with the xDS server, the xDS agent may request the second load balancing policy information from the xDS server, or the xDS server may actively send the second load balancing policy information to the xDS agent. The second load balancing policy information includes: when the xDS proxy establishes a connection with the xDS server, load balancing policies corresponding to all application services in the cluster, or load balancing policies corresponding to other application services that need to be invoked by the first application service instance. If the load balancing policy corresponding to an application service (e.g., the second application service) is not configured when the proxy xDS establishes a connection with the xDS server, the second load balancing policy may include a default load balancing policy corresponding to the application service.
(3) The xDS proxy generates the first starting configuration information according to the second load balancing policy information, wherein the first starting configuration information comprises the second load balancing policy information.
The first starting configuration information is configuration information required for starting the first application service instance, and the first starting configuration information can include parameters required by a starting process of the first application service instance. In this embodiment, the xDS agent can generate the first starting configuration information required by the first application service instance based on the second load balancing policy information. The first startup configuration information may include second load balancing policy information.
S603: and starting the first application service instance according to the first starting configuration information.
Illustratively, the first workload and the xDS client are started according to the first starting configuration information, so that the starting of the first application service instance is completed.
It should be noted that fig. 7 mainly illustrates a starting procedure of the first application service instance. For the second application service, if the second application service adopts the proxy-free mode, the starting process of each instance in the second application service is similar to that of the first application service instance, and details are not repeated here.
In this embodiment, by deploying xDS proxy for the application service instance, at the time of application service instance startup, the first startup configuration information may be obtained from the xDS server through xDS proxy, and the application service instance is started based on the first startup configuration information. Therefore, a mechanism of unified management of the xDS server on the starting process of each application service instance is realized, and the starting management efficiency of each application service instance is improved.
The method for load balancing provided by the embodiment of the application is described above, and the device for load balancing provided by the embodiment of the application is described below.
The embodiment of the application may divide the functional modules of the device for load balancing according to the above embodiment of the method, for example, each functional module may be divided corresponding to each function, or two or more functions may be integrated into one processing module. The integrated modules described above may be implemented either in hardware or in software functional modules.
It should be noted that, in the embodiment of the present application, the division of the modules is schematic, which is merely a logic function division, and other division manners may be implemented in actual implementation. The following description will be given by taking an example of dividing each function module into corresponding functions.
Fig. 8 is a schematic structural diagram of an apparatus for load balancing according to an embodiment of the present application. The device provided by the embodiment can be applied to a first application service in a cluster, wherein the first application service comprises: a first application service instance and a xDS proxy, the first application service instance comprising: a first workload and a xDS client. As shown in fig. 8, an apparatus 800 for load balancing provided in this embodiment includes: a policy acquisition module 801 and a policy enforcement module 802. Wherein,
a policy obtaining module 801, configured to receive, by using the xDS proxy, first load balancing policy information sent by the xDS server, and forward the first load balancing policy information to the xDS client;
and the policy execution module 802 is configured to send, when the first workload needs to call the second application service in the cluster, a call request to one or more target second application service instances in the second application service according to the first load balancing policy information through the xDS client, so as to implement load balancing of each second application service instance in the second application service.
In a possible implementation manner, the apparatus provided in this embodiment further includes: the starting module is used for:
Starting the xDS agent when receiving a starting instruction corresponding to the first application service instance;
acquiring first starting configuration information from the xDS server through the xDS agent, wherein the first starting configuration information is configuration information required for starting the first application service instance;
and starting the first application service instance according to the first starting configuration information.
In a possible implementation manner, the starting module is specifically configured to:
establishing a connection with the xDS server through the xDS agent;
receiving, by the xDS agent, second load balancing policy information from the xDS server;
and generating, by the xDS agent, the first start-up configuration information according to the second load balancing policy information, where the first start-up configuration information includes the second load balancing policy information.
In a possible implementation manner, the starting module is specifically configured to:
acquiring certificate information through the xDS proxy, and sending a connection establishment request to the xDS server according to the certificate information, wherein the connection establishment request comprises the certificate information; wherein the credential information is configured by an agent manager for the xDS agent; the agent manager is used for managing xDS agents in each application service in the cluster;
A connection setup response is received from the xDS server by the xDS agent, the connection setup response being sent after the authentication of the credential information by the xDS server is passed.
In a possible implementation manner, the starting module is specifically configured to:
acquiring second start-up configuration information required to start up the xDS agent, the second start-up configuration information configured by the agent manager for the xDS agent;
and starting the xDS agent according to the second starting configuration information.
In a possible implementation manner, the policy enforcement module 802 is specifically configured to:
the following steps are executed by the xDS client:
intercepting the calling request when the first workload is monitored to send the calling request, and analyzing the calling request to determine the second application service to be called;
acquiring a load balancing strategy corresponding to the second application service from the first load balancing strategy information, and determining one or more target second application service instances from a plurality of second application service instances included in the second application service according to the load balancing strategy corresponding to the second application service;
And sending the call request to the one or more target second application service instances.
In a possible implementation manner, the policy enforcement module 802 is further configured to:
determining whether a connection channel exists between the first application service and the second application service;
if the first application service does not exist, a connection channel between the first application service and the second application service is established according to the address information and the port information of the second application service.
In one possible implementation, the xDS agents in different application services in the cluster are implemented based on the same programming language framework.
The device for load balancing provided in this embodiment may execute the method for load balancing implemented by the first application service in any of the above method embodiments, and its implementation principle and technical effects are similar, and will not be described herein again.
Fig. 9 is a schematic structural diagram of another apparatus for load balancing according to an embodiment of the present application. The device provided by the embodiment can be applied to a xDS server. As shown in fig. 9, an apparatus 900 for load balancing provided in this embodiment includes: an acquisition module 901 and a transmission module 902. Wherein,
the acquiring module 901 is configured to acquire first load balancing policy information corresponding to a first application service instance in a cluster;
The sending module 902 is configured to send the first load balancing policy information to a xDS agent corresponding to the first application service instance, so that the xDS agent forwards the first load balancing policy information to xDS clients in the first application service instance, where the first load balancing policy information is used to implement load balancing of each second application service instance in the second application service instance when a first workload in the first application service instance invokes the second application service in the cluster.
The device for load balancing provided in this embodiment may be used to execute the method for load balancing executed by the xDS server in any of the above method embodiments, and its implementation principle and technical effects are similar, and will not be described herein.
The embodiment of the application also provides a system for load balancing, which comprises: a service discovery xDS server deployed on a control plane layer and a cluster deployed on a data plane layer, wherein the cluster comprises a first application service and a second application service, the first application service comprises a first application service instance and xDS agents, the first application service instance comprises a first workload and xDS clients, and the second application service comprises a plurality of second application service instances;
The xDS server is configured to send first load balancing policy information to the xDS agent;
the xDS proxy is configured to forward the first load balancing policy information to the xDS client;
the xDS client is configured to send a call request to one or more target second application service instances in the second application service according to the first load balancing policy information when the first workload needs to call the second application service in the cluster, so as to implement load balancing of each second application service instance in the second application service.
In a possible implementation manner, the proxy manager is configured to distribute second startup configuration information to the xDS proxy in each application service in the cluster, and/or distribute certificate information to the xDS proxy in each application service in the cluster.
The system provided in this embodiment may be used to implement the method for load balancing provided in any of the foregoing method embodiments, and the implementation principle and technical effects are similar, which are not described herein.
Fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application. As shown in fig. 10, the electronic device 1000 provided in this embodiment includes: a memory 1001 and at least one processor 1002; the memory 1001 stores a computer program configured to be executed by the at least one processor 1002 to implement a method for load balancing implemented by the first application service in any of the above method embodiments, or a method for load balancing implemented by the xDS server, which are similar to the implementation principle and technical effect, and are not described herein again.
Alternatively, the memory 1001 may be separate or integrated with the processor 1002. When the memory 1001 is a device separate from the processor 1002, the electronic apparatus 1000 further includes: bus 1003 is used to connect memory 1001 and processor 1002.
The embodiment of the present application further provides a computer readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to implement a method for load balancing implemented by the first application service in any of the foregoing method embodiments, or a method for load balancing implemented by the xDS server, and the implementation principle and technical effects are similar, and are not repeated herein.
The embodiments of the present application provide a computer program product, including a computer program, where the computer program when executed by a processor implements a method for load balancing implemented by a first application service in any of the foregoing method embodiments, or a method for load balancing implemented by a xDS server, and the implementation principle and technical effects are similar, and are not repeated herein.
The embodiment of the application also provides a chip, which comprises: the system comprises a memory and a processor, wherein the memory stores a computer program, and the processor runs the computer program to realize the method for load balancing realized by the first application service in any method embodiment, or the method for load balancing realized by the xDS server, and the implementation principle and technical effect are similar, and are not repeated here.
It should be understood that the above processor may be a central processing unit (english: central Processing Unit, abbreviated as CPU), or may be other general purpose processors, digital signal processors (english: digital Signal Processor, abbreviated as DSP), application specific integrated circuits (english: application Specific Integrated Circuit, abbreviated as ASIC), or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present invention may be embodied directly in a hardware processor for execution, or in a combination of hardware and software modules in a processor for execution.
The memory may comprise a high-speed RAM memory, and may further comprise a non-volatile memory NVM, such as at least one magnetic disk memory, and may also be a U-disk, a removable hard disk, a read-only memory, a magnetic disk or optical disk, etc.
The bus may be an industry standard architecture (Industry Standard Architecture, ISA) bus, an external device interconnect (Peripheral Component, PCI) bus, or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, among others. The buses may be divided into address buses, data buses, control buses, etc. For ease of illustration, the buses in the drawings of the present application are not limited to only one bus or one type of bus.
The storage medium may be implemented by any type or combination of volatile or nonvolatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an application specific integrated circuit (Application Specific Integrated Circuits, ASIC for short). The processor and the storage medium may reside as discrete components in an electronic device.
Those of ordinary skill in the art will appreciate that: all or part of the steps for implementing the method embodiments described above may be performed by hardware associated with program instructions. The foregoing program may be stored in a computer readable storage medium. The program, when executed, performs steps including the method embodiments described above; and the aforementioned storage medium includes: various media that can store program code, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some or all of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.

Claims (14)

1. A method for load balancing, applied to a first application service in a cluster, the first application service comprising: a first application service instance and a service discovery xDS proxy, the first application service instance comprising: a first workload and xDS client; the method comprises the following steps:
receiving xDS, by the xDS agent, first load balancing policy information sent by a server, and forwarding the first load balancing policy information to the xDS client;
when the first workload needs to call the second application service in the cluster, sending a call request to one or more target second application service instances in the second application service through the xDS client according to the first load balancing policy information so as to realize load balancing of each second application service instance in the second application service.
2. The method of claim 1, further comprising, prior to receiving xDS, by the xDS agent, the first load balancing policy information sent by the server:
starting the xDS agent when receiving a starting instruction corresponding to the first application service instance;
acquiring first starting configuration information from the xDS server through the xDS agent, wherein the first starting configuration information is configuration information required for starting the first application service instance;
and starting the first application service instance according to the first starting configuration information.
3. The method of claim 2, wherein obtaining, by the xDS agent, first boot configuration information from the xDS server comprises:
establishing a connection with the xDS server through the xDS agent;
receiving, by the xDS agent, second load balancing policy information from the xDS server;
and generating, by the xDS agent, the first start-up configuration information according to the second load balancing policy information, where the first start-up configuration information includes the second load balancing policy information.
4. A method according to claim 3, wherein establishing a connection with the xDS server via the xDS agent comprises:
Acquiring certificate information through the xDS proxy, and sending a connection establishment request to the xDS server according to the certificate information, wherein the connection establishment request comprises the certificate information; wherein the credential information is configured by an agent manager for the xDS agent; the agent manager is used for managing xDS agents in each application service in the cluster;
a connection setup response is received from the xDS server by the xDS agent, the connection setup response being sent after the authentication of the credential information by the xDS server is passed.
5. The method of claim 4, wherein starting the xDS agent comprises:
acquiring second start-up configuration information required to start up the xDS agent, the second start-up configuration information configured by the agent manager for the xDS agent;
and starting the xDS agent according to the second starting configuration information.
6. The method of any of claims 1 to 5, wherein when the first workload needs to invoke a second application service in the cluster, sending, by the xDS client, a call request to one or more target second application service instances in the second application service according to the first load balancing policy information, comprises:
The following steps are executed by the xDS client:
intercepting the calling request when the first workload is monitored to send the calling request, and analyzing the calling request to determine the second application service to be called;
acquiring a load balancing strategy corresponding to the second application service from the first load balancing strategy information, and determining one or more target second application service instances from a plurality of second application service instances included in the second application service according to the load balancing strategy corresponding to the second application service;
and sending the call request to the one or more target second application service instances.
7. The method of claim 6, wherein parsing the call request, after determining the second application service to be invoked, further comprises:
determining whether a connection channel exists between the first application service and the second application service;
if the first application service does not exist, a connection channel between the first application service and the second application service is established according to the address information and the port information of the second application service.
8. The method of any of claims 1 to 5, wherein xDS agents in different application services in the cluster are implemented based on the same programming language framework.
9. A method for load balancing, applied to a service discovery xDS server, the method comprising:
acquiring first load balancing strategy information corresponding to a first application service instance in a cluster;
and sending the first load balancing policy information to a xDS agent corresponding to the first application service instance, so that the xDS agent forwards the first load balancing policy information to xDS clients in the first application service instance, wherein the first load balancing policy information is used for realizing load balancing of each second application service instance in the second application service instance when a first workload in the first application service instance invokes the second application service in the cluster.
10. A method for load balancing, characterized by being applied to a system for load balancing, the system comprising: a service discovery xDS server deployed on a control plane layer and a cluster deployed on a data plane layer, wherein the cluster comprises a first application service and a second application service, the first application service comprises a first application service instance and xDS agents, the first application service instance comprises a first workload and xDS clients, and the second application service comprises a plurality of second application service instances; the method comprises the following steps:
The service discovery xDS server obtains first load balancing policy information corresponding to the first application service instance and sends the first load balancing policy information to the xDS agent corresponding to the first application service instance;
the first application service forwards the first load balancing policy information to the xDS client through the xDS agent;
and when the first workload needs to call the second application service in the cluster, the first application service sends a call request to one or more target second application service instances in the second application service according to the first load balancing strategy information through the xDS client so as to realize load balancing of each second application service instance in the second application service.
11. A system for load balancing, comprising: a service discovery xDS server deployed on a control plane layer and a cluster deployed on a data plane layer, wherein the cluster comprises a first application service and a second application service, the first application service comprises a first application service instance and xDS agents, the first application service instance comprises a first workload and xDS clients, and the second application service comprises a plurality of second application service instances;
The xDS server is configured to send first load balancing policy information to the xDS agent;
the xDS proxy is configured to forward the first load balancing policy information to the xDS client;
the xDS client is configured to send a call request to one or more target second application service instances in the second application service according to the first load balancing policy information when the first workload needs to call the second application service in the cluster, so as to implement load balancing of each second application service instance in the second application service.
12. The system of claim 11, further comprising: an agent manager deployed at the control plane layer;
the proxy manager is configured to distribute second startup configuration information to the xDS proxy in each application service in the cluster and/or distribute certificate information to the xDS proxy in each application service in the cluster.
13. An electronic device, comprising: a memory and at least one processor, the memory having stored therein a computer program configured to be executed by the at least one processor to implement the method of any one of claims 1 to 8 or the method of claim 9.
14. A computer readable storage medium, characterized in that the computer readable storage medium has stored therein a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 8 or the method according to claim 9.
CN202210448147.1A 2022-04-27 2022-04-27 Method, device, system and storage medium for load balancing Active CN114726863B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210448147.1A CN114726863B (en) 2022-04-27 2022-04-27 Method, device, system and storage medium for load balancing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210448147.1A CN114726863B (en) 2022-04-27 2022-04-27 Method, device, system and storage medium for load balancing

Publications (2)

Publication Number Publication Date
CN114726863A CN114726863A (en) 2022-07-08
CN114726863B true CN114726863B (en) 2024-01-09

Family

ID=82246222

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210448147.1A Active CN114726863B (en) 2022-04-27 2022-04-27 Method, device, system and storage medium for load balancing

Country Status (1)

Country Link
CN (1) CN114726863B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10212041B1 (en) * 2016-03-04 2019-02-19 Avi Networks Traffic pattern detection and presentation in container-based cloud computing architecture
CN112988223A (en) * 2021-03-25 2021-06-18 北京百度网讯科技有限公司 Frame integration method and device, electronic equipment and storage medium
CN113055421A (en) * 2019-12-27 2021-06-29 南京亚信软件有限公司 Service grid management method and system
CN113542437A (en) * 2021-09-16 2021-10-22 阿里云计算有限公司 Network system, network proxy method and device
CN113596171A (en) * 2021-08-04 2021-11-02 杭州朗和科技有限公司 Cloud computing data interaction method and system, electronic equipment and storage medium
CN113765965A (en) * 2020-08-21 2021-12-07 北京沃东天骏信息技术有限公司 Service grid system generation method and device and service grid system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10212041B1 (en) * 2016-03-04 2019-02-19 Avi Networks Traffic pattern detection and presentation in container-based cloud computing architecture
CN113055421A (en) * 2019-12-27 2021-06-29 南京亚信软件有限公司 Service grid management method and system
CN113765965A (en) * 2020-08-21 2021-12-07 北京沃东天骏信息技术有限公司 Service grid system generation method and device and service grid system
CN112988223A (en) * 2021-03-25 2021-06-18 北京百度网讯科技有限公司 Frame integration method and device, electronic equipment and storage medium
CN113596171A (en) * 2021-08-04 2021-11-02 杭州朗和科技有限公司 Cloud computing data interaction method and system, electronic equipment and storage medium
CN113542437A (en) * 2021-09-16 2021-10-22 阿里云计算有限公司 Network system, network proxy method and device

Also Published As

Publication number Publication date
CN114726863A (en) 2022-07-08

Similar Documents

Publication Publication Date Title
US11483405B2 (en) Private cloud as a service
EP2158546B1 (en) Providing enhanced data retrieval from remote locations
US10708376B2 (en) Message bus service directory
JP4324975B2 (en) Load reduction system, computer, and load reduction method
US9244817B2 (en) Remote debugging in a cloud computing environment
KR100629057B1 (en) Remote dynamic configuration of a web server to facilitate capacity on demand
CA2603236C (en) System and method of device-to-server registration
US20030101284A1 (en) Virtual network with adaptive dispatcher
US8775651B2 (en) System and method for dynamic adaptation service of an enterprise service bus over a communication platform
CN110352401B (en) Local device coordinator with on-demand code execution capability
WO2013052801A1 (en) Integrated software development and deployment architecture and high availability client-server systems generated using the architecture
US9785482B2 (en) System and method for extending a web service environment to support scalable asynchronous clients
US8566847B2 (en) Out-of-band host management via a management controller
JP2003016036A (en) Verifying system and method for reliability status of peer in peer-to-peer network environment
US10033790B2 (en) Method for a connector providing transactional interoperability to multiple messaging providers to multiple application servers using the same implementation
US20170006091A1 (en) Providing enhanced access to remote services
US20050220109A1 (en) Routing table synchronization method, network apparatus, and routing table synchronization program
CN116633775B (en) Container communication method and system of multi-container network interface
CN116633993B (en) Cross-network micro-service calling method, device, equipment and storage medium
CN114726863B (en) Method, device, system and storage medium for load balancing
CN112804303A (en) Service providing method, device, system, transfer platform and storage medium
CN115297098A (en) Edge service acquisition method and device, edge computing system, medium and equipment
CN110545320A (en) Intranet data interaction method and equipment
CN113872933B (en) Method, system, device, equipment and storage medium for hiding source station
US8499023B1 (en) Servlet-based grid computing environment using grid engines and switches to manage resources

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant