[Clustering/JBoss] - Clustering and load balancing EJB 2.x
by itchy75
Hi,
I launch 2 Jboss servers (4.0.5) in cluster and I want to load balance the ejb calls between the two servers. I read the documentation and I created a cluster-service.xml and I modified my ejb configuration as follow :
Part of cluster-service.xml
| <mbean code="org.jboss.ha.jndi.HANamingService"
| name="jboss:service=HAJNDI">
| <!-- We now inject the partition into the HAJNDI service instead
| of requiring that the partition name be passed -->
| <depends optional-attribute-name="ClusterPartition"
| proxy-type="attribute">jboss:service=${jboss.partition.name:DefaultPartition}</depends>
| <!-- Bind address of bootstrap and HA-JNDI RMI endpoints -->
| <attribute name="BindAddress">${jboss.bind.address}</attribute>
| <!-- RmiPort to be used by the HA-JNDI service
| once bound. 0 => auto. -->
| <attribute name="RmiPort">0</attribute>
| <!-- Port on which the HA-JNDI stub is made available -->
| <attribute name="Port">1100</attribute>
| <!-- Backlog to be used for client-server RMI
| invocations during JNDI queries -->
| <attribute name="Backlog">50</attribute>
| <!-- The thread pool service used to control the bootstrap and
| auto discovery lookups -->
| <depends optional-attribute-name="LookupPool"
| proxy-type="attribute">jboss.system:service=ThreadPool</depends>
| <!-- A flag to disable the auto discovery via multicast -->
| <attribute name="DiscoveryDisabled">false</attribute>
| <!-- Set the auto-discovery bootstrap multicast bind address. If not
| specified and a BindAddress is specified, the BindAddress will be used. -->
| <attribute name="AutoDiscoveryBindAddress">${jboss.bind.address}</attribute>
| <!-- Multicast Address and group port used for auto-discovery -->
| <attribute name="AutoDiscoveryAddress">${jboss.partition.udpGroup:230.0.0.4}</attribute>
| <attribute name="AutoDiscoveryGroup">1102</attribute>
| <!-- The TTL (time-to-live) for autodiscovery IP multicast packets -->
| <attribute name="AutoDiscoveryTTL">16</attribute>
| <!-- The load balancing policy for HA-JNDI -->
| <attribute name="LoadBalancePolicy">org.jboss.ha.framework.interfaces.RoundRobin</attribute>
|
| <!-- IP Address to which should be bound: the Port, the RmiPort and
| the AutoDiscovery multicast socket. -->
| <!-- Client socket factory to be used for client-server
| RMI invocations during JNDI queries -->
| <!--attribute name="ClientSocketFactory">custom</attribute-->
| <!-- Server socket factory to be used for client-server
| RMI invocations during JNDI queries -->
| <!--attribute name="ServerSocketFactory">custom</attribute-->
| </mbean>
EJB configuration :
<jboss>
| <enterprise-beans>
| <!-- Session -->
| <session>
| <ejb-name>myBean</ejb-name>
| <jndi-name>myBean</jndi-name>
| <clustered>True</clustered>
| <cluster-config>
| <partition-name>
| ${jboss.partition.name:DefaultPartition}
| </partition-name>
| <home-load-balance-policy>
| org.jboss.ha.framework.interfaces.RoundRobin
| </home-load-balance-policy>
| <bean-load-balance-policy>
| org.jboss.ha.framework.interfaces.RoundRobin
| </bean-load-balance-policy>
| </cluster-config>
| </session>
| </enterprise-beans>
| </jboss>
Everything is good in the JMX console, the EJB is deployed in the two servers and available on both (check with DistributedReplicantManager->listContent()).
The client application (another jboss server) is configured to lookup into the HAJNDI service of the first server.
The problem is that the ejb calls are never balanced. Each time I call it, it runs on the first server. When I undeploy the ejb from the first server, it calls the ejb on the second server (so cluster HAJNDI works). Then I deploy again the ejb on the first server and it will always call the ejb on the first server.
I have understood that HA JNDI algorithm is something like that :
1. look for name in HAJNDI tree
2. if not found, look in local jndi tree
3. if not found, look in all cluster nodes
Is that right ?
So, where does load balancing on ejb is done ? In the EJB itself ?
I have followed all the instructions in the guide, what's wrong ?
Thanks for help.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4068843#4068843
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4068843
18Â years, 8Â months
[Installation, Configuration & DEPLOYMENT] - Packagin complex Application.ear
by twolf
Hi there,
Hope i am right here. So, my problem is to package a "complex" application together.
At the moment we have got two archives, one jar file containing EJBs and one war file containing servlets and other site stuff (jsp, static html, css and so on). Both of them use the same util-archives, both got them seperatly in their context. There are no problems until a servlet overgives an object (class definition from the util-archive) to an ejb which was loaded with two different classloaders - an classloader exception is thrown. I decided to put my two archives, the ejb.jar and our web.war to one app.ear - but i really do not understand to handle that correctly.
Here is what i have build:
| Blubblub-App.ear:
| |
| +-META-INF
| +- MANIFEST.MF
| +- application.xml
| |
| +-lib/
| +-xerces-2_6_2.jar
| +-nutch-0.9.jar
| +-lucene-mics.jar
| +-lucene-core.jar
| +-hadoop-0.12.2-core.jar
| +-commons[...].jar
| +-Blublub-Engine.jar
| |
| +-conf/ (Empty cause i dont know what to do)
| |
| +-properties
| +-blublbub.properties
| |
| +-Blublbub-EJB.jar
| +-META-INF
| +-MANIFEST.MF [Class-Path: lib/...]
| +-ejb-jar.xml
| |
| +-Blublub-WEB.war
| (Dont know how to acces to the lib/ folder above)
|
The nutch-0.9.jar,hadoop.jar also needs some (mostly) xml based configuration files, they must be in the classpath too. Servlets and some JSP Files need to access to the files in the lib dir. Both, a servlet and a session-bean need to exchange objects defined in the lib dir.
So, can anybody help me?
Greeting from Germany
Tobias
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4068837#4068837
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4068837
18Â years, 8Â months