aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Stateful and Cluster Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Stateful and Cluster" Watch "Stateful and Cluster" New topic
Author

Stateful and Cluster

A.Perdomo
Greenhorn

Joined: Sep 12, 2002
Posts: 9
Hello !
What happen if I have a Stateful bean in a cluster environment, and some clone or cluster fail? The conversational state of this object is replicated every time? Or?
I am worry about another thing. I am always trying to design to be independent browser, but my customers every time want more functionalities in the browser as menu (not simple menu ), etc, etc. Every time more clients know about the possibilities of Explorer over Netscape. How you manage this requirement? There is the posibilities of Microsoft don't give a support to javascript in future versions? Why others companies as IBM, are not worry about the browsers future?
The last question is not exactly about J2EE. If you consider that desviate the focus of this saloon, forget it.
Thanks, A.Perdomo.
Dave Landers
Ranch Hand

Joined: Jul 24, 2002
Posts: 401

What happen if I have a Stateful bean in a cluster environment, and some clone or cluster fail? The conversational state of this object is replicated every time? Or?

This would depend on your AppServer. It should provide you with features to control how failover will happen (and what it will "cost" for example replication, etc). Check the documentation.


I am worry about another thing. I am always trying to design to be independent browser, but my customers every time want more functionalities in the browser as menu (not simple menu ), etc, etc. Every time more clients know about the possibilities of Explorer over Netscape. How you manage this requirement? There is the posibilities of Microsoft don't give a support to javascript in future versions? Why others companies as IBM, are not worry about the browsers future?

I say this is up to the customer to decide.
Present them with options - for example: "You can have this feature, but then xx % of your customers not using IE will not be able to use the site." Or, "I can make this feature work in the top two browsers, but it will cost you this much extra time/money/etc."
It really depends on what they are trying to do. If it is an in-company web site, then it is not too bad to say "all employees must use Browser X".
But for a public site where you are trying to sell something (make money) you don't want to block out any potential buyers. Of course, these are the ones that also have to "look great" and thus usually want all the bells and whistles.
A.Perdomo
Greenhorn

Joined: Sep 12, 2002
Posts: 9
Let me try to understand, when you say:
"It should provide ",
that's a specification to CTM? The Bean developer, hasn't to worry for HA? ( Without consider the particular characteristics of app server )
"and what it will 'cost' for example replication, etc"
This "cost" is supported by app_server code or Always, I need to consider a replication code in my design , when I choose a Stateful bean? ( I know about "cost": performance, network resource, etc )
I am agree with you about check the documentation. But, I am trying to understand basic concepts.
Thanks, A.Perdomo.
Dave Landers
Ranch Hand

Joined: Jul 24, 2002
Posts: 401
What I mean is that failover is an AppServer feature, and is not really addressed by the EJB spec. At least, the spec does not say anything about how clustering or failover is implemented (or even that clustering is required at all).
There are several ways that failover could be provided by an appserver. For example, you could have the session instance serialized to other nodes after every business method. Or maybe it is serialized to a file, and that file must be accessible by all nodes. Or it could be serialized to a database so other nodes could find it. Or it could be just plain not possible.
WebLogic (which I happen to know about) implements this by choosing a backup node on the cluster and serializing the session state to that node on transaction commit (see http://edocs.bea.com/wls/docs70/ejb/EJB_environment.html#1090948). When a server fails, the Remote and Home stubs know where the secondary server is and failover to there.
To make this happen, you don't have to do anything in your code. There are changes to make in the weblogic-ejb-jar.xml deployment descriptor, but the code is all per spec.
Where the "cost" comes in is that you have to realize that nothing is free. You have two choices here:
1) No failover - so if a cluster node goes down that client is broken and has to start over.
2) Use Replication - in which case some of your server CPU and network is going to be used to serialize session state to the backup node.
In this case, you have to decide which of the two choices is better, weighing the cost of that CPU for replication vs. what it means to loose a client vs. how likely it is for a machine to crash. Fortunately, since the settings are in deployment descriptors, this is not a development-time decision, but a deployment-time decision.
Just make sure your session state does not include extra things that are really not needed (but would have to be serialized when replicated).

Another note:
Clustering really has a couple of uses. Sometimes, it is used just to throw more servers at a problem - you just want the load balancing and extra horsepower. Other times, clustering is used for reliability - make sure you don't loose any transactions even if some machine goes dead.
So that would be why, for example, you might decide to use a cluster but not have replication.
A.Perdomo
Greenhorn

Joined: Sep 12, 2002
Posts: 9
Thanks Dave, good answer and very useful to me.
Now, anybody knows if there is the Weblogic analogous to WAS?
A.Perdomo
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Stateful and Cluster