CRM and CX Blogs by SAP
Stay up-to-date on the latest developments and product news about intelligent customer experience and CRM technologies through blog posts from SAP experts.
cancel
Showing results for 
Search instead for 
Did you mean: 
joris_quenee
Product and Topic Expert
Product and Topic Expert

Introduction

Entity Region cache is a critical region for SAP Commerce performance.  In this article, we will how we can create dedicated region cache for some types to release pressure on Entity Region cache.

 

Why New Cache Region

Entity region cache is capturing by default all types (Items instances). In most case, this strategy is working well when product catalogue is not too large and when user traffic is limited.

However, we can see very high instance eviction when we reach this cache size limit. It is impacting badly performance when eviction is on low volatility data as Product, Category, and Features.

In other hand, high volatility data should be stored in dedicated cache to not pollute default generic region cache (entity region cache). Often, we can identify Cart, CartEntry, PromotionResult, PromotionAction as high volatility data.

By inspecting cache in HAC, we can see easily this behavior.

Capture d’écran 2024-03-28 à 16.20.19.png

 

How to create a new Cache Region

Let imagine, we want to create a dedicate cache for Cart and CartEntry type. We need first to get type code. It can be found through BackOffice in Type search

Capture d’écran 2024-04-03 à 15.55.52.png

Then, we can declare in spring XML our new cache region

 

<!-- new cache region dedicated for Cart -->
<bean name="cartCacheRegion" class="de.hybris.platform.regioncache.region.impl.EHCacheRegion" lazy-init="true">
<constructor-arg name="name" value="cartCacheRegion" />
<constructor-arg name="maxEntries" value="1000" />
<constructor-arg name="evictionPolicy" value="LRU" />
<constructor-arg name="statsEnabled" value="true" />
<constructor-arg name="exclusiveComputation" value="false" />
<property name="handledTypes">
<array>
<value>43</value> <!-- Cart -->
<value>44</value> <!-- CartEntry -->
</array>
</property>
</bean>

<!-- Add cache region in HAC view -->
<bean id="cartCacheRegionRegistrar" class="de.hybris.platform.regioncache.region.CacheRegionRegistrar" c:region-ref="cartCacheRegion" />

 

This spring XML must be part of global context (project.properties)

 

# Cache regions need to go to the global context
custom.global-context=custom-cache-spring.xml

 

 

After this cache region creation, we see that Cart/CartEntry are not polluting anymore our generic Entity Region cache where low volatility data can stay for long time.

 

Conclusion

Create a new dedicated region cache for some types, it is quite simple and straightforward when we know how to do.

For more advanced use case, you should not hesitate to ask SAP Expert Services help.

 

 
1 Comment