6 Intelligent Cache Management with WebCenter Sites

Whenever a site is built, it is critical that the rendering engine cache be properly configured so that all of the components work in concert. This chapter describes the rendering engine cache and its components. It also describes the cache configuration properties that enable CacheManager to clear all caches (ContentServer, BlobServer, and Satellite Server caches) of any object which becomes obsolete because of changes in its underlying content.

This chapter contains the following sections:

6.1 WebCenter Sites's Rendering Engine Cache

WebCenter Sites's rendering engine cache is a two-tier cache. Tier 1 consists of ContentServer and BlobServer; Tier 2 consists of Satellite Server. Each component is independently configurable with fine controls that tune cache size, cache timeout, and dependency management behavior.

Whenever a site is built, it is critical that the rendering engine cache be properly configured so that all of the components work in concert. If the components are configured correctly, WebCenter Sites can perform extremely well, effectively preventing users from viewing uncached content nearly all of the time. However, if these components are mis-configured, WebCenter Sites's behavior can be non-intuitive and unpredictable. Inadequate caching can hamper performance, and improper co-ordination of the cache inventory can result in stale content being rendered indefinitely. To address this, WebCenter Sites includes a module called CacheManager, which can actively manage the cache on behalf of the whole system.

6.2 CacheManager

When a site uses CacheManager, it can record the existence of a compositional dependency against an object that is to be cached by the rendering engine. For example, if a pagelet renders an asset, then the asset is a compositional dependency on that page. If the asset changes, the page is no longer valid and must be flushed from cache.

Utilizing CacheManager to flush the cache requires ceding full control over the lifecycle of rendering engine cache objects to CacheManager by specifying that the objects never expire from the cache. When CacheManager determines that they are obsolete because of changes in the underlying content (i.e., in one of the compositional dependencies recorded against each object), it removes those objects from the cache.

Note:

The reason for specifying an infinite expiration time is to ensure that CacheManager keeps a record of all objects that are cached, as well as what dependencies are tracked against them. This record is stored on WebCenter Sites, and it is linked to the existence of the cached object on the first tier. This record enables CacheManager to infer the existence of objects in the second tier cache and therefore flush the objects from the second tier cache.

If, however, an object were to expire from the cache, its record would be removed, leaving CacheManager without the information it requires to properly flush the object from the second tier cache.

Enabling CacheManager's features is almost completely automatic:

  • By default, the cache is configured so that objects never expire.

  • Compositional dependencies are recorded against the Blob and Page cache on the lower tier. Tags such as <asset:load> and <render:sateliteblob> provide automatic compositional dependency recording (see the Oracle Fusion Middleware WebCenter Sites Tag Reference for a complete list), whereas the two tags <portal:logdep>, and <render:logdep> provide explicit compositional dependency recording.

  • Whenever assets are modified or published, WebCenter Sites automatically invokes CacheManager to purge the old content from the cache and, in the case of publishing, instructs CacheManager to pre-cache the new content in the background prior to flushing the second tier cache.

Site visitors enjoy the best possible cache performance by never having to view uncached content. For more information about recording compositional dependencies, consult the Oracle Fusion Middleware WebCenter Sites Tag Reference.

6.3 Enabling CacheManager

This section describes the Tier 1 and Tier 2 cache configuration properties and how they must be set in order to enable CacheManager.

This section contains the following topics:

6.3.1 Tier 1 Cache Configuration Properties

The tables in this section describe properties that regulate the WebCenter Sites page cache and BlobServer blob cache:

More detailed descriptions are given in the Oracle Fusion Middleware WebCenter Sites Property Files Reference.

Table 6-1 WebCenter Sites Page Cache Properties

Property Description

cs.pgCacheTimeout

This property specifies how long a page should reside in the WebCenter Sites page cache, and it affects CacheManager as follows:

By default, this property is set to 0, which means that the pages should reside in this cache forever, and that removal of these pages must be done explicitly. For CacheManager to operate properly, this property must be set to 0. Otherwise, pages will expire, making it impossible for CacheManager to remove the corresponding pages from the Tier 2 cache, and users will view stale data.

Setting this property to a positive integer causes pages to expire after the number of minutes specified by the integer.

cs.IItemList

This property specifies the class implementing the IItemList interface, and it affects CacheManager as follows:

The IItemList interface is used to record compositional dependencies in the page cache. If this property is set to a legal class, then dependency items will be recorded against a page id in the SystemItemCache table, and this is what enables CacheManager.

An illegal value results in CacheManager having no effect.

cc.SystemPageCacheCSz

cc.SystemPageCacheTimeout

cs.alwaysusedisk

cs.freezeCache

cs.nocache

cs.requiresessioncookies

These properties are used to configure page caching, but have no effect on CacheManager. For more information about the properties, see the Oracle Fusion Middleware WebCenter Sites Property Files Reference.


Table 6-2 BlobServer Cache Properties

Property Description

bs.bCacheTimeout

This property specifies how many seconds a blob should remain cached by BlobServer, and it affects CacheManager as follows:

When compositional dependencies are recorded against a blob in the SystemItemCache table, they are configured such that they will be removed from the table after the blob expires from the cache. This prevents excessive growth of the SystemItemCache table. However, removing the entry from the table disables CacheManager from removing the corresponding blobs from the Tier 2 cache, and users will view stale data.

bs.bCacheSize

This property specifies how many blobs will be stored in the BlobServer cache, and has no effect on CacheManager.

Unlike the bs.bCacheTimeout property, when a blob is evicted from the blob memory cache due to the cache being full, the corresponding row is not removed from the SystemItemCache table. Consequently, this property has no effect on CacheManager.

cs.recordBlobInventory

This property specifies whether compositional dependencies should be recorded against blobs.

This property must be set to true (the default) for CacheManager to operate on blobs.

bs.security

This property controls the security feature of BlobServer, and it affects CacheManager as follows:

When BlobServer security is enabled, caching is disabled. Consequently, BlobServer security is incompatible with CacheManager's Intelligent Cache Management features.

By default, this level of security is disabled.

For more information about BlobServer security, see Chapter 5, "Page Design and Caching" and Chapter 7, "Advanced Page Caching Techniques."

cs.manage.expired.blob.inventory

This property controls the removal of blob dependency records from the SystemItemCache table after a blob expires from the blob cache. Its effect on CacheManager depends on the value of bs.bCacheTimeout.

  • If bs.bCacheTimeout is set to 0 or less, this property has no effect.

  • If bs.bCacheTimeout is set to a positive integer, setting this property to true ensures that CacheManager still operates correctly, but at the cost of growth in the SystemItemCache table. The default value is false.


6.3.2 Tier 2 Cache Configuration Properties

Tier 2 cache configuration properties deal with the Satellite Server cache, both page and blob.

None of the Tier 2 properties affect the correct operation of CacheManager. They do, however, serve as important diagnostic aids if CacheManager happens to be operating incorrectly. The timeout and configuration values of the Tier 2 cache properties are important in troubleshooting unpredictable behavior.

Typically, unpredictable behavior results when objects are cached on the Tier  2 cache but not on the Tier  1 cache, and so they are not actively flushed when the dependent asset is saved or published. Consult the Oracle Fusion Middleware WebCenter Sites Property Files Reference for configuration details.

Unpredictable behavior can also result if no compositional dependency is recorded against an object that is cached. This scenario precludes all active management of that object in the caches. Consult the Oracle Fusion Middleware WebCenter Sites Tag Reference for details about which tags automatically record compositional dependencies, and which tags must be used in conjunction with explicit recording using one of the :logdep tags.

Note:

Do not record excessive compositional dependencies on your pages or blobs. Doing so will cause unnecessary flushing of the cache, which under certain circumstances, can result in severe performance problems during publishing. Be especially judicious when recording unknown compositional dependencies. Consult Chapter 28, "Coding Elements for Templates and CSElements" for more information about compositional dependencies.