Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-42295

LayoutLister can be still slow for very deep structures

    Details

      Description

      Background

      Upon investigating a customer issue, I've found three problems in LayoutLister. LPS-36049 enhances its performance, but there are still areas of improvement.

      • Method _createList() implements a DFS (Depth First Search) algorithm to traverse the layout tree recursively. As such it isn't feasible for very deep structures.
      • Searching for matching layouts based on a parentLayoutId in method createList()_ is done in O(N) complexity.
      • The LayoutView object which is created by method getLayoutView() is a good candidate for being cached in a request scoped Thread Local Cache.

      With these improvement I could lower the execution time of _createList() (with 5000+ pages) from ~250ms to ~5ms.

      Steps to reproduce

      1) Create a site called BigSite.
      2) Create ~1000 pages: 9 level deep tree, every node has 2 pages and there is one root node. Use attached Groovy script (remember to fill in groupId).
      3) Without fix applied: execute attached script (Performance_422995.groovy remember to fill in groupId) multiple times. Write down execution times from the output.

      • With fix applied:* execute attached script (Performance_422995_after_fix.groovy remember to fill in groupId) multiple times. Write down execution times from the output.

      Executions times before the fix:

      Start measuring layouts performance
      Total time:35. Number of results:2049
      

      Executions times after the fix (should be lower than before):

      Start measuring layouts performance
      Total time:16. Number of results:2049
      

        Attachments

        1. lportal_trunk.sql.gz
          394 kB
          Laszlo Csontos
        2. PerformanceLPS42295_after_fix.groovy
          2 kB
          Juan Gonzalez
        3. PerformanceLPS42295.groovy
          2 kB
          Juan Gonzalez
        4. populateLayouts_LPS-42295_62x.groovy
          3 kB
          Juan Gonzalez

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  2 years, 44 weeks, 5 days ago

                  Packages

                  Version Package
                  6.2.X EE
                  7.0.0 M1