Problem in Load Balancing in a Jboss 5.1 Cluster
rajsoni Mar 12, 2010 11:54 AMHello Everyone!
I'm having a problem with load balancing a call to the two nodes that I have in a Jboss cluster.Would really appreciate any help on this!
Am running a local Java client that calls a Stateless EJB deployed on the two nodes in a cluster.
Here's how the jboss.xml looks for the stateless EJB:
<?xml version="1.0"?>
<jboss xmlns:xs="http://www.jboss.org/j2ee/schema"
xs:schemaLocation="http://www.jboss.org/j2ee/schema jboss_5_0.xsd"
version="5.0">
<enterprise-beans>
<session>
<ejb-name>MktSearch</ejb-name>
<jndi-name>MktSearchEJB</jndi-name>
<local-jndi-name>LocalMktSearchEJB</local-jndi-name>
<clustered>True</clustered>
<cluster-config>
<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>
<container-configurations>
<container-configuration>
<container-name>Standard Stateless SessionBean</container-name>
<call-logging>false</call-logging>
<invoker-proxy-binding-name>stateless-unified-invoker</invoker-proxy-binding-name>
<container-interceptors>
<interceptor>org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.LogInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.security.PreSecurityInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.SecurityInterceptor</interceptor>
<!-- CMT -->
<interceptor transaction="Container">org.jboss.ejb.plugins.TxInterceptorCMT</interceptor>
<interceptor transaction="Container">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
<interceptor transaction="Container">org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor</interceptor>
<!-- BMT -->
<interceptor transaction="Bean">org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor</interceptor>
<interceptor transaction="Bean">org.jboss.ejb.plugins.TxInterceptorBMT</interceptor>
<interceptor transaction="Bean">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
<interceptor>org.jboss.resource.connectionmanager.CachedConnectionInterceptor</interceptor>
</container-interceptors>
<instance-pool>org.jboss.ejb.plugins.StatelessSessionInstancePool</instance-pool>
<instance-cache></instance-cache>
<persistence-manager></persistence-manager>
<container-pool-conf>
<MaximumSize>100</MaximumSize>
</container-pool-conf>
</container-configuration>
<!-- ... -->
</container-configurations>
</jboss>
I see that for an MDB which is deployed on the cluster,load balancing is working fine.In this case I see messages in logs,some messages get processed on node1 and some on node2.
For my local Java client,if I shut down node1, and restart my client,all calls go to node2 and vice-versa.But I need to restart the client for all calls to get rerouted.
If load balancing was working fine,I would expect that I would not need to restart the client.
Am starting the two nodes like this :
./run.sh -c node1 -b 10.9.10.164 -g DefaultPartition -u 239.255.100.102 -Djboss.messaging.ServerPeerID=1 -Djboss.service.binding.set=ports-01
./run.sh -c node2 -b 10.9.10.164 -g DefaultPartition -u 239.255.100.102 -Djboss.messaging.ServerPeerID=2 -Djboss.service.binding.set=ports-02
Would really appreciate and help/pointers for this!!
thanks!