mdm-cache-config.properties parameters

The cache property files contain the cache memory parameters of Product Master.

The mdm-cache-config.properties parameters define the cache properties of Product Master. All settings for maxElementsInMemory refer to the maximum number of an object type that is cached in memory per JVM instance.

When modifying the settings of object cache, it is important that administrators thoroughly examine the JVM memory settings of potentially affected services to ensure that they are adequately set. The relevance of examining the JVM memory is important because the size of the object cache is generally proportional to the required amount of memory. If you exceed the available memory with excessively large cache, performance will severely degrade. Similarly, however, an inadequately sized cache results in poor performance from excessive CPU and disk utilization.

You can determine the size of the object cache you require by checking the cache hit percentage in the user interface, which is located on the pane underSystem Administrator > Performance Info > Caches. Select the appropriate object in the drop-down menu to view its cache information. The percentages that are displayed are calculated based on usage. You must provide the system reasonable time before referencing the cache hit percentage. The calculated percentages will resemble real results only after your system has been running under a normal production load for an extended duration.

Note: When resetting the cache size, you must restart the server for the changes to take effect.

Product Master built-in cache

Product Master provides built-in cache for a list of object types. It is important to understand the scope of the cache, which has implications on the life span and memory consumption on the server. If a cache is maintained in Application Context, it is global to the server instance (each Product Master service); if a cache is contained within User Session, it is specific to one user in one session, and has different copies of cache objects for different user sessions.

The global cache in Application Context keeps one copy, therefore, uses less memory, but has a life span of the entire service process until the service is shut down. On the other hand, the cache in User Session keeps one copy for each user session, therefore can use more memory for many user sessions. The life span of the cache in a user session has the life span of the session, for example, when a user logs out, the session is terminated and the user session caches are released.

The specific cache objects in either global cache or user session cache still observein the rules of object count limit and timeout limit, when either limit is triggered, some cached objects are beg removed from cache container, and corresponding memory is reclaimed.

With the introduction of distributed cache (ehcache), most of the objects are cached globally. Multiple service processes can access the same copy of cached objects, which resolves the potential issue of stalled cache. This enhancement leads to better use of memory by removing User Session based cache; also the cached objects can survive even if one service process is shut down.

For determining the effectiveness of each cached object type, Product Master user interface displays the number of cached objects and the count cache hits and cache misses. The information can be analyzed to determine whether cache settings are properly done for the implementation and user scenarios.

Solution level cache

Product Master built-in caches usually are definition types of objects. If some objects are frequently accessed in a specific scenario, but that object type does not have built-in cache capability, a solution level cache might help. A typical example is a category or hierarchy cache.
function getCategoryFromCache(hmCategoryCache, hierarchy, sCategoryPK) {
	if (!hmCategoryCache.containsKey(sCategoryPK)) {
		hmCategoryCache[sCategoryPK] = hierarchy.getEntryByPrimaryKey(sCategoryPK);
	}
	return hmCategoryCache[sCategoryPK];
}

var hmCategoryCache = [];
var hierarchy = getCategoryTreeByName(“My Hierarchy Name”);

// ...

// Any time you want to retrieve a category (i.e. within a loop where you are
// processing an item import), use this instead...
var category = getCategoryFromCache(hmCategoryCache, hierarchy, sCategoryPK);
item.mapCtgItemToCategory(category); // (for example)