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

Performance of loading hundreds of timezones on startup

    Details

    • Type: Bug
    • Status: Deployed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.2.7.52
    • Labels:
      None
    • Sprint:
      March 2018

      Description

      I've been profiling the startup time of Lucee inside of CommandBox on JSR-223 and one of the stack traces that's come up several times now is this:

        java.lang.Thread.State: RUNNABLE
             at java.io.DataInputStream.readByte(DataInputStream.java:265)
             at sun.util.calendar.ZoneInfoFile.readEpochSec(ZoneInfoFile.java:389)
             at sun.util.calendar.ZoneInfoFile.getZoneInfo(ZoneInfoFile.java:364)
             at sun.util.calendar.ZoneInfoFile.getZoneInfo0(ZoneInfoFile.java:139)
             at sun.util.calendar.ZoneInfoFile.getZoneInfo(ZoneInfoFile.java:115)
             at sun.util.calendar.ZoneInfo.getTimeZone(ZoneInfo.java:589)
             at java.util.TimeZone.getTimeZone(TimeZone.java:560)
             at java.util.TimeZone.getTimeZone(TimeZone.java:516)
             - locked <0x000000064183f620> (a java.lang.Class for java.util.TimeZone)
             at lucee.commons.date.TimeZoneConstants.<clinit>(TimeZoneConstants.java:126)
             at lucee.runtime.engine.InfoImpl.<init>(InfoImpl.java:86)
             at lucee.runtime.engine.CFMLEngineImpl.<init>(CFMLEngineImpl.java:257)
             at lucee.runtime.engine.CFMLEngineImpl.getInstance(CFMLEngineImpl.java:623)
             - locked <0x0000000743eb1490> (a java.lang.Class for lucee.runtime.engine.CFMLEngineImpl)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
             at java.lang.reflect.Method.invoke(Method.java:498)
             at lucee.loader.engine.CFMLEngineFactory.getEngine(CFMLEngineFactory.java:1589)
             at lucee.loader.engine.CFMLEngineFactory.initEngine(CFMLEngineFactory.java:420)
             at lucee.loader.engine.CFMLEngineFactory.initEngineIfNecessary(CFMLEngineFactory.java:276)
             at lucee.loader.engine.CFMLEngineFactory.getInstance(CFMLEngineFactory.java:172)
             - locked <0x000000064180d848> (a java.lang.Class for lucee.loader.engine.CFMLEngineFactory)
             at lucee.runtime.script.BaseScriptEngineFactory.<init>(BaseScriptEngineFactory.java:61)
             at lucee.runtime.script.LuceeScriptEngineFactory.<init>(LuceeScriptEngineFactory.java:27)
             at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
             at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
             at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
             at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
             at java.lang.Class.newInstance(Class.java:442)
             at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380)
             at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
             at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
             at javax.script.ScriptEngineManager.initEngines(ScriptEngineManager.java:122)
             at javax.script.ScriptEngineManager.init(ScriptEngineManager.java:84)
             at javax.script.ScriptEngineManager.<init>(ScriptEngineManager.java:75)
             at cliloader.LoaderCLIMain.execute(LoaderCLIMain.java:2
      

      I looked in TimeZoneConstants.java and it's calling TimeZone.getTimeZone() over 500 times on startup! Each call appears to read a file in which adds up after doing it 500-600 times. Is there a faster way to get this information, or can we delay getting this into until it's used the first time? Perhaps it can be cached also. I assume this is data that doesn't change often, if at all.

        Attachments

          Activity

            People

            • Assignee:
              michaeloffner Michael Offner
              Reporter:
              bdw429s Brad Wood
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: