Chapter 17: Clustering coat, which the establishment holds
Chapter 17: Clustering coat, which the establishment holds on your behalf. The browser client holds the cookie, and returns the cookie each time in a connection to the server. Using the cookie, the server is able to locate the session on which the browser client is working. For browsers that do not support cookies, it is possible to use URL rewrite to achieve a similar effect. In URL rewrite, any URL that is being supplied by the application is decorated with the session ID being used. This enables the Web application to extract the session ID from the incoming URL during runtime. The Role of Cookies and Modern Browsers All popular modern-day browsers (Firefox, Internet Explorer, Opera, Mozilla, and so on) support the use of cookies. Cookies are managed on the browser s host PC, and indexed by the Web site s host name. In addition, all modern-day browsers support multiple concurrent connections to the same server. For example, you can start as many instances of Internet Explorer as you want (subject to machine resource constraints) and have them all connect to the www.wrox.comURL. www.wrox.com/ Each instance you start manages its own client-side session. This is not to be confused with server-side sessions. In essence, when you start multiple instances of a browser pointing to the same server, it appears to the server as if different users are accessing it (each instance manages its own copy of a cookie from the server). In other words, each client-side browser instance will have its own independent, associated server-side session. Note that if a load-balancing mechanism redirects an incoming request to a different host, the cookie supplied will be different (because cookies are indexed by host names) and the session information will not be maintained. Configuring a Tomcat 6 Cluster This section describes the configuration of an actual Tomcat 6 cluster. The cluster consists of three independent Tomcat 6 instances, and makes use of the following: . mod_jk load-balancing frontend . In-memory session replication backend This configuration is similar to the one featured in the AJP Connector load-balancing example presented in Chapter 11 . The main difference is in the use of multiple %CATALINA_BASE%settings ($CATALINA_ BASE on Unix/Linux) for each Tomcat instance, and the cluster naming of the server instances. Ideally, the following configuration experiments should be performed on an actual cluster of physical machines running Tomcat 6 on a network. However, not everyone has access to such extensive hardware. To provide all readers with a hands-on configuration experience, the example utilizes multiple instances of Tomcat 6 running on the same machine. If you do configure multiple machines, make sure that their clocks are synchronized. This can be done by synchronizing the machines clocks with an NTP/Internet time server. Read the manual of your operating system for the specifics.
For high quality java hosting services please check java web hosting website.