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.
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.
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
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |