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

Improve ResourcesTemplatingFunctions#generate performance

XMLWordPrintable

    • Yes
    • UI Framework & 6.2 Ramp up 15
    • 2

      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.

        Acceptance criteria

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

                Created:
                Updated:
                Resolved:

                  Task DoD