The performance of the catalog can be improved by preloading the catalog repository when ATG starts up. The cache is loaded by performing queries, just as during normal operation. Cache preloading differs from normal operation because it normally involves querying for all items of a certain type and then doing nothing with the results. This bulk query is easily achieved by addingquery-items tags to the repository definition XML file.

In Pioneer Cycling, we added these tags to a separate file:

PioneerCycling/config/atg/commerce/catalog/preloadCatalogCache.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<!DOCTYPE gsa-template
        PUBLIC "-//Art Technology Group, Inc.//DTD General SQL Adapter//EN"
        "http://www.atg.com/dtds/gsa/gsa_1.0.dtd">

<gsa-template>

  <header>
    <name>Pioneer Cycling Default Catalog Cache Pre-loader</name>
    <author>The Pioneers</author>
    <version>$Id: $</version>
  </header>

  <query-items item-descriptor="category">ALL</query-items>
  <query-items item-descriptor="product">ALL</query-items>
  <query-items item-descriptor="sku">ALL</query-items>
  <query-items item-descriptor="media">ALL</query-items>
  <query-items item-descriptor="manufacturer">ALL</query-items>
  <query-items item-descriptor="sku-link">ALL</query-items>
  <query-items item-descriptor="folder">ALL</query-items>
</gsa-template>

This file can be invoked from the product catalog definition file at /PioneerCycling/config/atg/commerce/ProductCatalog.properties with the following property setting that adds preloadCatalogCache.xml to the end of the list of definitonFiles.

definitionFiles+=\
        /atg/commerce/catalog/preloadCatalogCache.xml

In Pioneer Cycling, we commented this setting out to improve the speed of startup. In a live site, it is often desirable to trade off slower startup for better performance but in development and demonstration situations, fast startup is generally preferable.

It should also be noted that in Pioneer Cycling, the cache preloading is provided for the default English language catalog only. In an actual online store, you would provide query-items tags for all of the repositories and item-types for which the performance boost is needed. In this implementation we did not provide query-items tags for the French or Japanese catalogs.

Please see the section on SQL Repository Caching in the SQL Repository Architecture chapter of the ATG Repository Guide for more information about reloading a repository cache.

 
loading table of contents...