InfoCenter Home >
6: Administer applications >
6.6: Tools and resources quick reference >
6.6.0: About user assistance >
6.6.0.16: Dynamic fragment cache configuration >
6.6.0.16.1: Global administration

6.6.0.16.1: Global administration

You can enable and configure dynamic fragment caching through a XML configuration file or through the administrative console.

XML configuration file

The dynacache.xml file enables and configures dynamic fragment (also known as servlet) caching. If this file is not found in the product_installation\properties directory, the Web container processes servlets in the usual manner. However, if this file is found in the product_installation\properties directory, then dynamic fragment caching is enabled.

Within this file, users configure the overall operation of the cache, such as its size, and register the external caches that are used by the application.

Note:  The dynacache.xml file is read only once, at WebSphere Application Server startup. So if changes are made to the file, WebSphere Application Server must be restarted for the changes to take effect.

The DTD for the dynacache.xml file is specified in the dynacache.dtd file, which ships with WebSphere Application Server and is located in the product_installation\properties directory. The dyncache.dtd file defines the root element, <cacheUnit>, and should be included in the dynacache.xml file through the DOCTYPE declaration.

The beginning of the dynacache.xml should have the following processing instructions:

<?xml version="1.0"?>
<!DOCTYPE cacheUnit SYSTEM "dynacache.dtd">

Console configuration

You can also enable dynamic fragment caching through the administrative console. Cache properties are located under a server's Web Container:

Enabling dynamic caching through the administrative console

Description of elements in the dynacache.xml file

The elements defined in the dynacache.xml file provide the following two categories of function:
  • Configuring global cache operations
  • Controlling external caches

Configuring global cache operations

The root <cacheUnit> element contains one <cache> element, which provides global settings for all Application Servers on a node.

Cache
<cache size="entries" priority="default_priority"/>
    entries:   An integer defining the maximum number of entries the cache will hold. Values are usually in the thousands, with no set maximum or minumum

    The size of the cache is limited not by the amount of available memory (for example, 20 megabytes), but by the number of distinct elements the available memory can hold. The cache only adds a few bytes of overhead for each entry (less than 32 bytes), so the size of an entry in memory is effectively equal to the amount of data being stored in that entry.

    default_priority:  An integer that defines the default priority for cacheable servlets defined in servletcache.xml. The recommended value for default_priority: is one.

    Priority is an extension of the Least Recently Used (LRU) caching algorithm. It represents the number of cycles through the LRU algorithm an entry is guaranteed to stay in the cache. See article Dynamic fragment cache policy configuration for more information on priority settings.

    So, a cache storing at most 10,000 entries, giving all entries a default priority of one, would be declared as:

    <cache size="10000" priority="1" />

Controlling external caches

WebSphere Application Server can control external caches. You can define different groups of external caches, each with its own set of member caches. The interface between WebSphere Application Server and one of the member caches is an adapter bean, typically written by the vendor of the external cache. An administrator registers external cache groups within an <externalCacheGroups> element, which can then be used in cache policies. Each group is defined within a <group> element, which can contain <member> elements. See the External cache adapter building article for information on configuring WebSphere Application Server to control IBM Edge Server or IBM HTTP Server.

Group
<group id="group_name" >
...
</group>
    group_name:    A string identifier for this group of external caches.

    This name is used to specify the external group. For a servlet to be externally cacheable, it must be configured in the servletcache.xml file that is included in a group.

Member
<member address="address" adapterBeanName="adapter_class" />
    address:    The hostname or IP address for this external cache.

    This string will be passed to the adapter bean's setAddress method.

    adapter_class:    The package and class name of the adapter for this external cache.

Example of the dynacache.xml file

An entire dynacache.xml file based on the element definitions previously described might look like the following example:

<?xml version="1.0"?>

<!DOCTYPE cacheUnit SYSTEM "dynacache.dtd">

<cacheUnit>

<cache size="10000" priority="1" />

<externalCacheGroups>

<group id="edgeservers" type="shared">

<member address="edgeone" adapterBeanName="my.package.EdgeAdapter" />

<member address="edgetwo" adapterBeanName="other.package.OtherAdapter" />

</group>

</externalCacheGroups>

</cacheUnit>

Quick Reference of the dynacache.xml file

  1. <?xml version="1.0"?>
  2. <!DOCTYPE cacheUnit SYSTEM "dynacache.dtd">
  3. <cacheUnit>
  4. <cache size="number of elements" priority="default priority" />
  5. <externalCacheGroups>
  6. <group id="group name">
  7. <member address="server name" adapterBeanName="some.package.Adapter"/>
  8. </group>
  9. </externalCacheGroups>
  10. </cacheUnit>

Go to previous article: Dynamic fragment cache configuration Go to next article: Policy configuration

 

 
Go to previous article: Dynamic fragment cache configuration Go to next article: Policy configuration