HTTP Session Failure transfer
Almost all of the popular Java EE vendors have implemented Http session failover in their cluster products to ensure that when a server fails, conversation state is not lost and client requests are handled correctly. As shown in Figure 6, when the browser accesses a stateful WEB application (1th, 2 steps), the application may create a session object in memory to hold the information for subsequent requests, and, at the same time, send the browser a unique HTTP session ID to identify the conversation object (step 3rd) The browser saves the ID in the cookie and sends the cookie back to the server the next time it requests a page for the same WEB application. In order to support session failover, the WEB server will back up the session object to other places at certain times to prevent loss of session information (step 4th) after the server fails. The load Balancer detects this failure (5th, 6 steps) and distributes subsequent requests to the server instance that contains the same application (step 7th), because the session object has been backed up elsewhere, and the new server instance can resume the session (step 8th) to properly process the request.
Figure 6 HTTP Session Failure transfer
To achieve these functions, HTTP session failover will bring the following issues:
L Global HTTP Session ID
As mentioned above, the HTTP session ID is used to identify a unique memory sessions object in a particular server instance, and on the Java Platform, the HTTP session ID relies on JVM instances, each with several applications, each with many sessions for different users, The HTTP session ID is the key to using the current JVM instance to access related sessions. In the implementation of session failover, it is required that different JVM instances not produce two identical HTTP session IDs, because when a failover occurs, a JVM's sessions are to be backed up and restored to another, so the global HTTP meeting ID generation mechanism must be established.
L How to back up session state
How to back up session state is a key factor in distinguishing the Java server from the bad. Different vendors have different implementations, and I'll explain them in detail in the following sections.
• Frequency and granularity of backups
Session backups are performance-consuming, including CPU, memory, network bandwidth, and I/O to disk and database, and the frequency of backups and granularity of backup objects severely affect performance.
Original article @java Advanced network Reproduced please indicate the source: http://www.javady.com/index.php/411.html