WO2012000455A1 - Client terminal and load balancing method - Google Patents

Client terminal and load balancing method Download PDF

Info

Publication number
WO2012000455A1
WO2012000455A1 PCT/CN2011/076770 CN2011076770W WO2012000455A1 WO 2012000455 A1 WO2012000455 A1 WO 2012000455A1 CN 2011076770 W CN2011076770 W CN 2011076770W WO 2012000455 A1 WO2012000455 A1 WO 2012000455A1
Authority
WO
WIPO (PCT)
Prior art keywords
service node
service
client
call request
cluster
Prior art date
Application number
PCT/CN2011/076770
Other languages
French (fr)
Chinese (zh)
Inventor
黄志辉
Original Assignee
腾讯科技(深圳)有限公司
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 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Publication of WO2012000455A1 publication Critical patent/WO2012000455A1/en

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

Definitions

  • the present invention relates to the field of clustering, and in particular, to a method for client and load balancing. Background technique
  • a cluster is a collection of loosely coupled service nodes consisting of two or more servers that provide users with network services or applications.
  • load balancing means that the service nodes in the cluster bear the corresponding load according to their computing power.
  • a load balancer is usually set on the cluster side, and load balancing is performed by the load balancer.
  • the specific process is as follows:
  • the client sends a call request to the cluster providing the service.
  • the load balancer in the cluster forwards the call request to the corresponding service node according to the load condition of each service node in the cluster.
  • the service node processes the client's call request and returns the corresponding processing result.
  • the embodiment of the present invention provides a method for client and load balancing.
  • the technical solution is as follows:
  • a method of load balancing comprising:
  • the client obtains a load configuration, where the load configuration includes at least a manner of accessing the service node;
  • the client receives the processing result returned by the service node.
  • the client before the sending, by the client, the calling request to the corresponding service node in the service cluster according to the load configuration, the client includes:
  • the client loads all the service nodes in the service cluster, and establishes communication communication with each service node one by one. Road.
  • the sending, by the client, the calling request to the corresponding service node in the service cluster according to the load configuration includes:
  • the sending, by the client according to the load configuration, a call request to a corresponding service node in the service cluster includes:
  • the client sequentially selects one service node from the service clusters in a preset order, and sends a call request to the selected service node.
  • the sending, by the client according to the load configuration, a call request to a corresponding service node in the service cluster includes:
  • the client randomly selects a service node from the service cluster and sends a call request to the selected service node.
  • a client, the client includes:
  • An obtaining module configured to obtain a load configuration, where the load configuration includes at least a manner of accessing a service node, and a requesting module, configured to send, according to the load configuration, a call request to a corresponding service node in the service cluster, to enable the service node Receiving and processing the call request, and returning the processing result;
  • a receiving module configured to receive the processing result returned by the service node.
  • the client further includes:
  • the establishing module is configured to load all the service nodes in the service cluster before establishing the request module, and establish communication channels with all the service nodes one by one.
  • the requesting module is further configured to determine whether a communication channel between itself and a corresponding service node in the service cluster is valid;
  • a call request is sent to the corresponding service node in the service cluster based on the load configuration.
  • the requesting module is specifically configured to sequentially select a service node from the service cluster according to a preset order. The selected service node sends a call request.
  • the requesting module is specifically configured to randomly select a service node from the service cluster to the selected service.
  • the node sends a call request.
  • the client obtains the load configuration, sends a call request to the corresponding service node in the service cluster according to the load configuration, and receives the processing result returned by the service node, that is, the load of the service node is completely dependent on the requested client, and the service cluster is indirectly implemented.
  • the load balancing improves the service capability of the cluster; and establishes a communication channel with all the service nodes in advance, and determines that the communication channel of a service node is valid, and then sends a call request to the service node to prevent load balancing on the cluster side.
  • the exception causes the client's call request to be abnormal, effectively enhancing the robustness of the entire service cluster, and implementing the adaptive call client.
  • Embodiment 1 is a flowchart of a method for load balancing provided in Embodiment 1 of the present invention
  • FIG. 2 is a schematic diagram of a network architecture of load balancing provided in Embodiment 1 of the present invention.
  • Embodiment 3 is an information interaction diagram of load balancing provided in Embodiment 1 of the present invention.
  • FIG. 4 is a schematic structural diagram of a client provided in Embodiment 2 of the present invention.
  • FIG. 5 is a schematic structural diagram of another client provided in Embodiment 2 of the present invention. detailed description
  • this embodiment provides a method for load balancing, including:
  • the client obtains a load configuration, where the load configuration includes at least a manner of accessing the service node;
  • the client sends a call request to a corresponding service node in the service cluster according to the load configuration, so that the service node receives and processes the call request, and returns a processing result;
  • the client receives the processing result returned by the service node.
  • the method provided in this embodiment obtains a load configuration by using a client, sends a call request to a corresponding service node in the service cluster according to the load configuration, and receives a processing result returned by the service node, that is, the load of the service node is completely dependent on the requested client.
  • the load balancing of the service cluster is realized indirectly, and the service capability of the cluster is improved. See the load balancing network architecture shown in Figure 2, including the client and the service cluster.
  • the client includes several specific clients, which are indicated by the client C1, the client C2, and the client Cn.
  • the service cluster is divided into several actual processes.
  • the client invokes the requested service node, and indicates the service node N1, the service node N2, the service node N3, and the service node Nn.
  • the client loads all the service nodes in the service cluster, and establishes communication channels with all the service nodes one by one; further, for security reasons, the establishment of the communication channel generally requires authentication between the client and the service cluster to ensure the legality of the channel.
  • this embodiment does not limit the specific authentication mode adopted.
  • the client obtains a load configuration, where the load configuration includes at least a manner of accessing the service node.
  • the load configuration may be preset on the client, or may be obtained by the client from a certain configuration server.
  • the load configuration is used to implement the load balancing of the service cluster. It specifies the information about the access mode and frequency of the service nodes of the service cluster. The embodiment does not limit the specific content of the load configuration.
  • the client determines whether the communication channel between the user and the corresponding service node in the service cluster is valid; the client determines that the corresponding service node is abnormal from the established communication channel failure, the service is unavailable, and the client calls instead.
  • the service of the available service node prevents the service node from being abnormal during the load balancing on the cluster side, causing the client's call request to be abnormal. This effectively enhances the robustness of the entire service cluster and implements the adaptive call client.
  • step 204 determines whether the communication channel between the user and the corresponding service node in the service cluster is valid; the client determines that the corresponding service node is abnormal from the established communication channel failure, the service is unavailable, and the client calls instead.
  • the service of the available service node prevents the service node from being abnormal during the load balancing on the cluster side, causing the client's call request to be abnormal. This effectively enhances the robustness of the entire service cluster and implements the adaptive call client.
  • step 204 determines whether the communication channel between the user and
  • the client may also directly perform step 204 without determining whether the communication channel is valid.
  • the client sends a call request to a corresponding service node in the service cluster according to the load configuration.
  • the client sequentially selects one service node from the service cluster according to a preset order, and sends a call request to the selected service node. If the way to access the service node included in the load configuration is random, the client randomly selects a service node from the service cluster and sends a call request to the selected service node.
  • the following is an example of distributing the load amount in a sequential manner by accessing the service node as an example to illustrate the process of load balancing.
  • the following load configuration is set, taking client C1 as an example, client C1 and service node Nl,
  • N2 and N3 respectively establish communication channels, according to the preset order Nl, N2, N3, the first call request of the client CI is sent to the service node Nl, and the second call request is sent to the service node N2, and the third call is made.
  • the request is sent to the service node N3, and then the fourth call request is sent to the service node N1, the fifth call request is sent to the service node N2, and the sixth call request is sent to the service node N3, and the service cluster is implemented again and again. Load balancing requirements for each service node.
  • the following is an example of randomly assigning the load amount in a random manner by accessing the service node, and illustrates the process of load balancing.
  • the following load configuration is set.
  • client C1 and service nodes N1, N2, and N3 respectively establish communication channels, and client C1 randomly selects one service node N2 from the service cluster, and Send the first call request to it, then randomly select a service node Nl from the service cluster, and send a second call request to it, and so on, and implement the load on each service node in the service cluster by random selection.
  • Equilibrium requirements Equilibrium requirements.
  • the request threshold can also be set in the load configuration to limit the number of requests sent by the user within a certain period of time to prevent the server from crashing due to excessive requests.
  • the service node receives and processes the call request, and returns a processing result.
  • the call request sent by the client and the processing result returned by the service node can be performed through the established communication channel. Transfer.
  • the client receives the processing result returned by the service node.
  • the method provided in this embodiment obtains a load configuration by using a client, sends a call request to a corresponding service node in the service cluster according to the load configuration, and receives a processing result returned by the service node, that is, the load of the service node is completely dependent on the requested client.
  • the load balancing of the service cluster is realized indirectly, and the service capability of the cluster is improved; and a communication channel is established in advance with all service nodes, and after determining that the communication channel of a service node is valid, a call request is sent to the cluster to prevent the cluster from being activated.
  • the load balancing is performed on the side, the service node is abnormal, causing the client's call request to be abnormal. This effectively enhances the robustness of the entire service cluster and implements the adaptive call client.
  • this embodiment provides a client, including:
  • the obtaining module 301 is configured to obtain a load configuration, where the load configuration includes at least a manner of accessing the service node, and the requesting module 302 is configured to send a call request to the corresponding service node in the service cluster according to the load configuration, so that the service node receives and processes Call the request, return the processing result;
  • the receiving module 303 is configured to receive a processing result returned by the service node.
  • the client further includes:
  • the establishing module 304 is configured to load all service nodes in the service cluster before performing the requesting module 302, and establish communication channels with each of the service nodes one by one.
  • the requesting module 302 is further configured to determine whether the communication channel between the user and the corresponding service node in the service cluster is valid;
  • a call request is sent to the corresponding service node in the service cluster based on the load configuration.
  • the module 302 is specifically configured to sequentially select a service node from the service cluster according to a preset sequence, and send a call request to the selected service node.
  • the requesting module 302 is specifically configured to randomly select a service node from the service cluster and send a call request to the selected service node.
  • the client provided in this embodiment is the same as the method embodiment, and the specific implementation process is described in the method embodiment, and details are not described herein again.
  • the client provided by this embodiment sends a call request to the corresponding service node in the service cluster according to the load configuration, and receives the processing result returned by the service node, that is, the load of the service node is completely dependent on the requested client.
  • the load balancing is performed, the service node is abnormal, causing the client's call request to be abnormal. This effectively enhances the robustness of the entire service cluster and implements the adaptive call client.
  • the client provided by the foregoing embodiment is only illustrated by dividing the foregoing functional modules when performing load balancing. In actual applications, the foregoing function allocation may be completed by different functional modules as needed. The internal structure of the client is divided into different functional modules to perform all or part of the functions described above.
  • All or part of the steps in the embodiments of the present invention may be implemented by using hardware, or may be instructed by a program to execute related hardware, and the program may be stored in a readable storage medium, such as an optical disk or a hard disk.

Abstract

Disclosed are a client terminal and a load balancing method relating to the field of clustering. The method comprises: the client terminal acquiring a load profile, the load profile comprising at least a service node access method (101); the client terminal sending a call request to a corresponding service node in a service cluster on the basis of the load profile, allowing the service node to receive and process the call request, and then return the processing result (102); the client terminal receiving the processing result returned by the service node (103). The client terminal comprises: an acquisition module, a request module, and a receiving module. In the present invention, the client terminal acquires the load profile, sends the call request to the corresponding service node in the service cluster on the basis of the load profile, and receives the processing result returned by the service node, that is, the service node load relies completely on the requesting client terminal, thereby indirectly achieving the load balancing of the service cluster and increasing the service capability of said cluster.

Description

一种客户端及负载均衡的方法 技术领域  Method for client and load balancing
本发明涉及集群领域, 特别涉及一种客户端及负载均衡的方法。 背景技术  The present invention relates to the field of clustering, and in particular, to a method for client and load balancing. Background technique
随着大规模互联网络应用的蓬勃发展, 大规模分布式集群服务已经随着网络的普及开 始更多的应用到企业。 集群是由两台或多台服务器构成的一种松散耦合的服务节点集合, 可以为用户提供网络服务或应用程序等。 集群中非常重要的一个问题是负载均衡, 负载均 衡是指集群中的服务节点根据自身的计算能力, 承担相应的负载。  With the rapid development of large-scale Internet applications, large-scale distributed cluster services have begun to be applied to enterprises with the popularity of the network. A cluster is a collection of loosely coupled service nodes consisting of two or more servers that provide users with network services or applications. A very important issue in clusters is load balancing. Load balancing means that the service nodes in the cluster bear the corresponding load according to their computing power.
目前, 在实现负载均衡时, 通常在集群侧设置一负载均衡器, 由负载均衡器进行负载 均衡的控制, 具体过程如下:  Currently, when load balancing is implemented, a load balancer is usually set on the cluster side, and load balancing is performed by the load balancer. The specific process is as follows:
客户端发送调用请求给提供服务的集群, 集群中的负载均衡器接收到客户端的调用请 求后, 根据集群中各个服务节点的负载情况, 转发调用请求给相应的服务节点。 该服务节 点处理客户端的调用请求, 并返回相应的处理结果。  The client sends a call request to the cluster providing the service. After receiving the call request from the client, the load balancer in the cluster forwards the call request to the corresponding service node according to the load condition of each service node in the cluster. The service node processes the client's call request and returns the corresponding processing result.
在实现本发明的过程中, 发明人发现现有技术至少存在以下缺点:  In the process of implementing the present invention, the inventors have found that the prior art has at least the following disadvantages:
现有技术在集群侧进行负载均衡, 会占用集群侧的处理资源, 降低集群的服务能力。 发明内容  In the prior art, load balancing is performed on the cluster side, which consumes processing resources on the cluster side and reduces the service capability of the cluster. Summary of the invention
为了提高集群的服务能力, 本发明实施例提供了一种客户端及负载均衡的方法。 所述 技术方案如下:  In order to improve the service capability of the cluster, the embodiment of the present invention provides a method for client and load balancing. The technical solution is as follows:
一种负载均衡的方法, 所述方法包括:  A method of load balancing, the method comprising:
客户端获取负载配置, 所述负载配置中至少包括访问服务节点的方式;  The client obtains a load configuration, where the load configuration includes at least a manner of accessing the service node;
所述客户端根据所述负载配置, 向服务集群中相应的服务节点发送调用请求, 使所述 服务节点接收并处理所述调用请求, 返回处理结果;  Sending, by the client, a call request to a corresponding service node in the service cluster according to the load configuration, so that the service node receives and processes the call request, and returns a processing result;
所述客户端接收所述服务节点返回的所述处理结果。  The client receives the processing result returned by the service node.
进一步的, 所述客户端根据所述负载配置, 向服务集群中相应的服务节点发送调用请 求之前包括:  Further, before the sending, by the client, the calling request to the corresponding service node in the service cluster according to the load configuration, the client includes:
所述客户端加载所述服务集群中所有服务节点, 逐一与所有服务节点分别建立通信通 道。 The client loads all the service nodes in the service cluster, and establishes communication communication with each service node one by one. Road.
进一步的, 所述客户端根据所述负载配置, 向服务集群中相应的服务节点发送调用请 求包括:  Further, the sending, by the client, the calling request to the corresponding service node in the service cluster according to the load configuration includes:
所述客户端判断自身与所述服务集群中相应的服务节点之间的通信通道是否有效; 如果有效, 所述客户端根据所述负载配置, 向所述服务集群中相应的服务节点发送调 用请求。  Determining, by the client, whether a communication channel between itself and a corresponding service node in the service cluster is valid; if valid, the client sends a call request to a corresponding service node in the service cluster according to the load configuration. .
进一步的, 所述负载配置中包括的访问服务节点的方式为顺序方式时, 所述客户端根 据所述负载配置, 向服务集群中相应的服务节点发送调用请求包括:  Further, when the manner of accessing the service node included in the load configuration is a sequential mode, the sending, by the client according to the load configuration, a call request to a corresponding service node in the service cluster includes:
所述客户端按照预设顺序依次从所述服务集群中选择一个服务节点, 向所述选中的服 务节点发送调用请求。  The client sequentially selects one service node from the service clusters in a preset order, and sends a call request to the selected service node.
进一步的, 所述负载配置中包括的访问服务节点的方式为随机方式时, 所述客户端根 据所述负载配置, 向服务集群中相应的服务节点发送调用请求包括:  Further, when the manner of accessing the service node included in the load configuration is a random mode, the sending, by the client according to the load configuration, a call request to a corresponding service node in the service cluster includes:
所述客户端随机从所述服务集群中选择一个服务节点, 向所述选中的服务节点发送调 用请求。  The client randomly selects a service node from the service cluster and sends a call request to the selected service node.
一种客户端, 所述客户端包括:  A client, the client includes:
获取模块, 用于获取负载配置, 所述负载配置中至少包括访问服务节点的方式; 请求模块, 用于根据所述负载配置, 向服务集群中相应的服务节点发送调用请求, 使 所述服务节点接收并处理所述调用请求, 返回处理结果;  An obtaining module, configured to obtain a load configuration, where the load configuration includes at least a manner of accessing a service node, and a requesting module, configured to send, according to the load configuration, a call request to a corresponding service node in the service cluster, to enable the service node Receiving and processing the call request, and returning the processing result;
接收模块, 用于接收所述服务节点返回的所述处理结果。  And a receiving module, configured to receive the processing result returned by the service node.
进一步的, 所述客户端还包括:  Further, the client further includes:
建立模块, 用于执行所述请求模块之前, 加载所述服务集群中所有服务节点, 逐一与 所有服务节点分别建立通信通道。  The establishing module is configured to load all the service nodes in the service cluster before establishing the request module, and establish communication channels with all the service nodes one by one.
进一步的, 所述请求模块, 还用于判断自身与所述服务集群中相应的服务节点之间的 通信通道是否有效;  Further, the requesting module is further configured to determine whether a communication channel between itself and a corresponding service node in the service cluster is valid;
如果有效, 根据所述负载配置, 向所述服务集群中相应的服务节点发送调用请求。 进一步的, 所述获取模块获取到的负载配置中的访问服务节点的方式为顺序方式时, 所述请求模块, 具体用于按照预设顺序依次从所述服务集群中选择一个服务节点, 向所述 选中的服务节点发送调用请求。  If valid, a call request is sent to the corresponding service node in the service cluster based on the load configuration. Further, when the manner of accessing the service node in the load configuration acquired by the acquiring module is a sequential mode, the requesting module is specifically configured to sequentially select a service node from the service cluster according to a preset order. The selected service node sends a call request.
进一步的, 所述获取模块获取到的负载配置中的访问服务节点的方式为随机方式时, 所述请求模块, 具体用于随机从所述服务集群中选择一个服务节点, 向所述选中的服务节 点发送调用请求。 本发明实施例提供的技术方案带来的有益效果是: Further, when the manner of accessing the service node in the load configuration acquired by the obtaining module is a random mode, the requesting module is specifically configured to randomly select a service node from the service cluster to the selected service. The node sends a call request. The beneficial effects brought by the technical solutions provided by the embodiments of the present invention are:
通过客户端获取负载配置, 根据负载配置向服务集群中相应的服务节点发送调用请求, 并接收服务节点返回的处理结果, 也即服务节点的负载完全依赖于请求的客户端, 间接实 现了服务集群的负载均衡, 提高了集群的服务能力; 并且预先与所有服务节点分别建立通 信通道, 判断某一服务节点的通信通道有效后, 再向其发送调用请求, 防止在集群侧进行 负载均衡时服务节点异常导致客户端的调用请求不正常, 有效的增强了整个服务集群的健 壮性, 实现了自适应调用的客户端。 附图说明  The client obtains the load configuration, sends a call request to the corresponding service node in the service cluster according to the load configuration, and receives the processing result returned by the service node, that is, the load of the service node is completely dependent on the requested client, and the service cluster is indirectly implemented. The load balancing improves the service capability of the cluster; and establishes a communication channel with all the service nodes in advance, and determines that the communication channel of a service node is valid, and then sends a call request to the service node to prevent load balancing on the cluster side. The exception causes the client's call request to be abnormal, effectively enhancing the robustness of the entire service cluster, and implementing the adaptive call client. DRAWINGS
为了更清楚地说明本发明实施例中的技术方案, 下面将对实施例描述中所需要使用的 附图作简单地介绍, 显而易见地, 下面描述中的附图仅仅是本发明的一些实施例, 对于本 领域普通技术人员来讲, 在不付出创造性劳动的前提下, 还可以根据这些附图获得其他的 附图。  In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly described. It is obvious that the drawings in the following description are only some embodiments of the present invention. Other drawings may also be obtained from those of ordinary skill in the art in view of the drawings.
图 1是本发明实施例 1中提供的负载均衡的方法流程图;  1 is a flowchart of a method for load balancing provided in Embodiment 1 of the present invention;
图 2是本发明实施例 1中提供的负载均衡的网络架构示意图;  2 is a schematic diagram of a network architecture of load balancing provided in Embodiment 1 of the present invention;
图 3是本发明实施例 1中提供的负载均衡的信息交互图;  3 is an information interaction diagram of load balancing provided in Embodiment 1 of the present invention;
图 4是本发明实施例 2中提供的客户端结构示意图;  4 is a schematic structural diagram of a client provided in Embodiment 2 of the present invention;
图 5是本发明实施例 2中提供的另一种客户端结构示意图。 具体实施方式  FIG. 5 is a schematic structural diagram of another client provided in Embodiment 2 of the present invention. detailed description
为使本发明的目的、 技术方案和优点更加清楚, 下面将结合附图对本发明实施方式作 进一步地详细描述。  The embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
实施例 1  Example 1
参见图 1, 本实施例提供了一种负载均衡的方法, 包括:  Referring to FIG. 1, this embodiment provides a method for load balancing, including:
101: 客户端获取负载配置, 该负载配置中至少包括访问服务节点的方式;  101: The client obtains a load configuration, where the load configuration includes at least a manner of accessing the service node;
102: 客户端根据负载配置, 向服务集群中相应的服务节点发送调用请求, 使服务节点 接收并处理调用请求, 返回处理结果;  102: The client sends a call request to a corresponding service node in the service cluster according to the load configuration, so that the service node receives and processes the call request, and returns a processing result;
103: 客户端接收服务节点返回的处理结果。  103: The client receives the processing result returned by the service node.
本实施例提供的方法, 通过客户端获取负载配置, 根据负载配置向服务集群中相应的 服务节点发送调用请求, 并接收服务节点返回的处理结果, 也即服务节点的负载完全依赖 于请求的客户端, 间接实现了服务集群的负载均衡, 提高了集群的服务能力。 参见图 2 所示的负载均衡网络架构, 包括客户端和服务集群, 客户端包括若干个具体 的客户端, 以客户端 Cl、 客户端 C2、 客户端 Cn进行示意, 服务集群划分为若干实际处理 客户端调用请求的服务节点, 以服务节点 Nl、 服务节点 N2、 服务节点 N3、 服务节点 Nn进 行示意。 The method provided in this embodiment obtains a load configuration by using a client, sends a call request to a corresponding service node in the service cluster according to the load configuration, and receives a processing result returned by the service node, that is, the load of the service node is completely dependent on the requested client. Indirectly, the load balancing of the service cluster is realized indirectly, and the service capability of the cluster is improved. See the load balancing network architecture shown in Figure 2, including the client and the service cluster. The client includes several specific clients, which are indicated by the client C1, the client C2, and the client Cn. The service cluster is divided into several actual processes. The client invokes the requested service node, and indicates the service node N1, the service node N2, the service node N3, and the service node Nn.
基于上述网络架构, 参见图 3, 下面详细介绍负载均衡的实现过程。  Based on the above network architecture, see Figure 3, which details the implementation of load balancing.
201: 客户端加载服务集群中所有服务节点, 逐一与所有服务节点分别建立通信通道; 进一步的, 为了安全起见, 通信通道的建立一般需要客户端和服务集群双方鉴权, 以 保证通道的合法性, 对此, 本实施例不对采用的具体鉴权方式进行限定。  201: The client loads all the service nodes in the service cluster, and establishes communication channels with all the service nodes one by one; further, for security reasons, the establishment of the communication channel generally requires authentication between the client and the service cluster to ensure the legality of the channel. In this regard, this embodiment does not limit the specific authentication mode adopted.
202: 客户端获取负载配置, 该负载配置中至少包括访问服务节点的方式;  202: The client obtains a load configuration, where the load configuration includes at least a manner of accessing the service node.
具体的, 负载配置可以是预先设置在客户端的, 也可以是客户端从某一配置服务器预 先获取的。 负载配置用于实现服务集群的负载均衡, 其规定了一段时间内, 客户端对服务 集群各个服务节点的访问方式、 频率等信息, 本实施例并不限定负载配置的具体内容。  Specifically, the load configuration may be preset on the client, or may be obtained by the client from a certain configuration server. The load configuration is used to implement the load balancing of the service cluster. It specifies the information about the access mode and frequency of the service nodes of the service cluster. The embodiment does not limit the specific content of the load configuration.
203 :可选的,客户端判断自身与服务集群中相应的服务节点之间的通信通道是否有效; 客户端从建立的通信通道失效来判定对应的服务节点异常, 服务不可用, 客户转而调 用可用的服务节点的服务, 防止在集群侧进行负载均衡时服务节点异常导致客户端的调用 请求不正常, 有效的增强了整个服务集群的健壮性, 实现了自适应调用的客户端。 相应的, 如果有效, 执行步骤 204。  203: Optionally, the client determines whether the communication channel between the user and the corresponding service node in the service cluster is valid; the client determines that the corresponding service node is abnormal from the established communication channel failure, the service is unavailable, and the client calls instead. The service of the available service node prevents the service node from being abnormal during the load balancing on the cluster side, causing the client's call request to be abnormal. This effectively enhances the robustness of the entire service cluster and implements the adaptive call client. Correspondingly, if it is valid, go to step 204.
进一步的, 客户端也可以不判断通信通道是否有效, 直接执行步骤 204。  Further, the client may also directly perform step 204 without determining whether the communication channel is valid.
204: 客户端根据负载配置, 向服务集群中相应的服务节点发送调用请求;  204: The client sends a call request to a corresponding service node in the service cluster according to the load configuration.
具体的, 如果负载配置中包括的访问服务节点的方式为顺序方式时, 客户端按照预设 顺序依次从服务集群中选择一个服务节点, 向选中的服务节点发送调用请求。 如果负载配 置中包括的访问服务节点的方式为随机方式时, 客户端随机从服务集群中选择一个服务节 点, 向选中的服务节点发送调用请求。  Specifically, if the manner of accessing the service node included in the load configuration is a sequential mode, the client sequentially selects one service node from the service cluster according to a preset order, and sends a call request to the selected service node. If the way to access the service node included in the load configuration is random, the client randomly selects a service node from the service cluster and sends a call request to the selected service node.
下面以访问服务节点的方式为顺序方式平均分配负载量为例, 说明负载均衡的过程。 对于每一客户端都设定如下负载配置, 以客户端 C1为例, 客户端 C1和服务节点 Nl、 The following is an example of distributing the load amount in a sequential manner by accessing the service node as an example to illustrate the process of load balancing. For each client, the following load configuration is set, taking client C1 as an example, client C1 and service node Nl,
N2、 N3 分别建立通信通道, 按照预设顺序 Nl、 N2、 N3 , 客户端 CI的第一个调用请求发送 给服务节点 Nl, 其第二个调用请求发送给服务节点 N2, 其第三个调用请求发送给服务节点 N3 , 然后其第四个调用请求又发送给服务节点 Nl, 其第五个调用请求发送给服务节点 N2, 第六个调用请求发送给服务节点 N3, 周而复始, 实现对服务集群中各服务节点的负载均衡 要求。 N2 and N3 respectively establish communication channels, according to the preset order Nl, N2, N3, the first call request of the client CI is sent to the service node Nl, and the second call request is sent to the service node N2, and the third call is made. The request is sent to the service node N3, and then the fourth call request is sent to the service node N1, the fifth call request is sent to the service node N2, and the sixth call request is sent to the service node N3, and the service cluster is implemented again and again. Load balancing requirements for each service node.
下面以访问服务节点的方式为随机方式平均分配负载量为例, 说明负载均衡的过程。 对于每一客户端都设定如下负载配置, 以客户端 C1为例, 客户端 C1和服务节点 Nl、 N2、 N3 分别建立通信通道, 客户端 C1从服务集群中随机选择一个服务节点 N2, 并向其发 送第一个调用请求, 然后从服务集群中再随机选择一个服务节点 Nl, 并向其发送第二个调 用请求, 依次类推, 通过随机选择的方式实现对服务集群中各服务节点的负载均衡要求。 The following is an example of randomly assigning the load amount in a random manner by accessing the service node, and illustrates the process of load balancing. For each client, the following load configuration is set. Taking client C1 as an example, client C1 and service nodes N1, N2, and N3 respectively establish communication channels, and client C1 randomly selects one service node N2 from the service cluster, and Send the first call request to it, then randomly select a service node Nl from the service cluster, and send a second call request to it, and so on, and implement the load on each service node in the service cluster by random selection. Equilibrium requirements.
另外, 还可以在负载配置中设置请求阈值, 用于限制用户在一定时间内发送请求的数 量, 防止过量请求导致服务器崩溃。  In addition, the request threshold can also be set in the load configuration to limit the number of requests sent by the user within a certain period of time to prevent the server from crashing due to excessive requests.
205: 服务节点接收并处理调用请求, 返回处理结果;  205: The service node receives and processes the call request, and returns a processing result.
具体的, 通过上述步骤 201, 客户端加载服务集群中所有服务节点, 逐一与所有服务节 点分别建立通信通道之后, 客户端发送的调用请求及服务节点返回的处理结果均可通过建 立的通信通道进行传送。  Specifically, after the client loads all the service nodes in the service cluster and establishes communication channels with all the service nodes one by one, the call request sent by the client and the processing result returned by the service node can be performed through the established communication channel. Transfer.
206: 客户端接收服务节点返回的处理结果。  206: The client receives the processing result returned by the service node.
本实施例提供的方法, 通过客户端获取负载配置, 根据负载配置向服务集群中相应的 服务节点发送调用请求, 并接收服务节点返回的处理结果, 也即服务节点的负载完全依赖 于请求的客户端, 间接实现了服务集群的负载均衡, 提高了集群的服务能力; 并且预先与 所有服务节点分别建立通信通道, 判断某一服务节点的通信通道有效后, 再向其发送调用 请求, 防止在集群侧进行负载均衡时服务节点异常导致客户端的调用请求不正常, 有效的 增强了整个服务集群的健壮性, 实现了自适应调用的客户端。 实施例 2  The method provided in this embodiment obtains a load configuration by using a client, sends a call request to a corresponding service node in the service cluster according to the load configuration, and receives a processing result returned by the service node, that is, the load of the service node is completely dependent on the requested client. Indirectly, the load balancing of the service cluster is realized indirectly, and the service capability of the cluster is improved; and a communication channel is established in advance with all service nodes, and after determining that the communication channel of a service node is valid, a call request is sent to the cluster to prevent the cluster from being activated. When the load balancing is performed on the side, the service node is abnormal, causing the client's call request to be abnormal. This effectively enhances the robustness of the entire service cluster and implements the adaptive call client. Example 2
参见图 4, 本实施例提供了一种客户端, 包括:  Referring to FIG. 4, this embodiment provides a client, including:
获取模块 301, 用于获取负载配置, 该负载配置中至少包括访问服务节点的方式; 请求模块 302, 用于根据负载配置, 向服务集群中相应的服务节点发送调用请求, 使服 务节点接收并处理调用请求, 返回处理结果;  The obtaining module 301 is configured to obtain a load configuration, where the load configuration includes at least a manner of accessing the service node, and the requesting module 302 is configured to send a call request to the corresponding service node in the service cluster according to the load configuration, so that the service node receives and processes Call the request, return the processing result;
接收模块 303, 用于接收服务节点返回的处理结果。  The receiving module 303 is configured to receive a processing result returned by the service node.
进一步的, 参见图 5, 客户端还包括:  Further, referring to FIG. 5, the client further includes:
建立模块 304, 用于执行请求模块 302之前, 加载服务集群中所有服务节点, 逐一与所 有服务节点分别建立通信通道。  The establishing module 304 is configured to load all service nodes in the service cluster before performing the requesting module 302, and establish communication channels with each of the service nodes one by one.
进一步的, 请求模块 302, 还用于判断自身与服务集群中相应的服务节点之间的通信通 道是否有效;  Further, the requesting module 302 is further configured to determine whether the communication channel between the user and the corresponding service node in the service cluster is valid;
如果有效, 根据负载配置, 向服务集群中相应的服务节点发送调用请求。  If valid, a call request is sent to the corresponding service node in the service cluster based on the load configuration.
当获取模块 301 获取到的负载配置中包括的访问服务节点的方式为顺序方式时, 请求 模块 302, 具体用于按照预设顺序依次从服务集群中选择一个服务节点, 向选中的服务节 点发送调用请求。 When the method of accessing the service node included in the load configuration acquired by the obtaining module 301 is in a sequential manner, the request is The module 302 is specifically configured to sequentially select a service node from the service cluster according to a preset sequence, and send a call request to the selected service node.
当获取模块 301 获取到的负载配置中包括的访问服务节点的方式为随机方式时, 请求 模块 302,具体用于随机从服务集群中选择一个服务节点,向选中的服务节点发送调用请求。  When the manner of accessing the service node included in the load configuration acquired by the obtaining module 301 is a random mode, the requesting module 302 is specifically configured to randomly select a service node from the service cluster and send a call request to the selected service node.
本实施例提供的客户端, 与方法实施例属于同一构思, 其具体实现过程详见方法实施 例, 这里不再赘述。  The client provided in this embodiment is the same as the method embodiment, and the specific implementation process is described in the method embodiment, and details are not described herein again.
本实施例提供的客户端, 通过获取负载配置, 根据负载配置向服务集群中相应的服务 节点发送调用请求, 并接收服务节点返回的处理结果, 也即服务节点的负载完全依赖于请 求的客户端, 间接实现了服务集群的负载均衡, 提高了集群的服务能力; 并且预先与所有 服务节点分别建立通信通道, 判断某一服务节点的通信通道有效后, 再向其发送调用请求, 防止在集群侧进行负载均衡时服务节点异常导致客户端的调用请求不正常, 有效的增强了 整个服务集群的健壮性, 实现了自适应调用的客户端。 需要说明的是: 上述实施例提供的客户端在进行负载均衡时, 仅以上述各功能模块的 划分进行举例说明, 实际应用中, 可以根据需要而将上述功能分配由不同的功能模块完成, 即将客户端的内部结构划分成不同的功能模块, 以完成以上描述的全部或者部分功能。  The client provided by this embodiment sends a call request to the corresponding service node in the service cluster according to the load configuration, and receives the processing result returned by the service node, that is, the load of the service node is completely dependent on the requested client. Indirectly realizes the load balancing of the service cluster and improves the service capability of the cluster; and establishes a communication channel with all the service nodes in advance, and determines that the communication channel of a service node is valid, and then sends a call request to the cluster side. When the load balancing is performed, the service node is abnormal, causing the client's call request to be abnormal. This effectively enhances the robustness of the entire service cluster and implements the adaptive call client. It should be noted that: the client provided by the foregoing embodiment is only illustrated by dividing the foregoing functional modules when performing load balancing. In actual applications, the foregoing function allocation may be completed by different functional modules as needed. The internal structure of the client is divided into different functional modules to perform all or part of the functions described above.
本发明实施例中的全部或部分步骤, 可以利用硬件实现, 也可以通过程序来指令相关 的硬件完成, 所述的程序可以存储在可读取的存储介质中, 如光盘或硬盘等。  All or part of the steps in the embodiments of the present invention may be implemented by using hardware, or may be instructed by a program to execute related hardware, and the program may be stored in a readable storage medium, such as an optical disk or a hard disk.
以上所述仅为本发明的较佳实施例, 并不用以限制本发明, 凡在本发明的精神和原则 之内, 所作的任何修改、 等同替换、 改进等, 均应包含在本发明的保护范围之内。  The above is only the preferred embodiment of the present invention, and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., which are within the spirit and scope of the present invention, should be included in the protection of the present invention. Within the scope.

Claims

权 利 要 求 书 Claim
1、 一种负载均衡的方法, 其特征在于, 所述方法包括:  A load balancing method, the method comprising:
客户端获取负载配置, 所述负载配置中至少包括访问服务节点的方式;  The client obtains a load configuration, where the load configuration includes at least a manner of accessing the service node;
所述客户端根据所述负载配置, 向服务集群中相应的服务节点发送调用请求, 使所述服 务节点接收并处理所述调用请求, 返回处理结果;  Sending, by the client, a call request to a corresponding service node in the service cluster according to the load configuration, so that the service node receives and processes the call request, and returns a processing result;
所述客户端接收所述服务节点返回的所述处理结果。  The client receives the processing result returned by the service node.
2、 如权利要求 1所述的方法, 其特征在于, 所述客户端根据所述负载配置, 向服务集群 中相应的服务节点发送调用请求之前包括: 2. The method according to claim 1, wherein the client sends a call request to a corresponding service node in the service cluster according to the load configuration:
所述客户端加载所述服务集群中所有服务节点,逐一与所有服务节点分别建立通信通道。  The client loads all service nodes in the service cluster, and establishes communication channels with all service nodes one by one.
3、 如权利要求 2所述的方法, 其特征在于, 所述客户端根据所述负载配置, 向服务集群 中相应的服务节点发送调用请求包括: 3. The method according to claim 2, wherein the sending, by the client, a call request to a corresponding service node in the service cluster according to the load configuration comprises:
所述客户端判断自身与所述服务集群中相应的服务节点之间的通信通道是否有效; 如果有效, 所述客户端根据所述负载配置, 向所述服务集群中相应的服务节点发送调用 请求。  Determining, by the client, whether a communication channel between itself and a corresponding service node in the service cluster is valid; if valid, the client sends a call request to a corresponding service node in the service cluster according to the load configuration. .
4、 如权利要求 1所述的方法, 其特征在于, 所述负载配置中包括的访问服务节点的方式 为顺序方式时, 所述客户端根据所述负载配置, 向服务集群中相应的服务节点发送调用请求 包括: The method according to claim 1, wherein, when the manner of accessing the service node included in the load configuration is a sequential mode, the client sends a corresponding service node to the service cluster according to the load configuration. Sending a call request includes:
所述客户端按照预设顺序依次从所述服务集群中选择一个服务节点, 向所述选中的服务 节点发送调用请求。  The client sequentially selects one service node from the service clusters in a preset order, and sends a call request to the selected service node.
5、 如权利要求 1所述的方法, 其特征在于, 所述负载配置中包括的访问服务节点的方式 为随机方式时, 所述客户端根据所述负载配置, 向服务集群中相应的服务节点发送调用请求 包括: The method according to claim 1, wherein, when the manner of accessing the service node included in the load configuration is a random mode, the client sends a corresponding service node to the service cluster according to the load configuration. Sending a call request includes:
所述客户端随机从所述服务集群中选择一个服务节点, 向所述选中的服务节点发送调用 请求。  The client randomly selects a service node from the service cluster and sends a call request to the selected service node.
6、 一种客户端, 其特征在于, 所述客户端包括: 获取模块, 用于获取负载配置, 所述负载配置中至少包括访问服务节点的方式; 请求模块, 用于根据所述负载配置, 向服务集群中相应的服务节点发送调用请求, 使所 述服务节点接收并处理所述调用请求, 返回处理结果; 6. A client, wherein the client includes: An obtaining module, configured to obtain a load configuration, where the load configuration includes at least a manner of accessing a service node, and a requesting module, configured to send, according to the load configuration, a call request to a corresponding service node in the service cluster, to enable the service node Receiving and processing the call request, and returning the processing result;
接收模块, 用于接收所述服务节点返回的所述处理结果。  And a receiving module, configured to receive the processing result returned by the service node.
7、 如权利要求 6所述的客户端, 其特征在于, 所述客户端还包括: The client according to claim 6, wherein the client further comprises:
建立模块, 用于执行所述请求模块之前, 加载所述服务集群中所有服务节点, 逐一与所 有服务节点分别建立通信通道。  The establishing module is configured to load all the service nodes in the service cluster before performing the requesting module, and establish communication channels with each of the service nodes one by one.
8、 如权利要求 7所述的客户端, 其特征在于, 所述请求模块, 还用于判断自身与所述服 务集群中相应的服务节点之间的通信通道是否有效; The client according to claim 7, wherein the requesting module is further configured to determine whether a communication channel between itself and a corresponding service node in the service cluster is valid;
如果有效, 根据所述负载配置, 向所述服务集群中相应的服务节点发送调用请求。  If valid, a call request is sent to the corresponding service node in the service cluster based on the load configuration.
9、 如权利要求 6所述的客户端, 其特征在于, 所述获取模块获取到的负载配置中的访问 服务节点的方式为顺序方式时, 所述请求模块, 具体用于按照预设顺序依次从所述服务集群 中选择一个服务节点, 向所述选中的服务节点发送调用请求。 The client according to claim 6, wherein the requesting module is specifically configured according to a preset order when the manner of accessing the service node in the load configuration acquired by the obtaining module is a sequential mode. A service node is selected from the service cluster, and a call request is sent to the selected service node.
10、 如权利要求 6所述的客户端, 其特征在于, 所述获取模块获取到的负载配置中的访 问服务节点的方式为随机方式时, 所述请求模块, 具体用于随机从所述服务集群中选择一个 服务节点, 向所述选中的服务节点发送调用请求。 The client according to claim 6, wherein, when the manner of accessing the service node in the load configuration acquired by the obtaining module is a random mode, the requesting module is specifically used to randomly obtain the service. A service node is selected in the cluster, and a call request is sent to the selected service node.
PCT/CN2011/076770 2010-07-02 2011-07-01 Client terminal and load balancing method WO2012000455A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201010223288.0 2010-07-02
CN2010102232880A CN102316138A (en) 2010-07-02 2010-07-02 Client end and load balance method

Publications (1)

Publication Number Publication Date
WO2012000455A1 true WO2012000455A1 (en) 2012-01-05

Family

ID=45401406

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/076770 WO2012000455A1 (en) 2010-07-02 2011-07-01 Client terminal and load balancing method

Country Status (2)

Country Link
CN (1) CN102316138A (en)
WO (1) WO2012000455A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113746894A (en) * 2021-07-23 2021-12-03 济南浪潮数据技术有限公司 Method and device for realizing load balancing based on HDFS RBF routing layer

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103248610B (en) * 2012-02-06 2016-04-27 阿里巴巴集团控股有限公司 A kind of method and system of providing services on the Internet
CN102984084B (en) * 2012-11-21 2016-06-29 北京奇虎科技有限公司 Data transmission method and system between computer cluster interior joint
CN104518985A (en) * 2013-09-27 2015-04-15 国家广播电影电视总局广播科学研究院 Method and terminal for selecting service node in distributed network environment
CN104079630A (en) * 2014-06-09 2014-10-01 中国建设银行股份有限公司 Business server side load balancing method, client side, server side and system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1455347A (en) * 2002-04-30 2003-11-12 电子科技大学 Distributed parallel scheduling wide band network server system
US20040243709A1 (en) * 2003-05-27 2004-12-02 Sun Microsystems, Inc. System and method for cluster-sensitive sticky load balancing
WO2009059456A1 (en) * 2007-11-06 2009-05-14 Lucent Technologies Inc. Method for controlling load balance of network system, client, server and network system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100377554C (en) * 2004-05-25 2008-03-26 华中科技大学 Load balancing method for cluster server

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1455347A (en) * 2002-04-30 2003-11-12 电子科技大学 Distributed parallel scheduling wide band network server system
US20040243709A1 (en) * 2003-05-27 2004-12-02 Sun Microsystems, Inc. System and method for cluster-sensitive sticky load balancing
WO2009059456A1 (en) * 2007-11-06 2009-05-14 Lucent Technologies Inc. Method for controlling load balance of network system, client, server and network system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113746894A (en) * 2021-07-23 2021-12-03 济南浪潮数据技术有限公司 Method and device for realizing load balancing based on HDFS RBF routing layer

Also Published As

Publication number Publication date
CN102316138A (en) 2012-01-11

Similar Documents

Publication Publication Date Title
US10523748B2 (en) Managing health status of network devices in a distributed global server load balancing system
RU2671045C2 (en) Synchronising credential hashes between directory services
US9554276B2 (en) System and method for on the fly protocol conversion in obtaining policy enforcement information
US8434156B2 (en) Method, access node, and system for obtaining data
CN101459836B (en) Service processing method and system for content distributing network of interactive network television
WO2013078875A1 (en) Content management method, device and system
CN102497409B (en) A kind of method of cloud computing system resource management
CN110086886B (en) Dynamic session holding method and device
WO2022022584A1 (en) Hashrate sharing method and related device
CN104754009A (en) Service acquisition and invocation method, device, client-side and server
WO2012000455A1 (en) Client terminal and load balancing method
TWI640214B (en) Network access method, related equipment and system
WO2013152565A1 (en) Capability aggregation and exposure method and system
CN103347087A (en) Structuring P2P and UDDI service registering and searching method and system
dos S. Lima et al. Peer-to-peer resource discovery in mobile grids
WO2016180284A1 (en) Service node allocation method, device, cdn management server and system
CN112543150B (en) Dynamic load balancing method based on server control
WO2014015525A1 (en) Method and device for querying for user online state
CN107770203B (en) Service request forwarding method, device and system
CN114025023B (en) Source returning method, device, equipment and computer readable storage medium
CN113596105B (en) Content acquisition method, edge node and computer readable storage medium
US20140047014A1 (en) Network access system
CN113190607B (en) HTTP request-based database load balancing method, device and medium
CN114006915A (en) Resource request method, device, equipment and computer readable storage medium
CN109327517B (en) Method and equipment for acquiring network state of wireless access point

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 11800200

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205N DATED 12/03/2013)

122 Ep: pct application non-entry in european phase

Ref document number: 11800200

Country of ref document: EP

Kind code of ref document: A1