Deploying and Managing Apama Applications > Managing the Dashboard Data Server and Display Server > Configuring Trend-Data Caching
Configuring Trend-Data Caching
By default, dashboard servers (Data Servers and Display Servers) collect trend data for all numeric output variables of scenarios and data views running in their associated correlators. This data is cached in preparation for the possibility that it will be displayed as historical data in a trend chart when a dashboard starts up. Without the cache, trend charts would initially be empty, with new data points displaying as time elapses.
Advanced users can override the default caching behavior on a given server, and control caching in order to reduce memory consumption on that server, or in order to cache variables that are not cached by default, such as non-numeric variables.
Important! In many cases, Server performance can be improved by overriding the default caching behavior, and suppressing the caching of those output variables for which trend-chart historical data is not required.
Important! Caching trend data for string variables is very costly in terms of memory consumption.
You control caching with a trend configuration file, which allows you to specify the following:
*Individual variables to cache
*Classes of variables to cache
*Default caching rules
*Trend depths (number of data points to maintain) for each scenario and data view
You do not need to provide a trend configuration file. If you provide no trend configuration file, dashboard servers use the default caching behavior described above.
Trend charts can include variables whose trend data is not cached, but they will display no historical (pre-dashboard-startup) data for those variables.
When a Data Server or Display Server starts, it uses the trend configuration file specified with the -G option, if supplied. Otherwise it uses the file trend.xml in the dashboards directory of your Apama work directory, if there is one. (Note, Apama provides an example trend configuration file, APAMA_HOME\etc\dashboard_onDemandTrend.xml, that you can copy to APAMA_WORK\dashboards\trend.xml as a basis for a trend configuration file.) Otherwise, it uses the default caching behavior described above.
Here is a sample configuration file:
<?xml version="1.0" encoding="UTF-8"?>
<config>
  <trend>
    <item type="SCENARIO" correlator="*" name="*"
      vars="ALL_NUMERIC_OUTPUT" depth="10000"/>
    <item type="SCENARIO" correlator="*" name="Scenario_scenario1"
      vars="LIST" depth="5000">
        <var name="A"/>
        <var name="B"/>
    </item>

    <item type="DATAVIEW" correlator="production" name="DV_dataview1"
      vars="LIST" depth="5000">
        <var name="A"/>
        <var name="B"/>
    </item>
  </trend>
</config>
This file specifies the following:
*For Scenario_scenario1 in all correlators, cache trend data for variables A and B with a maximum trend depth of 5000.
*For all other scenarios, cache all numeric output variables with a maximum trend depth of 10,000.
*For DV_dataview1 in correlator production, cache variables A and B with a maximum trend depth of 5000.
*For all other data views, cache no trend data.
In general, a trend configuration file is an XML file that includes of one or more item elements with the following attributes:
*type:SCENARIO or DATAVIEW
*correlator: Logical name of correlator. Use * for if the item applies to all correlators
*name: Scenario or data view ID. Use * if the item applies to all scenarios or data views.
*vars: Class of variables to cache trend data for. Specify one of the following:
*LIST: Cache the individual variables that are listed in var sub-elements.
*ALL: Cache all input and output variables.
*ALL_OUTPUT: Cache all output variables.
*ALL_NUMERIC_OUTPUT: Cache all numeric output variables.
*depth: Maximum depth of trend data to cache.
If the vars attribute of an item element is LIST, the element has zero or more var sub-elements. Each var element has single attribute, name, which specifies the name of a scenario variable or data view field.
The item elements are nested in a trend element, which is nested within a config element.
If a particular data view or scenario on a given correlator matches multiple item elements in a server’s trend configuration file, the server chooses the best-matchingitem and caches the variables specified in that item. Following are the ways, in order from best to worst, in which an item can match a data view or scenario on a given correlator:
1. Fully resolved: Exact match for both correlator name and scenario or data-view name
2. Wildcard correlator: Wildcard correlator and exact match for scenario or data-view name
3. Wildcard scenario: Exact match for correlator name and wildcard scenario or data-view
4. Fully wildcarded: Wildcard correlator and wildcard scenario or data view
If there are multiple best matches, the last match is used.
Consider, for example, scenarios named Scenario_scenario1 and Scenario_scenario2, correlators named production and development, and the following item elements:

1 <item type="SCENARIO" correlator="production" name="Scenario_scenario1"
    vars="LIST" depth="5000">
2 <item type="SCENARIO" correlator="*" name="Scenario_scenario1" vars="LIST"
    depth="5000">
3 <item type="SCENARIO" correlator="production" name="*" vars="LIST"
    depth="5000">
4 <item type="SCENARIO" correlator="*" name="*" vars="LIST"
    depth="5000">
Scenario_scenario1 running on production best matches item1.
Scenario_scenario1 on development best matches item2.
Scenario_scenario2 on production best matches item3.
Scenario_scenario2 on development best matches item4.
Below are some additional sample configuration files. The following file caches trend data for all input and output variables:
<?xml version="1.0" encoding="UTF-8"?>
<config>
  <trend>
    <item type="SCENARIO" correlator="*" name="*" vars="ALL"
      depth="10000"/>
    <item type="DATAVIEW" correlator="*" name="*" vars="ALL"
      depth="10000"/>
  </trend>
</config>
The following caches trend data for all numeric output variables, the default behavior:
<?xml version="1.0" encoding="UTF-8"?>
<config>
  <trend>
    <item type="SCENARIO" correlator="*" name="*"
      vars="ALL_NUMERIC_OUTPUT" depth="10000"/>
    <item type="DATAVIEW" correlator="*" name="*"
      vars="ALL_NUMERIC_OUTPUT" depth="10000"/>
  </trend>
</config>
The following caches no data, which results in trend-data collection only on demand:
<?xml version="1.0" encoding="UTF-8"?>
<config>
  <trend>
  </trend>
</config>
The following caches a single variable for a single scenario:
<?xml version="1.0" encoding="UTF-8"?>
<config>
  <trend>
    <item type="SCENARIO" correlator="*" name="Scenario_scenario1"
      vars="LIST" depth="5000">
        <var name="PRICE"/>
    </item>
  </trend>
</config>
Copyright © 2013 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors.