Start of Content Area

Function documentation Caching in the VM Container  Locate the document in its SAP Library structure

Use

The VM Container cache is a cache for all Java objects. It uses Shared Closures to store objects in the shared memory. Cache objects are accessed using string keys.

In the VMC System Administration (transaction SM53) you can configure the cache and monitor its state.

Prerequisites

Applications and infrastructure services wanting to use the cache must create a cache configuration.  See Displaying Applications under Configuration.

Features

Users can reserve namespaces for their cache objects in a cache configuration. This namespace is called a cache region. All cache objects are linked to precisely one cache region. The namespaces are organized flatly with regard to their function – there are no parent/child relationships between individual regions. To make the display clearer, a parent/child relationship between regions is created using a slash “/” in the region name. For example, region /IPC/Pricing/Configuration is a child region of /IPC/Pricing.

A cache region does not just provide the namespace for cache objects - for the application it is the central, configurable unit. The configuration options can be divided into region and element configurations.

Region Configuration

Region Configuration Options

Option

Meaning and Possible Values

Maximum size in bytes

 

 

 

 

The values used in both these options are:

Upper Limit: Indicates the maximum size that cannot be exceeded. If this limit is reached, the cache evicts obsolete objects from the cache region, until the size falls below the start of eviction limit.  Only then does the cache accept requests again. Default value: 35% of the shared pool (see Resource Management in the VM Container).  

Critical Limit: If this limit is exceeded, objects are actively evicted from the cache region when a cache request arrives. Objects stop getting evicted when the number of objects falls below the start of eviction limit. Default value: 95% of the Upper Limit.

Start of Eviction: This limit is controlled by a background eviction job (auto Java), which runs at regular intervals. If this limit is exceeded, objects are removed from the region until the number falls below the limit. This means that the other limits should seldom be reached. Default value: 90% of the Upper Limit.

Maximum number of objects.

Priority

The priority option can have the following values:

Highest

High

Medium

low 

lowest 

If the cache infrastructure ascertains that the total cache size has exceeded a specified limit, a cache region must be selected, from which elements are removed. Priority is used as an aid for the cache infrastructure to judge how important specific cache regions and therefore cache elements are.

Client-specific

You have to specify whether each cache region is client-specific or not. If a cache region is configured as client-specific, cache objects are also associated with the client that started a cache request, as well as with the cache region.

Storage plug-in

The storage plug-in specifies where the cache objects belonging to a region are stored. There are local storage plug-ins that store cache objects in the local Java heap memory, and there are storage plug-ins that store cache objects in the shared memory. To keep the VMs small in size, storage plug-ins that store objects in the share memory are used exclusively in the VM Container. 

Eviction policy plug-in

The eviction policy plug-in is responsible for the Eviction Policy of cache objects. If the cache infrastructure specifies that objects must be removed from a cache region, the eviction policy plug-in is asked to supply a cache entry that can be evicted. A typical example of an eviction policy is an LRU (Least Recently Used) procedure, which discriminates against cache objects on the grounds of their age.

Cache reader plug-in

Furthermore, cache users can register a cache reader plug-in. If a cache object is requested and it cannot be found in the cache, the cache infrastructure asks the cache reader for the object.

Storage of failed accesses to cache reader plug-in

If the cache reader plug-in does cannot retrieve a requested object (for instance, because there is no database entry for it), the cache is able to store this failed access attempt. The next time a user attempts to access this object, a response indicating that the object is not in the cache is returned to the user immediately. The cache reader plug-in will not be asked again, and this avoids unnecessary access to the database.

 

Element Configuration

Element configuration is related directly to single cache objects, and allows the following parameters to be set:

Element Configuration Options

Option

Meaning and Possible Values

Time-to-live

The time-to-live parameter specifies (in milliseconds) how long a cache object is to be valid for after it is created in the cache region.

Absolute timestamp for eviction

The absolute eviction timestamp indicates an exact date (or time) up to which an object is valid.

Eviction period

If you want to create a new object in a region and this region’s absolute timestamp has expired, the eviction period specifies how the timestamp is to be updated.

 

In addition to these static configuration options, you can create Cache Groups at runtime. Cache groups are associated with a cache region and enable cache objects from one region to be grouped together. An element configuration can be specified for each cache group.

Activities

In the VMC System Administration (SM53) you can change the cache configuration and display the cache state. You can find further information in the following sections:

Displaying andn Changing the Cache Configuration

Displaying the Cache State

Displaying Cache Statistics

 

 

End of Content Area