• Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB3 & load balancing  RSS feed

 
Mohan Rama
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
I've a basic query on load balancing in EJB3.0. I am using Jboss 5.0.0 GA.

I've clustered setup for EJB3.0 and I've modified the load balacing to Round Robin policy.

my remote client code is something like this..

a) do lookup for both the servers , this is how I specify the url
env.put("java.naming.provider.url","<IPAdd1>:1100,<IPAdd1>:1100");

b) have a for loop and make say 10 calls to the ejb method.
getdata1 , getdata2 etc...

Now with the lookup done only once , all the 10 calls are routed to the same server. Is that how it is expected to work?

I am looking to see if the 10 calls will be alternated between 2 servers...

If I have the lookup inside the for loop , the calls are routed alternatively(server1, server 2,server 1, server 2 etc) as there is a lookup..

Can you please explain how this works?

Also I don't want to do the lookup for each call as it is an expensive operation and time consuming as well.. Any alternate suggestions for this.
 
RaviNada Kiran
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Load balancing is never done in your code.

It is done inside the server (Clustering).

If its Weblogic i may help you.
 
Mohan Rama
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not looking for load balancing in the code.

I am trying to understand how load balancing works in the server. I am expecting the server to load balance the calls from client, and since it is not happening I've posted this question.

I am trying to understand if the server has jndi details stored statically as mentioned in this post https://jira.jboss.org/jira/browse/JBAS-5253

I think this is the behaviour irrespective of whether it is weblogic or jboss servers.

Please let me know if you have any idea on the working of load balancing in a clustered environment with respect to my eg in the first post.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!