[jboss-user] [Clustering] - FirstAvailable LBP is sticky when not serialized

fuzzy333 do-not-reply at jboss.com
Mon Dec 7 09:54:59 EST 2009


JBoss 4.2.3.GA

I'm having some trouble getting this scenario working:

Web service client
Apache load balancer
Two JBoss nodes in a cluster, one primary, one fail over
One web service and one "worker" stateful session bean hosted in both JBoss nodes

The client invokes the web service, the call goes through the load balancer, the primary is selected unless it has failed. So far so good. The web service extracts a session id from the web service parameters, this is used to key the worker session bean reference. I need instances of this worker bean to get distributed between the two nodes to spread out the load. I configured the bean to use the FirstAvailable load balance policy, which is exactly what I need, but I find that the calls are not distributed between the nodes! The node is initially randomly selected, but once one is chosen it is used for all instances. 

So I did a little digging, and in the FirstAvailable load balance policy I find that after initially selecting a target node, it is cached in a transient variable:

protected transient Object electedTarget = null;

However since one instance of this load balance policy is created (at startup from what I can tell, I'm not sure if it's shared between different bean type either, but I suspect not), this means that local (same vm) clients like my web service end up choosing the target once and sticking with it for all instances: it expects to get serialized to a remote client.

I could serialize the reference when acquiring it to reproduce the behavior of sending it to a remote client, but that seems patchy. Is there some other way of getting this working that I'm missing? Should I open a JIRA for this?

Thanks in advance!
Jonathan Tougas

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269359#4269359

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4269359



More information about the jboss-user mailing list