Distributed hybrid caching relies on four elements:

  • GSACacheClientManager must be configured on each Oracle ATG Web Commerce instance that participates in distributed hybrid caching. It initiates invalidation events for repository items that use distributed hybrid caching, and sends event messages to the GSACacheServerManager for distribution to other Oracle ATG Web Commerce instances.

  • GSACacheServerManager directs cache invalidation events to Oracle ATG Web Commerce instances that contain the affected repository items.

  • ServerLockManager connects each GSACacheClientManager to the GSACacheServerManager. The ServerLockManager and GSACacheServerManager must be configured on the same Oracle ATG Web Commerce instance.

  • An invalidation event of class GSACacheEvent conveys a cache invalidation event for repository items that use distributed hybrid caching.

GSACacheClientManager

A GSACacheClientManager must be configured on each Oracle ATG Web Commerce instance where one or more repository item descriptors have their caching mode set to distributedHybrid. The GSACacheClientManager has the following Nucleus component path:

/atg/dynamo/service/GSACacheClientManager

Each GSACacheClientManager must set the following properties:

lockServerAddress=host[host]
lockServerPort=port-num[port-num]
enabled=true

host and port-num specify the ServerLockManager ‘s address and port. If two ServerLockManagers are specified for failover purposes, lockServerAddress and lockServerPort must list their respective addresses and ports in the same order.

For example, given two ServerLockManagers on hosts tartini.acme-widgets.com and corelli.acme-widgets.com, where both use port 9010, you can configure a GSACacheClientManager component as follows:

lockServerAddress=tartini.acme-widgets.com,corelli.acme-widgets.com
lockServerPort=9010,9010
enabled=true

Each ServerLockManager must run in the same Oracle ATG Web Commerce instance as a GSACacheServerManager, and must be configured to support distributed hybrid caching. During repository startup, the GSACacheClientManager connects to the ServerLockManager, which hands over the connection to the GSACacheSeverManager; this connection becomes the communication channel between the GSACacheClientManager and GSACacheServerManager for cache invalidation events.

For debugging purposes, you can also set the loggingDebug property to true.

GSACacheServerManager

A GSACacheServerManager maintains routing information for all cached repository items that use distributed hybrid caching. When a cache invalidation event occurs on a repository, that repository’s GSACacheClientManager sends the event to its GSACacheServerManager; the GSACacheServerManager relays this event to the appropriate clients.

The GSACacheServerManager has the following Nucleus component path:

/atg/dynamo/service/GSACacheServerManager

To enable a GSACacheServerManager, set its enabled property to true. You can also configure its defaultItemCacheSize property, which sets the maximum number of items that are mapped for each item descriptor. This property is initially set to 1000. For more information on setting this property, see Optimizing Performance later in this chapter.

Each GSACacheServerManager is associated with a ServerLockManager that runs in the same Oracle ATG Web Commerce instance, via the connection information specified by GSACacheClientManagers. You can provide a backup GSACacheServerManager by configuring those GSACacheClientManagers to connect to the same secondary ServerLockManager. Precedence of GSACacheServerManagers is set by their respective ServerLockManagers (see ServerLockManager Failover).

For debugging purposes, you can also set the loggingDebug property to true.

ServerLockManager

In order to enable distributed hybrid caching, a ServerLockManager must be configured on the same instance as the GSACacheServerManager with the following setting:

handleDistributedHybridCacheEvent=true

When thus enabled, the ServerLockManager hands over the connection from a GSACacheClientManager to the GSACacheSeverManager; this connection becomes the communication channel between them for all subsequent cache invalidation events.

GSACacheEvent

GSACacheClientManagers and GSACacheServerManager communicate with each other by passing GSACacheEvent objects, which encapsulate invalidation events with the following information:

The following table describes the four types of GSACacheEvents:

GSACacheEvent type

Description

INVALIDATE_CACHE_ENTRY

Sent when a repository item or item descriptor is invalidated. The GSACacheServerManager determines which clients cache the item; it then relays the event to their respective GSACacheClientManagers for delivery to the target repositories.

If the GSACacheEvent provides a repository item ID, only the specified repository item is invalidated. If the GSACacheEvent omits a repository item ID, the entire item descriptor is invalidated, and the corresponding item caches are flushed.

LOAD_INTO_CACHE

Sent when a repository item is cached.

REMOVE_CACHE_ENTRY

Sent when a repository item is deleted. On receiving this GSACacheEvent, the GSACacheServerManager determines which clients cache the item; it then relays the event to their respective GSACacheClientManagers for delivery to the target repositories.

REMOVE_FROM_CACHE

Confirms that a repository item is removed from the cache. On receiving this event, the GSACacheServerManager removes the item from the list of items that it manages for that GSACacheClientManager.

All events except LOAD_INTO_CACHE are sent asynchronously. LOAD_INTO_CACHE is sent synchronously in order to ensure a consistent view of item data across all repositories and handle rare race conditions. The GSACacheClientManager property synchronousMessageTimeout determines the maximum amount of time each GSACacheClientManager waits for the GSACacheServerManager to reply before caching an item. This property ensures threads wait only a finite period of time for a reply from the GSACacheServerManager. The default setting is 500 milliseconds.

The following graphic shows how removal of repository item on Oracle ATG Web Commerce server Alamo triggers an invalidation event for all repository caches that also contain that item—in this case, on Oracle ATG Web Commerce server Houston.