Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Release Branch 11.04, Release Branch 12.04, Release Branch 13.07, Release Branch 14.12, Trunk
    • Fix Version/s: 16.11.01
    • Component/s: product
    • Labels:
      None

      Description

      There are some enhancements in product content wrapper JAVA class. We used these enhancements in our project and observed good change in website performance.

      1. If content of product is empty string or null then method 'getProductContentAsText' is not caching the result.
      And thus every time this method is making SQL call even no content in database. Method should cache the empty string and null as result.
      2. Overloaded method 'getProductContentAsText' is also using cache method of Delegator for 'ProductConetnt' entity selection and passing 'true' to use cache for 'ContentWorker.renderContentAsText' method. This approach is making unnecessary copies of cache for content.
      I Product content wrapper cache
      II ProductContent entity cache
      III Content, Dataresource, ElectrocText and etc... entities cache(ContentWorker.renderContentAsText)

      If I again call the 'getProductContentAsText' method then this will return the result from product content wrapper cache. So there is no use of ProductContent, Content, Dataresource and ElectrocText cache. And these cache also filling the memory of application.

      We also applied the same logic for category content wrapper. I am attaching the patch for trunk, please review.

      1. Ofbiz-6701_Updated_All_Wrapper.patch
        27 kB
        Ritu Raj Lakhera
      2. Ofbiz-6701.patch
        5 kB
        Ritu Raj Lakhera

        Issue Links

          Activity

          Hide
          rrlakhera Ritu Raj Lakhera added a comment -

          Attaching the patch for trunk.

          Show
          rrlakhera Ritu Raj Lakhera added a comment - Attaching the patch for trunk.
          Hide
          jacques.le.roux Jacques Le Roux added a comment -

          Hi Ritu Raj,

          I agree it's a good improvement, we can even go further. If we reach

          productContentCache.putIfAbsentAndGet(cacheKey, encoder.encode(outString));
          

          we know that the productContentCache.get(cacheKey) is null so we can replace by

          productContentCache.put(cacheKey, encoder.encode(outString));
          

          As you mentionned this also applies to category content wrapper. We can even extend to ProductPromoContentWrapper, ProductConfigItemContentWrapper, OrderContentWrapper, PartyContentWrapper and WorkEffortContentWrapper classes, would you mind provide the corresponding patches?

          Show
          jacques.le.roux Jacques Le Roux added a comment - Hi Ritu Raj, I agree it's a good improvement, we can even go further. If we reach productContentCache.putIfAbsentAndGet(cacheKey, encoder.encode(outString)); we know that the productContentCache.get(cacheKey) is null so we can replace by productContentCache.put(cacheKey, encoder.encode(outString)); As you mentionned this also applies to category content wrapper. We can even extend to ProductPromoContentWrapper, ProductConfigItemContentWrapper, OrderContentWrapper, PartyContentWrapper and WorkEffortContentWrapper classes, would you mind provide the corresponding patches?
          Hide
          rrlakhera Ritu Raj Lakhera added a comment -

          Thanks Jacques for looking in this. I agree with you point to use put method.
          I am attaching patch file for all content wrapper.

          Show
          rrlakhera Ritu Raj Lakhera added a comment - Thanks Jacques for looking in this. I agree with you point to use put method. I am attaching patch file for all content wrapper.
          Hide
          rrlakhera Ritu Raj Lakhera added a comment -

          Attaching patch file for all content wrapper.

          Show
          rrlakhera Ritu Raj Lakhera added a comment - Attaching patch file for all content wrapper.
          Hide
          jacques.le.roux Jacques Le Roux added a comment -

          Thanks Ritu Raj,

          Your modified patch is in trunk at revision: 1711578

          I added this line in CategoryContentWrapper

          outString = productCategory.getModelEntity().isField(candidateFieldName) ? productCategory.getString(candidateFieldName): "";
          

          And completed more the WorkEffort part

          Show
          jacques.le.roux Jacques Le Roux added a comment - Thanks Ritu Raj, Your modified patch is in trunk at revision: 1711578 I added this line in CategoryContentWrapper outString = productCategory.getModelEntity().isField(candidateFieldName) ? productCategory.getString(candidateFieldName): ""; And completed more the WorkEffort part
          Hide
          jacques.le.roux Jacques Le Roux added a comment -

          Temporarily reopening, I want this to be a sub-task of OFBIZ-1525

          Show
          jacques.le.roux Jacques Le Roux added a comment - Temporarily reopening, I want this to be a sub-task of OFBIZ-1525
          Hide
          jacques.le.roux Jacques Le Roux added a comment -

          Yikes, wrong tab :/ Closing as fixed again

          Show
          jacques.le.roux Jacques Le Roux added a comment - Yikes, wrong tab :/ Closing as fixed again
          Hide
          jacques.le.roux Jacques Le Roux added a comment -

          Finally as this is a sub-task of OFBIZ-6669, I need 1st to make it a simple issue to be able to make OFBIZ-6669 a sub-task of OFBIZ-1525 (no sub-taks trees in JIra)
          So temporarily reopening, I will simply associate it with OFBIZ-6669, pfew...

          Show
          jacques.le.roux Jacques Le Roux added a comment - Finally as this is a sub-task of OFBIZ-6669 , I need 1st to make it a simple issue to be able to make OFBIZ-6669 a sub-task of OFBIZ-1525 (no sub-taks trees in JIra) So temporarily reopening, I will simply associate it with OFBIZ-6669 , pfew...

            People

            • Assignee:
              jacques.le.roux Jacques Le Roux
              Reporter:
              rrlakhera Ritu Raj Lakhera
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development