Wednesday, December 25, 2013

Webshere Commerce - Data Cache (Part 3) - wc-server.xml


Populating data in CacheIVL: <WCD>\schema\db2\wcs.cacheivl.trigger.sql will do the job of copulating cache table when ever there is a add,delete and update.

Configure wc-server.xml:
Ensure that you have the following element in wc-server.xml under instanceProperties element

<CrossTransactionCache
            clearCacheOnMaxInvalidationIdsPerTransaction="false"
            clearUserDataCacheOnLogoff="false" clearUserOnLogoff="true"
            commandCaching="default" defaultResultSizeThreshold="8"
            enabled="true" maxInactivityTime="86400"
            maxInvalidationIdsPerTransaction="100000"
            maxTimeToLive="172800" reduceInvalidationIds="false" reduceMemory="false">
            <WCSystemDistributedMapCache enabled="true"
                maxInactivityTime="86400" maxTimeToLive="172800" reduceMemory="false"/>
            <com.ibm.commerce.user.objsrc.OrganizationCache enabled="true"/>
            <com.ibm.commerce.taxation.objsrc.CountryCache enabled="true"/>
            <com.ibm.commerce.taxation.objsrc.StateProvinceCache enabled="true"/>
            <com.ibm.commerce.user.objsrc.MemberGroupCache enabled="true"/>
            <com.ibm.commerce.user.objsrc.RoleCache enabled="true"/>
            <com.ibm.commerce.fulfillment.objsrc.ShippingModeCache enabled="true"/>

            <com.ibm.commerce.fulfillment.objsrc.ShippingModeDescriptionCache enabled="true"/>
            <com.ibm.commerce.common.objsrc.StoreEntityDescriptionCache enabled="true"/>
            <com.ibm.commerce.common.objsrc.CurrencyCache enabled="true"/>
            <com.ibm.commerce.common.objsrc.CurrencyDescriptionCache enabled="true"/>
            <com.ibm.commerce.common.objsrc.LanguageCache enabled="true"/>
            <com.ibm.commerce.common.objsrc.LanguageDescriptionCache enabled="true"/>
            <com.ibm.commerce.catalog.objsrc.CatalogCache enabled="true"/>
            <com.ibm.commerce.catalog.objsrc.CatalogDescriptionCache enabled="true"/>
            <com.ibm.commerce.common.objsrc.SupportedLanguageCache enabled="true"/>
            <com.ibm.commerce.fulfillment.objsrc.FulfillmentCenterCache enabled="true"/>

            <com.ibm.commerce.attachment.beansrc.AttachmentRelationUsageCache enabled="true"/>

            <com.ibm.commerce.attachment.beansrc.AttachmentRelationUsageDescriptionCache enabled="true"/>

            <com.ibm.commerce.infrastructure.facade.server.commands.CreateAttachmentUsageConfigurationCmdImpl enabled="true"/>
            <com.ibm.commerce.user.beansrc.PolicyAccountCache enabled="true"/>
            <com.ibm.commerce.user.beansrc.PolicyAccountLockoutCache enabled="true"/>
            <com.ibm.commerce.user.beansrc.PolicyPasswordCache enabled="true"/>
            <WCSessionDistributedMapCache enabled="true"
                maxInactivityTime="900" maxTimeToLive="172800" reduceMemory="false"/>

            <com.ibm.commerce.component.contextservice.commands.ContextDataSerValueCacheCmdImpl enabled="true"/>
            <WCContractDistributedMapCache enabled="true"
                maxInactivityTime="86400" maxTimeToLive="172800" reduceMemory="false"/>
            <com.ibm.commerce.contract.beansrc.BusinessPolicyCache enabled="true"/>
            <com.ibm.commerce.contract.beansrc.PolicyDescriptionCache enabled="true"/>
            <WCPromotionDistributedMapCache enabled="true"
                maxInactivityTime="86400" maxTimeToLive="172800" reduceMemory="false"/>
            <com.ibm.commerce.fulfillment.objsrc.CalculationCodeCache enabled="true"/>

            <com.ibm.commerce.fulfillment.objsrc.CalculationCodeDescriptionCache enabled="true"/>

            <com.ibm.commerce.tools.epromotion.objimpl.CalculationCodePromotionCache enabled="true"/>

            <com.ibm.commerce.marketing.promotion.AbstractPromotionSessionBeanPersistenceManager enabled="true"/>

            <com.ibm.commerce.marketing.promotion.group.PromotionGroupSessionBeanPersistenceManager enabled="true"/>

            <com.ibm.commerce.marketing.promotion.policy.PromotionPolicySessionBeanPersistenceManager enabled="true"/>

            <com.ibm.commerce.marketing.promotion.runtime.ShopcartDrivenAgendaBuilder.SHOPCART enabled="true"/>

            <com.ibm.commerce.marketing.promotion.runtime.ShopcartDrivenAgendaBuilder enabled="true"/>
            <WCMarketingDistributedMapCache enabled="true"
                maxInactivityTime="86400" maxTimeToLive="172800" reduceMemory="false"/>

            <com.ibm.commerce.tools.campaigns.CampaignInitiativeEvaluateCmdImpl enabled="true"/>

            <com.ibm.commerce.marketing.commands.elements.DisplayMerchandisingAssociationActionTaskCmdImpl.MASSOCCECE enabled="true"/>

            <com.ibm.commerce.marketing.commands.elements.DisplayMerchandisingAssociationActionTaskCmdImpl enabled="true"/>
            <com.ibm.commerce.marketing.dialog.util.MarketingUtilCatalog enabled="true"/>
            <WCUserDistributedMapCache enabled="true"
                maxInactivityTime="900" maxTimeToLive="172800" reduceMemory="false"/>

            <com.ibm.commerce.membergroup.commands.ListMemberGroupsForUserCmdImpl enabled="true"/>
            <com.ibm.commerce.user.objsrc.DemographicsCache enabled="true"/>
            <com.ibm.commerce.dynacache.commands.MemberGroupsCache enabled="true"/>
            <com.ibm.commerce.user.objsrc.MemberGroupMemberCache enabled="true"/>
            <com.ibm.commerce.user.objsrc.MemberRelationshipsCache enabled="true"/>

            <com.ibm.commerce.user.beansrc.MemberRelationshipsExtendedCache enabled="true"/>
            <com.ibm.commerce.user.objsrc.MemberRoleCache enabled="true"/>
            <com.ibm.commerce.user.objsrc.MemberCache enabled="true"/>
            <com.ibm.commerce.user.objsrc.UserCache enabled="true"/>
            <com.ibm.commerce.user.objsrc.UserRegistryCache enabled="true"/>

            <com.ibm.commerce.accesscontrol.policymanager.CommandLevelAuthorizationCache enabled="true"/>

            <com.ibm.commerce.accesscontrol.policymanager.ParentOrganizationCache enabled="true"/>

            <com.ibm.commerce.marketing.promotion.runtime.PromotionArgumentSessionBeanPersistenceManager enabled="true"/>
            <WCCatalogGroupDistributedMapCache enabled="true"
                maxInactivityTime="86400" maxTimeToLive="172800" reduceMemory="false"/>
            <com.ibm.commerce.catalog.objsrc.CatalogGroupCache enabled="true"/>

            <com.ibm.commerce.catalog.objsrc.CatalogGroupDescriptionCache enabled="true"/>
            <com.ibm.commerce.catalog.beansrc.CatalogGroupRelationCache enabled="true"/>
            <WCCatalogEntryDistributedMapCache enabled="true"
                maxInactivityTime="86400" maxTimeToLive="172800" reduceMemory="false"/>

            <com.ibm.commerce.fulfillment.objsrc.CatalogEntryShippingCache enabled="true"/>
            <com.ibm.commerce.catalog.objsrc.CatalogEntryCache enabled="true"/>

            <com.ibm.commerce.catalog.objsrc.CatalogEntryDescriptionCache enabled="true"/>
            <com.ibm.commerce.catalog.objsrc.ItemCache enabled="true"/>
            <com.ibm.commerce.catalog.objsrc.ProductCache enabled="true"/>
            <com.ibm.commerce.catalog.util.CatalogHelperCache enabled="true"/>

            <com.ibm.commerce.catalog.beansrc.CatalogGroupCatalogEntryRelationCache enabled="true"/>
            <WCPriceDistributedMapCache enabled="true"
                maxInactivityTime="86400" maxTimeToLive="172800" reduceMemory="false"/>
            <com.ibm.commerce.catalog.beansrc.ListPriceCache enabled="true"/>
            <com.ibm.commerce.order.objsrc.OfferCache enabled="true"/>
            <com.ibm.commerce.order.objsrc.OfferPriceCache enabled="true"/>
            <com.ibm.commerce.price.commands.RetrievePricesCmdImpl enabled="true"/>
        </CrossTransactionCache>


After configuring distirbutedMap on server. You should see following logging statements in sysouts

ResourceMgrIm I   WSVR0049I: Binding WCUserDistributedMapCache as services/cache/WCUserDistributedMapCache
ResourceMgrIm I   WSVR0049I: Binding WCSessionDistributedMapCache as services/cache/WCSessionDistributedMapCache
ResourceMgrIm I   WSVR0049I: Binding WCCatalogEntryDistributedMapCache as services/cache/WCCatalogEntryDistributedMapCache
ResourceMgrIm I   WSVR0049I: Binding WCCatalogGroupDistributedMapCache as services/cache/WCCatalogGroupDistributedMapCache
 This means all the configured distirbutedMaps are active now.


This will ensure all the settings regarding the data cache is completed. Still i have to find if WC is considering cacheivl? is the invalidation schedule job provided by the IBM is working? why i ask this question is simple. Trigger ran twice for catalog table and there is double data in cacheivl. when i ran invalidation job. data was not removed from cacheivl. If any one know more on this please share.

Tuesday, December 24, 2013

Webshere Commerce - Data Cache (Part 2) - Enabling and configuring distributedMap

 There are two ways to configure data cache

  • By creating cacheinstance.properties
  • By configuring on application server.  This is discussed below

    Step By Step setup:

  • Step 1: Click on Object Cache instances
  • Step 2: Click New
  • Step 3: Get the distributed Map you want configure (here)
  • Step 4: Here i am setting properties for a single JVM . JNDI has to be services/cache/distributedMapName ( you will get that from Step 3)

Monday, December 23, 2013

Websphere Commerce Data Cache (Part 1) - Distribution Maps


 In Data Cache we have to know what distribution mapping has to be configured for caching.We cover how to configure in a while. Before configuring we need to know what are the distribution maps available.


WCContractDistributedMapCache, WCSystemDistributedMapCache

Cache any system data like Organization, Country, StateProvince,MemberGroup, Role, ShippingMode, Currency,Language, BusinessPolicy


WCPromotionDistributedMapCache, WCMarketingDistributedMapCache

These distribution maps will cache marketing and promotional data like CalculationCode, Promotion, PromotionGroup, PromotionPolicy, MerchandisingAssociation


WCCatalogGroupDistributedMapCache

This will cache catalog Group related data like CatalogGroup, CatalogGroupRelation


WCCatalogEntryDistributedMapCache, WCPriceDistributedMapCache

Catalog Entry related data will be cached for this distribution Map like Item, Product, Shipping, Price.


WCUserDistributedMapCache, WCSessionDistributedMapCache

User and session related data like user related and session related data


WCFlexFlowDistributedMapCache,WCSearchxxxDistributedMapCache,WCSEOxxxDistributedMapCache

Some Essential data.

Note: Command caching is enabled using cachespec.xml

How to configure distributedMap data cache on server? Click here

Reference:




Friday, December 20, 2013

Caching intro


Well .. before i started going through the websphere commerce caching features. I was under assumption only JSPs, Static content only can be cached for easy access.

IBM Websphere commerce cache almost everything like JSP, Sevlets, Commerce commands.
What are other features IBM WC provides for caching?
  • IBM WC verifies if content of cache is valid . And this validation is run on rule based, time based , group based(What is this? got to find out)  and programmatic.
  • If you have multiple servers it can replicate caching on all the servers.
  • When you are restarting server large chunk of cache will be preserved to reused after restart. ( this is really news to me. Most of the time we restart server to ensure there is no cache is present on server. IBM WC does a smart saving of cache) So next time if you are still seeing old data after restart remember to clear cache using cache monitor.

Now question is how are we going to enable above features and where. Here is the answer cachespec.xml

Based on type of content some content of data can be cached at browser level , If data is more secured then cache data at server level ( more secure) . IBM WC can cache full page or partial page based on what you define.

I will cover Cachespec.xml and how to utilize better caching.