• Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB Clustering: Initial design  RSS feed

 
Avianu Sud
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am looking at a Weblogic CLustering setup.
Have a basic question.

When a user has a Active HttpSession(in one instance), we keep a handle to the StatefulSession EJB in the Http Session. Further the HttpSession Keeps many domain objects.

With Clustering, will Weblogic ensure that the complete HttpSession Data is replicated on both Weblogic Clusters? This can be expensive, with double memory and processing?

Additionally, when a user makes multiple requests, can they switch between the cluster servers, or will does WL provide Session Affinity, and switchover only during a failure?

Please share your ideas,
- Avi
 
Valentin Tanase
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Avi,

With Clustering, will Weblogic ensure that the complete HttpSession Data is replicated on both Weblogic Clusters?

Weblogic uses several forms of session persistence and the two most commonly used are in-memory replication (used by SFSBs as well) and JDBC persistence. Hence the session information can persist to server failures. The way it works might be pretty intuitive for JDBC persistence but is not so obvious for in-memory replication (which is probably the most common choice). In a nutshell after creating the HttpSession object on the primary server, Weblogic will also pick another secondary instance and will copy the session data as well. Finally it will encode both addresses into the session ID cookie (or use the url-rewriting technique if cookies are disabled). Form now on Weblogic will always keep both primary and secondary servers in sync (using Ip-multicast protocol) and will make sure that all client requests with the same session Id will be redirected to the same primary. If primary goes down, Weblogic will promote the secondary to primary and will pick another secondary from the available instances in the cluster.

This can be expensive, with double memory and processing?

Yes it does. When using in-memory replication Weblogic will replicate the whole graph if an object is changed. Therefore is more efficient to bind into the session more fine grained objects, rather than few coarse grained objects. Is important to notice that changing an object bound into the session (using either setAttribute or removeAttribute), will result in replicating only that object and not the entire HttpSession data. In contrast, changing any value in a SFSB will result in replicating the whole stateful session data.

Additionally, when a user makes multiple requests, can they switch between the cluster servers, or will does WL provide Session Affinity, and switchover only during a failure?

Weblogic uses two techniques for routing http requests: either a special Web server plug-in, or a hardware load balancer. The former will always check if the current http request has a session id and will redirect it to the appropriate primary instance. Otherwise it will use a specific load balance algorithm (default is round-robin). The second approach is little bit more complex, but it could become pretty efficient if the hardware load balancer uses a sticky load balancing algorithm (all client requests goes to the same instance).
Regards.
 
Avianu Sud
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Very Very helpful. Thanks much.

Owe you one.
 
Valentin Tanase
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're very welcome Avianu. I'm glad I could help
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!