Cache synchronization and error recovery in a clustered environment

Source: Internet
Author: User
Tags node server
Concept: Clusteris a group of independent computers interconnected by high-speed networks, which form a group and are managed in a single system mode. When a customer interacts with a cluster, the cluster is like a separate server. Cluster configuration is used to improve availability and scalability. Cluster Technologyis a kind of universal technology, its aim is to solve the problem of stand-alone operation ability, the lack of IO ability, improve the reliability of service, obtain scale scalable ability, reduce the operation and maintenance cost of the whole scheme (running, upgrading, maintaining cost). Cluster must be able to coordinate the management of errors and failures of separate components and transparently add components to the cluster. A cluster contains multiple servers (at least two) with shared data storage space. When any server runs an application, the application data is stored in the shared data space. The operating system and application files for each server are stored in their respective local storage space. In cluster, each node server communicates with each other through an internal LAN. When a node server fails, the application running on this server is automatically taken over on the other node server. When an application service fails, the application service is restarted or taken over by another server. When any of these failures occur, the customer will be able to quickly connect to the new application service. CachingIs between an application and a physical data source, which is designed to reduce the frequency of application access to physical data sources, thereby improving the operational performance of the application. The data in the cache is a copy of the data in the physical data source, the application reads and writes data from the cache at run time, and the data for the cache and the physical data source is synchronized at a particular time or event. question:When an application is deployed in parallel on different nodes in a clustered environment, each server node is cached separately. This makes it easy to make the cached content of different nodes appear inconsistent on the version. Modifying the data on one machine only affects local memory, but does not notify other servers, causing the other nodes ' cached data to actually be invalidated.        This makes it necessary to maintain cache synchronization in a clustered environment. When the server that originally created the session for the user crashes, error recovery allows users to seamlessly obtain session information from another server. implementation: with the database / File System ImplementationWhen an application update is applied on one server in a cluster, the updated part is written to the database, and the cache manager sets the cache on all machines to be invalid, forcing them to retrieve the new again next time. Only one drawback is that it takes time to get the data out of the database or shared file system and into memory. The main disadvantage of implementing session persistence with a database/file system is that there is limited scalability when large or many objects are stored in session. Each time a user adds an object to the HttpSession, all objects in the session are serialized and written to the database or shared file system. Most application servers that implement session persistence with a database advocate minimizing the use of Session memory object, but this limits the structure and design of Web application, especially when using HttpSession to store user data. memory-based implementation        write the information in memory to a backup server. There are two ways of doing this: the first is to write information to a centralized state server in which all the machines in the cluster write data to the server; the second is that each node in the cluster randomly selects a node as backup server and writes the data stored in memory separately to the backup Server In both of these methods, if the number of machines in the cluster is small, it is better to use a dedicated state server than any specified backup server, which saves the CPU to handle transaction and Dynamic Web page generation. On the other hand, when the number of machines in a cluster is large, the dedicated state server becomes a bottleneck, while the consumption of replicated memory to any given backup server increases linearly as the number of machines grows. When adding a machine with a dedicated state server, you need to add more RAM and CPU to it. With any specified backup server you only add machines, and information is distributed evenly between all machines. Memory-based persistence provides a flexible Web application design scale and high reliability.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.