CN105306598A - Remote data invocation method capable of realizing load balancing - Google Patents

Remote data invocation method capable of realizing load balancing Download PDF

Info

Publication number
CN105306598A
CN105306598A CN 201510802719 CN201510802719A CN105306598A CN 105306598 A CN105306598 A CN 105306598A CN 201510802719 CN201510802719 CN 201510802719 CN 201510802719 A CN201510802719 A CN 201510802719A CN 105306598 A CN105306598 A CN 105306598A
Authority
CN
Grant status
Application
Patent type
Prior art keywords
balancing
load
data
rmi
remote
Prior art date
Application number
CN 201510802719
Other languages
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

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network-specific arrangements or communication protocols supporting networked applications
    • H04L67/10Network-specific arrangements or communication protocols supporting networked applications in which an application is distributed across nodes in the network
    • H04L67/1002Network-specific arrangements or communication protocols supporting networked applications in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers, e.g. load balancing

Abstract

The invention provides a remote data invocation method capable of realizing load balancing. The remote data invocation method comprises the following steps that a client initiates a control chain to be connected to a load balancing system HAProxy, and after load balancing, RMI (Remote Method Invocation) object information of a corresponding server is acquired; then the client initiates a data chain again to be connected to the load balancing system HAProxy, and after load balancing again, the client is guided to a corresponding server side to perform data processing. The remote data invocation method capable of realizing load balancing provided by the invention realizes the load balancing of java RMI control chain and data chain in combination with the load balancing system, so that after RMI Client gets the RMI object information of any one server through the HAProxy, the HAProxy transmits the object information to any one another server, and right return can be obtained; all RMI servers are completely utilized, therefore the load balancing is truly achieved.

Description

一种可实现负载均衡的远程数据调用方法 A load balancing method of remote data calls

技术领域 FIELD

[0001] 本发明涉及一种网络通信领域,具体地说是一种可实现负载均衡的远程数据调用方法。 [0001] The present invention relates to the field of network communications, particularly to a method of remote data call load balancing may be implemented.

背景技术 Background technique

[0002] 目前,Java RMI (远程方法调用Remote Method Invocat1n),是一种机制,能够让在某个Java虚拟机上的对象调用另一个Java虚拟机中对象的方法。 [0002] Currently, Java RMI (Remote Method Invocation Remote Method Invocat1n), is a mechanism that allows objects on a Java virtual machine to call another Java virtual machine in the object method. 可以用此方法调用的任何对象必须实现该远程接口。 Any object can call this method must implement the remote interface. Client通过控制链连接到Server后,得到RMI对象信息[IP,PORT,Ob j Id],通过[IP:Port]建立数据链接,发送请求并获取0b jID对应的对象的响应。 Client connects to the Server through the control chain, to give the object information RMI [IP, PORT, Ob j Id], by: establishing a data link [IP Port], send a request and get a response object corresponding 0b jID.

[0003] HAProxy: 一种负载均衡系统,收到一个新的客户连接时,会依据配置的负载均衡算法选择某个服务器进行连接,转发2个socket的数据实现负载均衡。 [0003] HAProxy: A load balancing system, the customer receives a new connection, choose a server based load balancing algorithm configured to connect, forwarding two socket of load balancing.

[0004] 为了将RMI的client和server分离开来,实现server的部署情况对client透明,引入HAProxy组件,client发起控制链连接HAProxy拿到RMI服务器A的RMI对象信息,再次发起数据链连接HAProxy,数据链负载均衡时会被导向到另外一台RMI服务器B,导致服务器B返回错误响应。 [0004] In order to RMI client and server separated, deployment server to implement transparent client introduced HAProxy component, the control object information RMI client initiates the chain connector HAProxy get RMI server A, initiates a data link connection HAProxy again, data link will be directed to another load balancing a RMI server B, server B returns an error response leads. 这样,对于同一个Client的线程来说,导致任何时候,后续由该clinet发起的并发请求在后台只有1台服务器能够响应请求,其它服务器均处于闲置状态,没有很好的实现负载均衡。 Thus, for the same Client thread, the cause at any time, follow-up initiated by the clinet concurrent requests in the background, only one server can respond to requests, other servers are idle, there is no good load balancing.

发明内容 SUMMARY

[0005] 本发明的目的是针对现有负载均衡系统中的问题,提出一种可实现负载均衡的远程数据调用方法。 [0005] The present invention is directed to problems of the prior load balancing system proposed method of remote data call load balancing may be implemented. 让RMI client和server在控制链层面和数据链层面都实现RMI对象的无状态化,从而实现RMI通信的负载均衡。 Let RMI client and server in the chain of control plane and data-link level implement RMI object stateless, thereby load balancing RMI communication.

[0006] 本发明的技术方案是: [0006] aspect of the present invention is:

一种可实现负载均衡的远程数据调用方法,客户端client发起控制链连接负载均衡系统HAProxy,负载均衡后获取相应服务器的RMI对象信息,客户端client再次发起数据链连接负载均衡系统HAProxy,再次负载均衡后导向至相应的服务器端进行数据处理。 A load balancing method of remote data call, the client initiates client control connection load balancing system HAProxy chain, RMI acquiring object information corresponding to the server load balancing, the client initiates a data link connection client load balancing system HAProxy again, the load again after equalization directed to the appropriate server-side data processing.

[0007] 本发明包括以下步骤: [0007] The present invention comprises the steps of:

(1)、将各RMI服务器中RMI对象信息即对象ID按序生成,保持全局统一,所述的对象ID包括RMI服务器ID+方法序号; (1), each object information RMI server RMI i.e., an object ID generated sequentially, maintaining the overall unity, the object ID includes an RMI server ID + NUM;

将各RMI服务器的数据传输端口映射在负载均衡系统HAProxy中; The data transfer port mapping each RMI server load balancing system in HAProxy;

客户端client向负载均衡系统HAProxy发起控制指令查找RMI服务器,该控制指令包括HAProxylP+HAProxy 端口; Client to the load balancing client system initiates a control command to find HAProxy RMI server, the control command comprises HAProxylP + HAProxy port;

(2)、负载均衡系统HAProxy根据负载均衡结果选择RMI服务器转发步骤(1)的控制指令; (2), the load balancing system HAProxy selected RMI server forwards in step (1) a control command according to a load balancing result;

(3)、前述RMI服务器接收控制指令后,返回控制指令至负载均衡系统HAProxy,该控制指令包括HAProxylP+RMI服务器的数据传输端口+对象ID ; (3), the RMI server receives the control command, the control returns to the load balancing system HAProxy command, the control command comprises a data transmission HAProxylP + RMI server port + object ID;

(4)、负载均衡系统HAProxy转发步骤(3)的控制指令至客户端client,该控制指令包括HAProXyIP+ RMI服务器在负载均衡系统HAProxy中映射的数据传输端口+对象ID ; (4), the load balancing system HAProxy forwarding step (3) a control command to the client Client, the control command comprises a data transfer port HAProXyIP + + object mapping ID RMI server load balancing system in HAProxy;

(5)、客户端client向负载均衡系统HAProxy发出数据传输指令,该数据传输指令包括HAProxyIP+ RMI服务器在负载均衡系统HAProxy中映射的数据传输端口+对象ID ; (5), the client issues a data transfer instruction to the client the load balancing system HAProxy, the data transmission instruction includes a data transfer port + object ID HAProxyIP + RMI server load balancing system mapped in HAProxy;

(6)、负载均衡系统HAProxy再次进行负载均衡,根据负载均衡结果选择RMI服务器; (6), the load balancing system HAProxy load balancing again, according to a load balancing server RMI selected result;

(7)、前述RMI服务器接收数据指令后,将数据指令里附带的RMI对象信息即对象ID与本地的RMI对象信息比较时,屏蔽RMI服务器ID即虚拟机的比较,只比较方法序号,根据方法序号进行数据处理,返回数据处理结果至负载均衡系统HAProxy ; (7), the RMI server receives data instructions, the RMI object data instructions in the accompanying information, that object ID with local RMI objects when calculating the shield Comparative RMI server ID, i.e. a virtual machine, comparing only NUM, according to the method No. data processing, returns the data processing result to the load balancing system HAProxy;

(8)、负载均衡系统HAProxy转发步骤(7)的数据处理结果至客户端client。 Data processing result (8), the load balancing system HAProxy forwarding step (7) to the client client.

[0008] 本发明的步骤(1)中,对象ID按序生成是指:在各RMI服务器中,相同方法的序号一致。 [0008] The steps of the present invention (1), the object ID is sequentially generating means: in the RMI server, the same number of the same method.

[0009] 本发明的有益效果: [0009] Advantageous effects of the invention:

本发明结合负载均衡系统(例如HAProxy、Nginx等)实现java RMI控制链和数据链的负载均衡,使得RMI Client通过HAProxy拿到任何一台服务器的RMI对象信息后,通过HAProxy发送此对象信息到任何另外一台服务器上,均可得到正确的返回,完全利用了所有的RMI服务器,真正实现了负载均衡。 The present invention combines the load balancing system (e.g. HAProxy, the Nginx etc.) Java RMI load balancing and data link control chain, such RMI Client RMI object by HAProxy get any information server transmits information to the object by any HAProxy on another server, you can get the right return, take full advantage of all the RMI server, the real load balancing.

[0010] [0010]

附图说明 BRIEF DESCRIPTION

[0011 ] 图1是本发明的流程图。 [0011] FIG. 1 is a flowchart illustrating the present invention.

[0012] 图2是传统方法的流程图。 [0012] FIG 2 is a flowchart of a conventional method.

[0013] [0013]

具体实施方式 detailed description

[0014] 下面结合附图和实施例对本发明作进一步的说明。 Drawings and embodiments of the present invention will be further described [0014] below in conjunction.

[0015] 如图2所示,传统方法中,由于原生Java RMI方案的并不支持client和server之间数据链层面的负载均衡,使得在RMI客户端和Server端之间直接引入类似HAProxy组件来实现负载均衡的方案存在问题。 [0015] As shown in FIG. 2, the conventional method, since the native Java RMI programs do not support load balancing data link level between the client and server, so that the component to be introduced directly between similar HAProxy RMI Server and client terminal there is a problem of load balancing scheme.

[0016] 对于同一个Client的线程来说,导致任何时候,后续由该clinet发起的并发请求在后台只有1台服务器能够响应请求,其它服务器均处于闲置状态。 [0016] Client for the same thread, the lead at any time, initiated by the subsequent concurrent requests clinet background only one server can respond to requests, other servers are idle. 为了让服务器B也被利用,需要将【5请求】也定向到HAProxy,HAProxy可以把请求转发到Server A或者B,但是这样有新的问题,如果【1234】过程拿到的是A的ID,然后通过【5678】这样的流程到达了B,实际上B是不认可A的ID的请求在B本机上执行的,执行出错。 In order for server B is also being used, you need to request [5] is also directed to HAProxy, HAProxy can forward the request to Server A or B, but it is a new problem, [1234] if the process is to get the ID A's, then [5678] such flow goes to B, B is in fact a request does not recognize the ID a is performed on the machine B, execution error.

[0017] 如图1所示,通过修改远程调用方法,实现对于【5678】的请求,可以实现【A的ID到B上执行】以及【B的ID到A上执行】,都不会出错,这样就充分发挥HAProxy的负载均衡功能,利用上后端所有的服务器,实现RMI对象的无状态化,使得服务器资源百分百使用,具体包括以下步骤: [0017] 1, by modifying the remote procedure, implement a request for [5678] can be implemented to A [ID], and [B performs the ID B to perform the A], are not wrong, This HAProxy full load balancing, using the back-end servers of all, to achieve a state of no RMI objects, such hundred percent use of server resources, comprises the steps of:

(1)、将各RMI服务器中RMI对象信息即对象ID按序生成,保持全局统一,所述的对象ID包括RMI服务器ID+方法序号; (1), each object information RMI server RMI i.e., an object ID generated sequentially, maintaining the overall unity, the object ID includes an RMI server ID + NUM;

将各RMI服务器的数据传输端口映射在负载均衡系统HAProxy中; The data transfer port mapping each RMI server load balancing system in HAProxy;

客户端client向负载均衡系统HAProxy发起控制指令查找RMI服务器,该控制指令包括HAProxylP+HAProxy 端口; Client to the load balancing client system initiates a control command to find HAProxy RMI server, the control command comprises HAProxylP + HAProxy port;

(2)、负载均衡系统HAProxy根据负载均衡结果选择RMI服务器转发步骤(1)的控制指令; (2), the load balancing system HAProxy selected RMI server forwards in step (1) a control command according to a load balancing result;

(3)、前述RMI服务器接收控制指令后,返回控制指令至负载均衡系统HAProxy,该控制指令包括HAProxylP+RMI服务器的数据传输端口+对象ID ; (3), the RMI server receives the control command, the control returns to the load balancing system HAProxy command, the control command comprises a data transmission HAProxylP + RMI server port + object ID;

(4)、负载均衡系统HAProxy转发步骤(3)的控制指令至客户端client,该控制指令包括HAProXyIP+ RMI服务器在负载均衡系统HAProxy中映射的数据传输端口+对象ID ; (4), the load balancing system HAProxy forwarding step (3) a control command to the client Client, the control command comprises a data transfer port HAProXyIP + + object mapping ID RMI server load balancing system in HAProxy;

(5)、客户端client向负载均衡系统HAProxy发出数据传输指令,该数据传输指令包括HAProxyIP+ RMI服务器在负载均衡系统HAProxy中映射的数据传输端口+对象ID ; (5), the client issues a data transfer instruction to the client the load balancing system HAProxy, the data transmission instruction includes a data transfer port + object ID HAProxyIP + RMI server load balancing system mapped in HAProxy;

(6)、负载均衡系统HAProxy再次进行负载均衡,根据负载均衡结果选择RMI服务器; (6), the load balancing system HAProxy load balancing again, according to a load balancing server RMI selected result;

(7)、前述RMI服务器接收数据指令后,将数据指令里附带的RMI对象信息即对象ID与本地的RMI对象信息比较时,屏蔽RMI服务器ID即虚拟机的比较,只比较方法序号,根据方法序号进行数据处理,返回数据处理结果至负载均衡系统HAProxy ; (7), the RMI server receives data instructions, the RMI object data instructions in the accompanying information, that object ID with local RMI objects when calculating the shield Comparative RMI server ID, i.e. a virtual machine, comparing only NUM, according to the method No. data processing, returns the data processing result to the load balancing system HAProxy;

(8)、负载均衡系统HAProxy转发步骤(7)的数据处理结果至客户端client。 Data processing result (8), the load balancing system HAProxy forwarding step (7) to the client client.

[0018] 本发明未涉及部分均与现有技术相同或可采用现有技术加以实现。 [0018] The present invention relates to non-parts are to be employed to achieve the same prior art or prior art.

Claims (3)

  1. 1.一种可实现负载均衡的远程数据调用方法,其特征是:客户端client发起控制链连接负载均衡系统HAProxy,负载均衡后获取相应服务器的RMI对象信息,客户端client再次发起数据链连接负载均衡系统HAProxy,再次负载均衡后导向至相应的服务器端进行数据处理。 A remote data call load balancing method may be implemented, characterized in that: the client initiating client control connection load balancing system HAProxy chain, RMI acquiring object information corresponding to the server load balancing, the client initiates a data link connection client load again equalization system HAProxy, the load balancing again directed to the appropriate server-side data processing.
  2. 2.根据专利要求1所述的可实现负载均衡的远程数据调用方法,其特征是它包括以下步骤: (1)、将各RMI服务器中RMI对象信息即对象ID按序生成,保持全局统一,所述的对象ID包括RMI服务器ID+方法序号; 将各RMI服务器的数据传输端口映射在负载均衡系统HAProxy中; 客户端client向负载均衡系统HAProxy发起控制指令查找RMI服务器,该控制指令包括HAProxylP+HAProxy 端口; (2)、负载均衡系统HAProxy根据负载均衡结果选择RMI服务器转发步骤(1)的控制指令; (3)、前述RMI服务器接收控制指令后,返回控制指令至负载均衡系统HAProxy,该控制指令包括HAProxylP+RMI服务器的数据传输端口+对象ID ; (4)、负载均衡系统HAProxy转发步骤(3)的控制指令至客户端client,该控制指令包括HAProXyIP+ RMI服务器在负载均衡系统HAProxy中映射的数据传输端口+对象ID ; (5)、客户端client向负载均衡系统HAProxy发 The remote data call load balancing method according to patent claim 1, characterized in that it comprises the following steps: (1), each object information RMI server RMI i.e., an object ID generated sequentially, maintaining the overall unity, the object ID includes an RMI server ID + NUM; the data transfer port mapping each of the RMI server load balancing system HAProxy; the client client sends a control command to find RMI servers to the load balancing system HAProxy, the control command comprises HAProxylP + HAProxy port; (2), the load balancing system HAProxy selected RMI server according to a load balancing forwards the result of step (1) control command; (3), the RMI server receives the control command, returns control instruction to a load balancing system HAProxy, the control command comprising a data transfer port + object ID HAProxylP + RMI server; control command (4), the load balancing system HAProxy forwarding step (3) to the client client, the control command comprises HAProXyIP data + the RMI server for a map in the load balancing system HAProxy in + object transfer port ID; (5), sent to the client the client load balancing system HAProxy 数据传输指令,该数据传输指令包括HAProxyIP+ RMI服务器在负载均衡系统HAProxy中映射的数据传输端口+对象ID ; (6)、负载均衡系统HAProxy再次进行负载均衡,根据负载均衡结果选择RMI服务器; (7)、前述RMI服务器接收数据指令后,将数据指令里附带的RMI对象信息即对象ID与本地的RMI对象信息比较时,屏蔽RMI服务器ID即虚拟机的比较,只比较方法序号,根据方法序号进行数据处理,返回数据处理结果至负载均衡系统HAProxy ; (8)、负载均衡系统HAProxy转发步骤(7)的数据处理结果至客户端client。 Data transfer instruction, the data transmission instruction includes HAProxyIP + data transfer port + object ID RMI server mapping in the load balancing system HAProxy; and (6), the load balancing system HAProxy load balancing again, select the RMI server according to a load balancing result; (7 ), after the RMI server receives data instructions, the RMI object data instructions in the accompanying information, that object ID with local RMI objects when calculating the shield Comparative RMI server ID, i.e. a virtual machine, comparing only NUM, according to the method Reference data processing and returns the data processing result to the load balancing system HAProxy; (. 8), the load balancing system HAProxy forwarding step (7) of the data processing result to the client client.
  3. 3.根据专利要求2所述的可实现负载均衡的远程调用方法,其特征是步骤(1)中,对象ID按序生成是指:在各RMI服务器中,相同方法的序号一致。 The remote method call load balancing in Patent Claim 2, wherein the step (1), the object ID is sequentially generating means: in the RMI server, the same number of the same method.
CN 201510802719 2015-11-19 2015-11-19 Remote data invocation method capable of realizing load balancing CN105306598A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201510802719 CN105306598A (en) 2015-11-19 2015-11-19 Remote data invocation method capable of realizing load balancing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201510802719 CN105306598A (en) 2015-11-19 2015-11-19 Remote data invocation method capable of realizing load balancing

Publications (1)

Publication Number Publication Date
CN105306598A true true CN105306598A (en) 2016-02-03

Family

ID=55203340

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201510802719 CN105306598A (en) 2015-11-19 2015-11-19 Remote data invocation method capable of realizing load balancing

Country Status (1)

Country Link
CN (1) CN105306598A (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1549978A (en) * 2001-07-16 2004-11-24 Bea系统公司 Method and apparatus for session replication and failover
CN1754146A (en) * 2003-02-24 2006-03-29 Bea系统公司 System and method for server load balancing and server affinity

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1549978A (en) * 2001-07-16 2004-11-24 Bea系统公司 Method and apparatus for session replication and failover
CN1754146A (en) * 2003-02-24 2006-03-29 Bea系统公司 System and method for server load balancing and server affinity

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
闫钧华等: "基于Java的分布式测控系统任务调度研究", 《系统工程与电子技术》 *
陈志刚等: "分布式系统中一种动态负载均衡策略、相关模型及算法研究", 《小型微型计算机系统》 *
陈志刚等: "基于Java RMI技术的中间应用服务器动态负载均衡模型的实现", 《计算机工程》 *

Similar Documents

Publication Publication Date Title
US20120036180A1 (en) Service virtualization over content-centric networks
US20080016155A1 (en) One-Click Universal Screen Sharing
US9055139B1 (en) Display protocol interception in the network for services and network-based multimedia support for VDI
JP2006174374A (en) Relay system
CN102497395A (en) Breakpoint unloading application control method
US20120278878A1 (en) Systems and methods for establishing secure virtual private network communications using non-privileged vpn client
US20100235901A1 (en) Cifs proxy authentication
US20130232470A1 (en) Launching an application stack on a cloud platform environment
CN102143156A (en) Desktop sharing method and device
CN103269280A (en) Method, device and system for developing service in network
US20110213956A1 (en) Techniques for managing a secure communication session
US20050276281A1 (en) Methods, systems, and computer program products for transparently controlling communications between network applications and a plurality of network communications protocol stacks using deferred protocol stack association
US20070157158A1 (en) Software implementation of hardware platform interface
CN101741866A (en) On-line storage system and method
US9137210B1 (en) Remote browsing session management
US20110258318A1 (en) Network device and method for dynamically allocating connection resources
CN102148881A (en) Address processing method and device
CN103176833A (en) Data transmission method, data receiving method and system based on virtual machine
US20150189004A1 (en) Method and farm load balancing device for establishing a bi-directional server to server communication and computer program thereof
CN102333128A (en) Active transmission method for real-time Web data
CN103905303A (en) Method, device and system for processing data after VM transfer across subnet
US20110040968A1 (en) Method and system for forwarding data between private networks
US20120191828A1 (en) Method and apparatus of performing remote command dispatching
CN102647470A (en) Cloud download method in on-line application platform and on-line application platform system
US8316139B2 (en) Systems and methods for integrating local systems with cloud computing resources

Legal Events

Date Code Title Description
C06 Publication
C10 Entry into substantive examination
RJ01