Managing the Repository Cache Using JMX

The repository cache exposed through JMX allows you to check the cache status, clear all or remove specific cached resources, modify the cache configuration, and monitor the resource in the cache.

Since the repository cache is exposed through JMX, you can use any tool that is used to manage or monitor JMX. Included with Spectrum are two tools: JMX Console and JConsole.

Note: The listCacheResourceNames operation is not supported using the Spectrum JMX Console. To view a list from the cache, use JConsole.

Accessing the repository cache using the Spectrum JMX Console:

  1. Open the JMX Console using the following URL: http://<server>:<port>/jmx-console/
  2. Under the Domain: Spatial section, select the Spatial:name=Cache,type=Remote Component
  3. You can change the settings for the managed cache as described below.

Accessing the repository cache using the JConsole:

  1. If you have not already done so, add the following parameters to the line in the wrapper.conf, located under <Spectruminstall>\server\bin\wrapper: 
  2. Restart the server.
  3. Go to <spectrum>/java64/bin/ and run jconsole.exe
  4. Click on the MBeans tab.
  5. Select Spatial>Remote Component>Cache
  6. Click Attributes to monitor the cache settings and statistics.
  7. Click Operations to change the settings for the managed cache as described below.

Capacity - This is the number of resources cached by the remote component at any given time. If the capacity is modified, the current resource cache will be cleared, and a new one created. As the capacity is reached, older resources in the cache are removed to make room for newer resources. It is important to remember, if a resource is cached that uses other resources (e.g., a named map uses multiple named tables), both that resource and all resources used are also cached.

Expire - This is the expiry time in milliseconds. If the cache policy is set to 2 (check with expire), this value is used as the interval to check for updating the resource when trying to be accessed.

Update Check Policy - This is the way resources in the cache will be checked to see if they need to be updated with the latest version in the repository. The policy values are 0, 1, or 2. Where 0=Never, 1=Always, and 2=Check with Expire. Never checking the resource cache means that no checking for resource updating is done. Cached resources can be removed through JMX manually if they are changed in the repository and you need to modify the cache. Always checking the resource cache means that every time a resource is required from the cache, it will check if the cached resource is the same as in the repository. If the resource has changed, a new one will be loaded into the cache. Checking with expiry will only check resources in the cache for updating if the expire time since the last check has been exceeded. The expire time is the value defined in the expire property. This value is in milliseconds.

Remove Resources - This is used to remove specified resources from the cache. Enter the directory structure from the repository you would like to remove from the cache starting at the root. Usually used when you have the policy set to Never and you are updating resources in the repository, this allows you to clear the older resource definitions from the cache, so the next time the resource is accessed, it will be updated in the cache using the new definition. The wildcard character * can be used at the end of a path to remove all resources within a directory or subdirectories. For example, if you would like to remove all resources within the samples directory, enter /samples/*.

Clear Cache - This is used to clear the entire cache. This will also reset all counts in the monitored statistics.

List Cache Resource Names - This is used to return all of the resource paths within the cache. If you are removing resources manually from the cache using JMX, it is good practice to first list all the cached resources first, to get an accurate list of cache paths to remove. To get the list, use JConsole instead of JMX.

Note: The larger the capacity, the more memory will be used. Both the capacity and policy should be set base on your specific requirements. For example, if the resources in your repository will never change once created, the capacity can be set lower, and the policy can be set to never.