Tomcat 5 clusters in the reproduction of a SESSION (AP)
Tomcat 5 server clustering and replication SESSION provides integrated support. The first in this series of articles will provide you with SESSION persistent and TOMCAT cluster SESSION copy of a summary of internal working mechanisms awareness. I will discuss SESSION TOMCAT5 copy of what is in the cluster, as well as across multiple nodes SESSION persistent replication mechanism. In Part 2, I will discuss in detail with a copy function TOMCAT SESSION cluster installation example, and compare different replication situation.
Cluster Server traditional independent (non-cluster) does not provide any failure seamless transfer and load balancing capability. When a server failure, will not be able to access the entire site, unless the server is renewed. The server failure, any stored in the server's memory SESSION will be lost, the user must re-enter all the landing and server failure due to the loss of data.
The difference is that, as part of the Cluster Server provides failure can be measured and seamless transfer of capacity. A cluster is a group of synchronous operation and work together to provide high reliability, high stability and high predictability of the multi-server routines. On the server cluster seems to be demonstrated by the client is a single server routines. From the client's perspective, the client group and a separate server not much different, but their effectiveness by providing a seamless transfer and replication SESSION done SESSION uninterrupted services, as well as data persistence.
Cluster servers in the cluster communication server applications such as IP multicast (IP multicast) IP sockets and the other server technology and the sharing of information â— IP multicast: mainly used for more than one pair of communications servers through broadcasting services and heartbeats news server can be used to show that the effective â— IP sockets: mainly used in the cluster server routines in a P2P server communications using a one-to-many using IP multicast communications server TOMCAT use IP Multicast transmission in the cluster server routines between one-to-many communication, IP multicast is a multi-server allows the designated IP address and port, and a subscription to monitor news broadcasting technology (multicast IP address range from 224.0.0.0 to 239.255.255.255). In each server in the cluster using multicast broadcasting heartbeat specific information by monitoring these heartbeat, in the cluster server routines decide when routines server failure. Server communications using IP multicast of a drawback is that he can not guarantee that such information is being received by the. For example, a continuous application of the local multicast cache full, it can not be written into the new multicast information, such as the information after the application procedures have not been notified to.
The use of IP Sockets for server communications IP sockets also adopted a set of servers in the cluster between news and data sent mechanism. Server IP sockets in the routine use of cluster nodes between HTTP SESSION state replication. SOKET correct preparation for the performance of clusters is essential, based on the efficiency of communication SOCKET SOCKET depends on the realization of categories (for example: the use of the local system or net realized JAVA SOCKET reader), if the use of server-JAVA SOCKET Reader depends on whether the registration server routine use sufficient SOCKET reader thread.
If you want to have the best SOCKET performance, the system should be registered to use local rather than pure SOCEKT JAVA Implementation. This is because of the realization SOCKET based on JAVA, local SOCKET consume fewer system resources. Although the reader SOCKET JAVA Implementation of P2P communication is a reliable way and can be mobile, but he was not in the cluster of heavy use SOCKET provide the best performance. When judging whether data from SOCKET read when local SOCKET readers use more efficient methods. SOCKET use of local readers realize, readers do not need to thread statistical static SOCKET: They only for the activities of the SOCKET services, and to set a start SOCKET active, they can immediately capture. And the use of pure JAVA SOCKET readers, threads must be dynamic statistics all open SOCKET, see whether they contain can be read data. In other words, the reader is always busy SOCKET SOCKET statistics, even if these SOCKET no data readable. These systems should not reduce performance overhead.
TOMCAT 5 clusters TOMCAT5 While the earlier version also has the function of clusters, but in a later version (5. .19 Or higher), the cluster becomes more components of the module. Server.xml elements in the cluster have been reconstructed so that we can replace some of the different clusters and will not affect other elements. For example, the current configuration of the service members set to multicast found. Here can easily be modified to serve the replacement for the use of TCP or Unicast, and will not change the collection of other parts of the logic.
Cluster some other elements, such as SESSION management, copy the sending end, copying the receiving end can also be replaced by the realization of the definition of cluster configuration without affecting other parts. Similarly, in TOMCAT Cluster Server component of any set of API can be used to cluster in the information sent to all the members.
SESSION replication server clusters usually manipulated two SESSION: sticky sessions and replicated sessions. Sticky sessions is that there is a single server in the network accepted the request SESSION, other members of the Cluster Server SESSION state entirely unclear if there SESSION server fails, users must once again landing site, to re-enter all stored in SESSION in the data.
Another SESSION type, in a state SESSION server to be copied in all other cluster server, whenever they SESSION was changed, the data must be re-SESSION being copied. This is replicated session. Sticky and replicated sessions have their advantages and disadvantages, Sticky sessions simple and easy to operate, because we do not have any SESSION copy data to other servers. This system will reduce consumption and increase performance. However, if the server fails, all stored in the server's memory SESSION data will also disappear. SESSION If data has not been copied to other servers, these SESSION completely lost. When we were conducting a search affairs when the loss of all data entry, will lead to a lot of problems.
To support JSP HTTP session of the state will expire automatically seamless transfer, TOMCAT server replication in memory of the state SESSION. This is achieved through replication stored in a server on the cluster SESSION data to prevent other members of data loss and failure to allow a seamless transfer.
Object state management on the server through the preservation of state can be divided into four kinds of objects:
â— No state: a non-call in the state of the object in memory when not in the preservation of any state, because the client and server do not need to store any of the other information. In such circumstances, each client will request the server will send data to the server. SESSION state was in the client and server side sent back and forth. This method is not always feasible and desirable, especially when transmission of data security or some more information we do not want to save the time in the client;
â— conversation: a session object in a SESSION only be used for a particular client. In SESSION, for all he can from the client requests services, and this is only the client's request. Through a SESSION, two requests the state information must be preserved. Conversational services are normally stored in the memory of the short-term state, when the failure of the server may be lost. SESSION state requests are usually kept in the server memory. In order to empty the memory SESSION state can also be released from memory (as in an object CACHE). In the object, performance and scalability are yet to be improved because the update was not a separate written on the disk, and the failure of the server when data there is no way the rescue.
â— Cache: Cache object in memory preservation status, and use this to deal with the multi-client to the request. Cache services can be extended to the realization of their cache is stored in the back-end data backup memory (usually a relational database).
â— independent: an independent object in a time only active in a cluster of servers, from the processing of multi-client requests. He usually by those private, long-lasting, in memory of the data to support relief inch. He also has short-term memory to maintain the state, the server failure or loss of time to rebuild. When failure, must be independent object in the same server or resumption of transplantation to another server.
(Source: "Using WebLogic Server Clusters")
SESSION copy of the design considerations of the network considerations Cluster multicast address and other applications isolation is essential. We do not want cluster configurations or interfere with the distribution network to multicast communications server. And other applications sharing cluster multicast address will force Cluster Server routines should not be dealt with the news consumption of system memory. Sharing multicast addresses may also make IP multicast buffer overload, delayed messaging server heartbeat. This delay may result in a server routines be marked for death simply because of his heartbeat was not timely receive information.
Programming considerations in addition to the above-mentioned factors related to the network, and we wrote some J2EE Web application design considerations relating to the procedure will affect SESSION reproduction. Here is a list of some of the programming aspects to consider:
â— SESSION sequence of data must be: In order to support HTTP session state replication of memory, all the servlet and JSP session of the sequence data must be, the targets for each domain must be sequences, such objects are reliable serialization.
â— to applications such as the design of power: the power, and so is the meaning of a parade do not revise the state information, and the time of each operation to return to the same result (in other words: do so many times and the effect of a is the same), usually, WEB request, in particular HTML forms have been sent many times (when the user clicks the Send button twice Heavy pages many times), resulting in multiple HTTP requests. WEB design SERVLET and other targets, such as power, I can tolerate repeated requests. Detailed reference design model to be "Synchronized Token" and "Idempotent Receiver" on how to design such as power applications.
â— BUSINESS-tier storage in the state: the state should use a conversational state SESSION BEANS stored in the EJB layer, and not stored in the HttpSession WEB layer. Because enterprise applications to support various client (WEB client, JAVA applications, other EJB), the data storage layer in the WEB client will result in double-data storage. Therefore, it is the state SESSION BEAN in these circumstances to be used for storage SESSION state. No state SESSION BEAN call for the re-structure of each session state. These states may have to resume from the database-data compiler. These shortcomings lost the use of non-state SESSION BEAN to enhance performance and scalability of the purpose of reducing serious performance.
â— Sequencing System consumption: in the sequence of data replication SESSION SESSION time to the state system will be more consumption. With the sequence of the target size of the growth of consumption has more. SE is to maintain the best
Tags: java session, TOMCAT, tomcat web.xml






