Uploaded image for project: 'Magnolia Resources Module'
  1. Magnolia Resources Module
  2. MGNLRES-319

Improve ResourcesTemplatingFunctions#generate performance

    XMLWordPrintable

    Details

    • Release notes required:
      Yes
    • Epic Link:
    • Sprint:
      UI Framework & 6.2 Ramp up 15
    • Story Points:
      2
    • Magnolia Release:
      6.1.6, 6.2

      Description

      As described in SUPPORT-9441,

      info.magnolia.modules.resources.templating.ResourcesTemplatingFunctions#generate method used by resfn, scans all the files and directories of the resources directory + all the files found on the classpath to match their path with the provided js or css path that is always considered as a potential regexp.

      The recursive scanning of the resource directory is very expensive when you have a lot of light modules (especially in Java 8 due to https://bugs.openjdk.java.net/browse/JDK-8153414).
      And matching, by default, every file path with the provided path is very expensive in terms of CPU usage.

      In our context, removing the calls to resfn multiplied the throughput by 3 on non cached pages.

      There should be an extra function to allow us to provide the complete path of the resources so that the scanning + pattern matching is not forced.

      Providing a cache for already scanned resources would significantly reduce system load - which is an expected result.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              apchelintcev Aleksandr Pchelintcev
              Reporter:
              viet.nguyen Viet Nguyen
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Date of First Response: