Clustering


According to webopidia.com, clustering is defined as "two or more computers together in such a way that they behave like a single computer. Clustering is used for parallel processing, load balancing and fault tolerance."

Clustering can apply to everything from application servers to databases to networking devices and more. In the world of Java, clustering is typically used to achieve stability and reliability in enterprise applications. For example, on the scalability front, this can mean HTTP session and component failover.

Entire articles have been written on this subject, but let me provide some minimal guidelines here for clustering your Java applications:

  • Serialize the objects that we want to provide failover for (for example, a user object established after a login session). Clustering can be done only for Java primitive types and Serializable objects.

  • Do not use static variables to hold information, because this will not get replicated or will be applicable to only one instance of the server. For example, using singleton on one server won't get us the same information on another server. This is perhaps one reason the Spring Framework doesn't advocate the use of Singleton objects and instead recommends having Spring handle singletons for us.

  • Limit the quantity of data in components that need to be failed over. This can impact performance of the application server, for example, because it needs to replicate this information across multiple instances.

  • Clustering in application (and web) servers is done for in-memory persistent data. For example, your data that is persistent in the database but not in memory won't get replicated by a web/application server.

  • In general, strive for simplicity when designing the classes you want clustered.



Agile Java Development with Spring, Hibernate and Eclipse
Agile Java Development with Spring, Hibernate and Eclipse
ISBN: 0672328968
EAN: 2147483647
Year: 2006
Pages: 219

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net