Configuring remote policy caches

You configure remote policy cache values in the remote-policies section of the mcs-config.xml file.

You configure remote policy cache values in the remote-policies section of the mcs-config.xml file.

Remote policy cache values are specified differently from local policy cache values.

Control and default settings

Cache attributes can be grouped into control and default sets. The control attribute values define a limit for the default settings, or have the effect of allowing or disallowing each individual property.

When an entry is added to the cache, the properties in the server response are checked against the control attribute values for the cache. Any that lie outside these limits are set to the equivalent control. For example, if an entry is added to the cache and its timeToLive value exceeds the maxTimeToLive control value, the maxTimeToLive value is used.

The attributes on the remote-policy-caches values are global, and specific policy cache attributes. MCS applies the same control tests whether values are taken from the individual policy cache defaults, or those on the remote-policy-caches element. They are all subject to limitation by the corresponding control setting.

For more information on remote policy cache attributes, refer to remote-policy-cache.

Evaluation of cache values

Cache settings are only evaluated when a variant is accessed. There is no separate process running that invalidates cache entries. So an item that expired an hour before it was accessed will only be removed from the cache when that access happens, unless it was removed to make space available for other items because it was the least recently used entry. It is therefore possible for invalid items to be in the cache, although they will never be used.

If you leave the default settings that are shown in the example, and don't change any control values, each policy will be cached for 1 hour. If a request fails, MCS will then retry when the policy is next used, as long as it was at least 10 minutes after the previous failed request. To invalidate the cache, the control value maxTimeToLive must be non-zero.

<remote-policies>
  <remote-policy-cache
    cachePolicies="true"
    defaultTimeToLive="3600"
    defaultRetryFailedRetrieval="true"
    defaultRetryInterval="600"
    defaultRetryMaxCount="5"
    defaultRetainDuringRetry="true"
    maxCacheSize="1000"
    maxTimeToLive="0"
    allowRetryFailedRetrieval="true"
    minRetryInterval="0"
    maxRetryMaxCount="10"
    allowRetainDuringRetry="true"/>
</remote-policies>

Retry configuration

A high proportion of the cache element attributes are there to handle error conditions caused by remote server or network problems. The cache process tries to limit the impact of such failures by eliminating unnecessary remote requests where possible. Where a cached policy has expired, and an attempt to update the value has failed, the retry attributes of the entry are used. If the policy is not cached, an entry is added to the cache with the default retry values for the cache concerned.

If retry is enabled and you have set the allowRetainDuringRetry attribute to 'true', MCS will continue to use the cached policy even if it is invalid according to other cache attributes, such as the time to live period. Retries will occur when a page references the policy, the retry interval has expired and the maximum retry count has not been exceeded. MCS will use these retry values whether or not there is a cache entry for a policy. Once the maximum retry count is reached, the policy is marked as unavailable, and will remain so until it is purged from the cache.

If retry is disabled and a policy is in the cache, MCS marks the policy as unavailable. If this entry is subsequently deleted, MCS will attempt to access the policy on the remote server again, but there is no certainty that this will happen.

Using cache quotas

Quota values help prevent cached entries from any one remote server from dominating the cache.

You specify a quota value for a server using its URL prefix and identify a folder. You specify the quota for a folder as a percentage of the maximum cache size. This allows cache sizes to be modified without the quotas necessarily having to be changed.

MCS uses the percentage value to control the number of entries cached in the folder and all its sub folders. When the addition of an cache entry will cause a quota to be exceeded, MCS removes enough least recently used items to make space for the new entry.

You do not have to specify any quotas. It is not necessary for the quota values to add up to 100%. Neither is it necessary to specify quotas for all folders; you can apply quotas only for entries in some subset of the folders in the cache.

Note:

If the total set of specified quotas is more than 100%, performance may degrade as the cache nears the limit placed on its size.

In the remote-policy-quotas element there can be one remote-policy-quota element for each server, whose attributes define the quota for one URL prefix.

For performance reasons, nested quotas are not allowed. When a folder has been given a quota, an additional quota on any of its sub folders will be ignored.

The example divides the allocation of space in the remote-policy-quotas element equally between polices from two remote server URLs. If the maxCacheSize attribute of the cache is set to 500, MCS will allow up to 250 entries for policies from the folder and its sub folders specified for each server. Other policies are unlimited.

<remote-policies>
  <remote-policy-quotas>
    <remote-policy-quota
      URL="http://myserver.com/remoteComponents/images/jpg
      percentage="50"/>
    <remote-policy-quota
      URL="http://anotherserver.com/newImage
      percentage="50"/>
  </remote-policy-quotas>   
</remote-policies>

Related topics