Chapter 17: Clustering The major disadvantage is the

Chapter 17: Clustering The major disadvantage is the lack of HA features. A crashed server means lost sessions. In situations in which server crashes are rare occurrences, and when session losses during these rare occasions are acceptable, this should be the clustering solution deployed. Sticky Sessions with a Persistence Manager and a Shared File Store Tomcat 6 is packaged with a Persistence Manager component that can be configured into any application context. Chapter 6 covers the configuration of this component. The main purpose of persistence management is to provide continuity to sessions when a server shuts down and is restarted. Because the sessions are persisted to either the disk or an RDBMS (via a File Store or a JDBC Store component), they can have a lifecycle that is longer than the server s. In addition, because sessions can be configured to be swapped out to the store after a specified idle time, the Persistence Manager also provides a form of protection against system crashes. (That is, any persistent session can be recovered when the system restarts after a crash.) Note that the Persistence Manager in Tomcat 6 is designed with no consideration for clustering. It deals only with the lifecycle and session of one single Tomcat instance. However, by sharing the store between multiple Tomcat 6 server instances (via either a shared file system or an RDBMS), a certain level of session sharing can be accomplished. Figure 17-6 illustrates the Persistence Manager with a shared file store. In this case, all the Tomcat server instances use the same directory to store their sessions. This directory is accessible from all the servers via the OS s shared file mechanism (NFS, SMB, and so on). Now, any sessions created by any Tomcat instance will eventually be visible to the other instances. Any modifications made by any instance will also be eventually visible to the other instances. It is important to reiterate the importance of the word eventually here because the Persistent Session Manager does not guarantee exactly when a session will be persisted to the store (either after creation or modification). Until a session (or a change in the session) is persisted to the store, that information is not available to the other instances. Shared file system Persistence Manager and File Store Tomcat 6 instance Persistence Manager and File Store Tomcat 6 instance Persistence Manager and File Store Tomcat 6 instance Persisting and accessing session information Figure 17-6: Tomcat 6 s Persistence Manager with a shared file store At this point, you may be wondering what good a clustering system is that eventually shares its session information. There is actually a very good and pragmatic answer. It is slightly better than the sticky session with no session sharing solution previously discussed. In clustering situations where server crashes happen very infrequently, using this scheme can further minimize the loss of sessions during the moment of system crash and fail-over. This is because any

For high quality java hosting services please check java web hosting website.

Comments are closed.