glassfish
  1. glassfish
  2. GLASSFISH-20298

Loading of HK2 cache data slows down server initialization

    Details

    • Type: Bug Bug
    • Status: Reopened
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 4.0_dev
    • Fix Version/s: 4.1.1
    • Component/s: hk2
    • Labels:
      None

      Description

      During server startup, the HK2 OSGi adapter reads in a fairly large cache file in the ModuleDefinitionCacheSingleton.loadCachedData method. Typically this is about 400KB of serialized module definition data. This takes anywhere from 100-400 ms and while the server is doing this, it is doing nothing else. The code is started via the bundle start method of the osgi-adapter.jar file.

      An idea for improving server start time is to move the reading of the cache file to another thread that runs in parallel with some other initialization work that the server is doing. For example, if it would be possible to initialize just the OSGi bundle(s) that are needed to read this cache first, start the cache-reading thread, and then start then have Felix initialize the rest of the bundles. Then, when the bundles are all initialized, the code that need the cache would already have it available.

      Or, if the cache were constructed purely from Java SE objects, then the cache could be read into memory without having to initialize any OSGi bundle.

        Activity

        Hide
        Tom Mueller added a comment -

        I've measured the time required for loadCachedData in both 4.0 and 3.1.2. This is for a subsequent restart, and is an average of 5 runs on a MBP:

        4.0: 424 ms ("Felix" start time is 2726 ms), inhabitants size = 516415
        3.1.2: 194 ms ("Felix start time is 1615 ms), inhabitants size = 371748

        Show
        Tom Mueller added a comment - I've measured the time required for loadCachedData in both 4.0 and 3.1.2. This is for a subsequent restart, and is an average of 5 runs on a MBP: 4.0: 424 ms ("Felix" start time is 2726 ms), inhabitants size = 516415 3.1.2: 194 ms ("Felix start time is 1615 ms), inhabitants size = 371748
        Hide
        Tom Mueller added a comment -

        Note that the only thing fixed here is the GLASSFISH-20350 subtask which reduced the time to read the cache by about 100 ms. This change did not move the cache reading to a parallel thread. It also did not restore the cache reading time to what it was in 3.1.2.

        Show
        Tom Mueller added a comment - Note that the only thing fixed here is the GLASSFISH-20350 subtask which reduced the time to read the cache by about 100 ms. This change did not move the cache reading to a parallel thread. It also did not restore the cache reading time to what it was in 3.1.2.
        Hide
        Tom Mueller added a comment -

        Retargeting for 4.0.1 because we have already done what we plan to do in this area for 4.0 via GLASSFISH-20350.

        Show
        Tom Mueller added a comment - Retargeting for 4.0.1 because we have already done what we plan to do in this area for 4.0 via GLASSFISH-20350 .

          People

          • Assignee:
            mtaube
            Reporter:
            Tom Mueller
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: