Microsoft enterprise database 4.1 Study Notes (16) cache Module 4 server farm Cache Usage

Source: Internet
Author: User

Cache Usage in the server farm

A single cachemanager cannot be shared across application domains. Most server applications are deployed on multiple servers, and each server has a copy of cached data in its memory. The same applies to multiple processes on a machine, including the cached data for each enterprise component running in its own process.

Different applications cannot use the same database as the backend storage. Using the same database as the backend storage of different applications may cause unexpected problems. We do not recommend that you do this.

When running the same application in multiple processes (for example, the application is deployed in the server farm environment), you can select the following configuration.

1) All application instances use the same database instance, but each instance of the application uses different database partitions.

2) All application instances use the same database instance and Data Partition, and all cachemanager can read and write the cache.

3) All application instances use the same database instance and Data Partition, but only one cachemanager write cache can be used, and all cachemanager can read the cache.

1) Partition Cache

All application instances use the same database instance, but each application instance uses different database partitions. Each cachemanager operation is independent. Although they share the same backend storage, the cached data managed by each cachemanager remains in different data partitions. When the application is restarted, each cachemanager obtains data from its own partition.

If the application pre-loads the cache, each application instance obtains data from the original database. The data pre-loaded by each deployed application instance comes from the backend storage. This means that using the cache to deploy the same application in multiple processes is no more efficient than deploying different applications in multiple processes.

Deploy the same application on multiple servers. The configurations on each server are the same. For example, all configurations are the same expiration policy. However, the data in each partition cannot be the same. Data stored in the back-end data partition is a copy of the memory cache. The cache content in the memory depends on how the application instance uses the cache. Because different servers route application requests, the memory cache on each server may be different. Therefore, the data in the later partition may be different. This means that even if all applications are disabled and restarted at the same time, the data read from the backend to the cache is consistent after the cache is initialized.

2) shared partitions

All applications use the same database instance and Data Partition, and all cachemanager can read and write the cache. Each application instance operates on a unique memory cache. When an application creates a cachemanager, The cachemanager fills the data read from the later storage into the memory cache. This means that if an application creates a cachemanager when it is started, if all application instances are started at the same time, each memory cache will load the same data. Because the application uses the same partition, no additional backend storage is required for each application instance.

Data is loaded from the backend storage to the memory cache only when the cachemanager is created. After this, the content in the memory cache changes according to the Cache Usage of the application. Each application instance uses different caching methods because requests are routed to different servers. Different instances of running applications have different content in the memory cache.

 

As applications increase and delete data, the cached data in the memory changes. When you use cachemanager to remove cache items, or when an expiration cleaning occurs, the cached data in the memory also changes. When the cache data in the memory changes, cachemanager updates the corresponding content of the backend storage. The backend storage does not notify the cachemanager instance when the backend content changes. Therefore, when an application instance changes the content stored in the backend storage, the memory cache of other application instances is inconsistent with the content stored in the backend storage. This means that after the application is restarted, the data returned to the memory cache is inconsistent with the data cached in the memory before the restart.

Cachemanager provides an event to notify the application after the cache item expires. The application can use this notification to update cached data from the original data source. When the application updates the cached data, cachemanager also updates the corresponding back-end storage content. If an application is deployed on multiple servers, each application instance receives an event notification and requests the same data from the original data source to form multiple requests for the same data. Such a request will negatively affect the performance of the corresponding and original data sources. Therefore, it is not recommended to notify applications to update data by monitoring the expiration of cached data.

3) Write-only

All application instances use the same database instance and Data Partition, but only one cachemanager can write data to the cache. All cachemanager can obtain data from the cache. That is, only one application instance can perform write operations on the cache, while other application instances can only perform read operations. The application instance that performs write operations on the cache is the master. The cached data in the master memory is always unique for the backend storage. After creating a cachemanager, the cached data in the memory of each application instance is obtained from the backend storage. Application Instances can only read one data snapshot from the cache. Because they are unable to update the cache, the cached data in the memory of these application instances will become old and less as the data items expire.

Not complete ............................

Http://www.cnblogs.com/virusswb/archive/2010/04/23/1719002.html

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: info-contact@alibabacloud.com 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.