Automatically dispose the apparatus and method of Java EE application cluster
Technical field
The present invention relates to Java EE applied technical field, especially relate to a kind of apparatus and method of automatic configuration Java EE application cluster.
Background technology
Increasing mission critical and large-scale application operate on Java EE (Java Platform, the Enterprise Edition) platform, often exigent availability of these key application and scalability.Java EE Clustering is that Java EE product supplier is used to improve Java EE product availability and scalability, and realizes the load balancing most common form.
Fig. 1 has described existing Java EE group system 100.Client 101 is sent application request 102, and router and load equalizer 103 send to application request 102 application cluster 109 that operates on the node cluster 107 based on cluster-list 104.Node cluster 107 comprises several nodes 108, and node 108 can be a physical host, also can be fictitious host computer.Each node 108 is Java EE application server of operation usually, a plurality of Java EE of each application server deployment application 1 10, and the same application in a plurality of nodes constitutes an application cluster 109.In Fig. 1, there are two application clusters, be applied as " b ", being applied as in the Another application cluster " a " in one of them application cluster 109.
When the above-mentioned application cluster 109 of configuration; At first through application deployment unit 106 select target nodes 108; And at destination node 108 deploy application 1s 10; Through cluster configuration module 105 allocation clusters tabulation 104, the information in the cluster-list 104 comprises the node listing and the node load factor of application cluster 109 then.If in application cluster 109, increase or reduce a node 108, then need be through the node listing of cluster configuration module 105 manual modification application clusters 109.
Because configuration is loaded down with trivial details, the environment when the inapplicable application cluster of system 100 109 is larger, and do not support the dynamic retractility of application cluster.Yet normally dynamic change of the load of application has certain sudden.System 100 is if according to load peak configuration application cluster, can cause the waste of ample resources; If, then can cause the decline of service quality and user's loss in the load summit phase according to load average configuration application cluster.In addition, in system 100, application request can not be come the delivery applications request according to the actual loading situation of node according to preset static load factor select target node.
Summary of the invention
The technical problem that (one) will solve
The technical problem that the present invention will solve is the apparatus and method how a kind of automatic configuration Java EE application cluster is provided; Make and disposing new node, node failure perhaps after the node deploy is used; System can automatically accomplish reconfiguring of application cluster, and realizes adaptive dynamic load leveling.
(2) technical scheme
In order to solve the problems of the technologies described above; The invention provides a kind of device of automatic configuration Java EE application cluster; Comprise a plurality of nodes node cluster, operate in the application cluster on the node cluster; Java EE application server of operation on each node, a plurality of Java EE of each application server deploy use, and said device also comprises: memory cell, agent unit, the automatic administrative unit of cluster, Load Balance Unit, application deployment unit;
Memory cell is used for the tabulation of load factor, application cluster and the position thereof of memory node tabulation, node;
Agent unit is used to monitor the state of Java EE application server and internal container thereof; Transmission information is revised message and is given the automatic administrative unit of cluster in case Discovery Status changes; And the load factor of computing node periodically, concurrent carry information is revised message and is given the automatic administrative unit of cluster;
The automatic administrative unit of cluster is used for safeguarding memory cell institute canned data, when the message that receives agent unit, revises message according to said information the information that changes in the memory cell is done corresponding modification;
Load Balance Unit is used to receive the application request that client is sent, and according to the list of locations of the application cluster that obtains from memory cell and the load factor select target node of this application cluster place node, and application request is transmitted to destination node;
The application deployment unit provides the application deployment function, is used for application is disposed, and when application deployment, obtains selectable node listing from memory cell.
Preferably, said node is physical host or fictitious host computer.
The present invention also provides a kind of method of utilizing described device to dispose Java EE application cluster automatically, comprises following steps:
S1, agent unit are monitored the state of Java EE application server and internal container thereof in real time, and transmission information is revised message and given the automatic administrative unit of cluster in case Discovery Status changes;
S2, the automatic administrative unit of cluster receive that said information revises after the message automatically canned data in the updated stored unit;
After S3, Load Balance Unit receive the application request that client sends,, and application request is transmitted to destination node according to the application cluster tabulation that obtains from memory cell and the load factor select target node of node thereof.
Preferably; Also comprise step S0 before the step S1, when node just starts; The message that the agent unit of node will be used to obtain node place host address and port sends to the automatic administrative unit of cluster with multicast mode; The automatic administrative unit of cluster is received behind the multicast message agent unit that host address and the port with this node sends to node, thereby realizes the automatic discovery of node.
Preferably, the state of said monitoring Java EE application server and internal container thereof changes and comprises: node address changes, Java EE application server starts or the deployment that suspends, use is conciliate and disposed.
Preferably, also comprise step S1 ' between step S1 and the S2: agent unit at Java EE application server end periodically according to the step of the acquiescence or the load factor of self-defining load metric criterion calculation node.
Preferably, between step S1 ' and S2, also comprise step S1 ": agent unit sends to the automatic administrative unit of cluster and shows that node is in the heartbeat message of active state.
Preferably, between step S2 and S3, also comprise step S2 ': whether the heartbeat message predicate node that the automatic administrative unit of cluster was received according to preset time-out time and each node the last time lost efficacy.
After whether predicate node lost efficacy, the automatic administrative unit of cluster was initiatively sent application request and is given agent unit, to confirm whether node lost efficacy.
(3) beneficial effect
Technique effect of the present invention is mainly: (1) is through realizing finding Java EE application server node automatically and the real-time monitoring of node state being obtained the change information of node and application state; Correspondingly revise the configuration of application cluster then according to change information, thereby can dispose Java EE application cluster automatically along with the variation of application deployment.(2) thus provide one at the dynamic load balancing method of Java EE application server end according to the situation computational load factor delivery applications request of load and resource; Compare with the method for the static load factor of available technology adopting, the load balancing effect that can reach is more excellent.
Description of drawings
Fig. 1 is the group system sketch map according to existing techniques in realizing;
The group system sketch map that can realize dynamic-configuration that Fig. 2 realizes according to embodiments of the invention;
Fig. 3 is a method flow diagram of the present invention.
Embodiment
Below in conjunction with accompanying drawing and embodiment, specific embodiments of the invention is done further explain.Following examples are used to explain the present invention, but are not used for limiting scope of the present invention.
For making the object of the invention, technical scheme and advantage clearer, the present invention is made further detailed description below in conjunction with accompanying drawing.
Fig. 2 has described the system 200 according to the embodiment of the invention, and wherein according to the position of application cluster 209 in main frame crowd 206 and the load factor of node 208 thereof, working load balanced unit 203 transmits application request 202 from a plurality of clients 201 to application cluster 209.Especially; Agent unit 211 (being abbreviated as " agency " among Fig. 2) is the state and the periodicity computational load factor of monitor node 208 in real time; When changing, in time notify cluster automatic administrative unit 213, cluster-list, node location and load factor 204 and node listing 212 in the automatic administrative unit of the cluster 213 automatic updated stored unit 205.
In Fig. 2, node 4 is the nodes that just start, on its application server application deployment " b " afterwards, the user through application deployment unit 207 node 3 with node 4 deploy application " c ", " a " separates deployment to the application on the node 3.
When node 4 started successfully, agent unit 211 sent and comprises the multicast message that is used to obtain host address and port, and the automatic administrative unit 213 of cluster is told node 4 with oneself address and port after receiving multicast message.Behind the host address and port that obtain the automatic administrative unit 213 of cluster, agent unit 211 sends to the automatic administrative unit 213 of cluster with the application of having disposed on the node 4 " b ".The automatic administrative unit 213 of cluster is received cluster-list, node location and load factor 204 and the node listing 212 in the updated stored unit 205 after the updating message: in node listing, increase node 4, in the tabulation of application cluster 209, increase the address and the load factor of node 4, node 4.
The user is chosen in node 3 through application deployment unit 207 and uses " c " with node 4 deploy.Find the node deploy application " c " when the agent unit 211 of node 3 and node 4, notified cluster automatic administrative unit 213 application " c " of action type " application deployment " and deployment respectively.After the automatic administrative unit 213 of cluster is received updating message; Confirm that node 3 and 4 is in node listing 212; Only need cluster-list, node location and load factor 204 in the updated stored unit 205: increase and use the application cluster that c (210) forms, in the tabulation of application cluster, increase node 3 and node 4.
After this, the user is separating deployment through application deployment unit 207 to the application on the node 3 " a ".When the agent unit of node 3 211 was found that application " a " on the nodes is separated and disposed, the application " a " that action type " is separated application deployment " and separated deployment sent to the automatic administrative unit 213 of cluster.After the automatic administrative unit 213 of cluster is received updating message, the cluster-list in the updated stored unit 205, node location and load factor 204: deletion of node 3 in the tabulation of the application cluster of using a composition.
The present invention also provides a kind of method of utilizing described device to dispose Java EE application cluster automatically, comprises following steps:
S1, agent unit are monitored the state of Java EE application server and internal container thereof in real time, and transmission information is revised message and given the automatic administrative unit of cluster in case Discovery Status changes;
S2, the automatic administrative unit of cluster receive that said information revises after the message automatically canned data in the updated stored unit;
After S3, Load Balance Unit receive the application request that client sends,, and application request is transmitted to destination node according to the application cluster tabulation that obtains from memory cell and the load factor select target node of node thereof.
Preferably; Also comprise step S0 before the step S1, when node just starts; The message that the agent unit of node will be used to obtain node place host address and port sends to the automatic administrative unit of cluster with multicast mode; The automatic administrative unit of cluster is received behind the multicast message agent unit that host address and the port with this node sends to node, thereby realizes the automatic discovery of node.
Preferably, the state of said monitoring Java EE application server and internal container thereof changes and comprises: node address changes, Java EE application server starts or the deployment that suspends, use is conciliate and disposed.
Preferably, also comprise step S1 ' between step S1 and the S2: agent unit at Java EE application server end periodically according to the step of the acquiescence or the load factor of self-defining load metric criterion calculation node.
Preferably, between step S1 ' and S2, also comprise step S1 ": agent unit sends to the automatic administrative unit of cluster and shows that node is in the heartbeat message of active state.
Preferably, between step S2 and S3, also comprise step S2 ': whether the heartbeat message predicate node that the automatic administrative unit of cluster was received according to preset time-out time and each node the last time lost efficacy.
After whether predicate node lost efficacy, the automatic administrative unit of cluster was initiatively sent application request and is given agent unit, to confirm whether node lost efficacy.
Can find out that by above embodiment the present invention mainly solves the problem that Java EE application cluster can not dispose along with the variation of application deployment automatically.The main points of technical scheme are correspondingly revised the configuration of application cluster then for automatically finding through node and the change information of node and application state being obtained in the real-time monitoring of node state according to change information; Calculate the dynamic load factor delivery applications request that obtains according to Java EE application server end group in the situation of load and resource.Apparatus and method provided by the invention can realize Java EE application of dynamic cluster and adaptive dynamic load leveling, thereby improve availability and scalability that Java EE uses.
The present invention can be used for general Java EE applied environment.Especially, in cloud computing environment,, can realize that Java EE uses the variation that adapts to business demand automatically in conjunction with the telescopic infrastructure framework of cloud computing and based on the resource adjusting strategies of application load.
Above execution mode only is used to explain the present invention; And be not limitation of the present invention; The those of ordinary skill in relevant technologies field under the situation that does not break away from the spirit and scope of the present invention, can also be made various variations and modification; Therefore all technical schemes that are equal to also belong to category of the present invention, and scope of patent protection of the present invention should be defined by the claims.