Uploaded image for project: 'Lucee Development'
  1. LDEV-1757

Slow Felix startup performance re-creating cache folder

    Details

    • Type: Bug
    • Status: Deployed
    • Priority: New
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.2.7.61
    • Labels:
      None
    • Sprint:

      Description

      I've been profiling Lucee inside of JSR-223 with CommandBox to track start up times and I'm seeing the Felix cache folder getting deleted and recreated on startup.

        java.lang.Thread.State: RUNNABLE
             at java.io.WinNTFileSystem.delete0(Native Method)
             at java.io.WinNTFileSystem.delete(WinNTFileSystem.java:563)
             at java.io.File.delete(File.java:1041)
             at org.apache.felix.framework.util.SecureAction.deleteFile(SecureAction.java:547)
             at org.apache.felix.framework.cache.BundleCache.deleteDirectoryTreeRecursive(BundleCache.java:438)
             at org.apache.felix.framework.cache.BundleCache.deleteDirectoryTreeRecursive(BundleCache.java:433)
             at org.apache.felix.framework.cache.BundleCache.deleteDirectoryTreeRecursive(BundleCache.java:433)
             at org.apache.felix.framework.cache.BundleCache.deleteDirectoryTreeRecursive(BundleCache.java:433)
             at org.apache.felix.framework.cache.BundleCache.deleteDirectoryTree(BundleCache.java:371)
             at org.apache.felix.framework.cache.BundleCache.delete(BundleCache.java:213)
             - locked <0x00000007419973b8> (a org.apache.felix.framework.cache.BundleCache)
             at org.apache.felix.framework.Felix.init(Felix.java:711)
             at org.apache.felix.framework.Felix.init(Felix.java:626)
             at org.apache.felix.framework.Felix.start(Felix.java:964)
             at lucee.loader.engine.CFMLEngineFactory.getFelix(CFMLEngineFactory.java:556)
      
         java.lang.Thread.State: RUNNABLE
              at java.io.WinNTFileSystem.createDirectory(Native Method)
              at java.io.File.mkdir(File.java:1316)
              at org.apache.felix.framework.util.SecureAction.mkdir(SecureAction.java:363)
              at org.apache.felix.framework.cache.BundleArchive.initialize(BundleArchive.java:781)
              at org.apache.felix.framework.cache.BundleArchive.<init>(BundleArchive.java:150)
              at org.apache.felix.framework.cache.BundleCache.create(BundleCache.java:277)
              at org.apache.felix.framework.Felix.installBundle(Felix.java:3009)
              at org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:167)
              at lucee.loader.osgi.BundleUtil.installBundle(BundleUtil.java:90)
              at lucee.loader.osgi.BundleUtil.addBundle(BundleUtil.java:81)
              at lucee.loader.osgi.BundleUtil.addBundle(BundleUtil.java:49)
              at lucee.loader.osgi.BundleLoader.loadBundles(BundleLoader.java:153)
              at lucee.loader.engine.CFMLEngineFactory.initEngine(CFMLEngineFactory.java:413)*strong text*
      
         java.lang.Thread.State: RUNNABLE
              at java.lang.Runtime.gc(Native Method)
              at java.lang.System.gc(System.java:993)
              at org.apache.felix.framework.cache.BundleCache.deleteDirectoryTree(BundleCache.java:378)
              at org.apache.felix.framework.cache.BundleCache.delete(BundleCache.java:213)
              - locked <0x00000006418084e8> (a org.apache.felix.framework.cache.BundleCache)
              at org.apache.felix.framework.Felix.init(Felix.java:711)
              at org.apache.felix.framework.Felix.init(Felix.java:626)
              at org.apache.felix.framework.Felix.start(Felix.java:964)
              at lucee.loader.engine.CFMLEngineFactory.getFelix(CFMLEngineFactory.java:556)
      

      I finally tracked down this code which is specifically telling Felix to destroy and re-create it's cache on every start. This is not the default behavior of Felix!

      // storage clean
      final String storageClean = (String) config
      		.get(Constants.FRAMEWORK_STORAGE_CLEAN);
      if (Util.isEmpty(storageClean))
      	config.put(Constants.FRAMEWORK_STORAGE_CLEAN,
      			Constants.FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT);
      

      http://felix.apache.org/documentation/subprojects/apache-felix-framework/apache-felix-framework-configuration-properties.html

      This prevents the disk cache from actually getting used and slows down Lucee startup time.

        Attachments

          Activity

            People

            • Assignee:
              bdw429s Brad Wood
              Reporter:
              bdw429s Brad Wood
            • Votes:
              3 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: