glassfish
  1. glassfish
  2. GLASSFISH-13782

3.1 deployment performance - ASURLClassLoader.appendURL, urlSet.contains() call takes more time than v3.0

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 3.1
    • Fix Version/s: 3.1_dev
    • Component/s: classloader
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      13,782

      Description

      When comparing the deployment performance of 3.0 vs 3.1 using the profile data
      that Tom collected, I noticed a few areas where we have regressed from 3.0, I
      am filing issues to track these to see if we can undertand the cause of it and
      if there are any potential improvement we could do.

      The most noticeable part in the time differences for redeployment is when it's
      creating the application classloader, it seems creating connector classloader
      takes much longer (0.48 difference).
      The calling stack:
      org.glassfish.deployment.common.DeploymentContextImpl.createApplicationClassLoad
      er(org.glassfish.internal.api.ClassLoaderHierarchy,
      org.glassfish.api.deployment.archive.ArchiveHandler): 1.071, 1.551
      com.sun.appserv.connectors.internal.api.ConnectorClassLoaderServiceImpl.createCo
      nnectorClassLoaderForApplication(java.lang.String): 1.031, 1.511

        Issue Links

          Activity

          Hide
          Hong Zhang added a comment -

          Additional note: the first number is from 3.0. the second number is from 3.1,
          the unit is second.

          Adding Tom to the Cc

          Show
          Hong Zhang added a comment - Additional note: the first number is from 3.0. the second number is from 3.1, the unit is second. Adding Tom to the Cc
          Hide
          Hong Zhang added a comment -

          move to P2 as it's performance related

          Show
          Hong Zhang added a comment - move to P2 as it's performance related
          Hide
          Jagadish added a comment -

          setting target milestone

          Show
          Jagadish added a comment - setting target milestone
          Hide
          Jagadish added a comment -

          Please find my observations :

          The change in the time taken to create the connector classloader happens due to
          ASURLClassLoader.appendURL.
          In turn, the urlSet.contains() in ASURLClassLoader is the root cause which
          accounts for about .42 seconds.

          urlSet is realized as ArrayList and "list.contains()" call seems to take more
          time as it iterates through the entries.
          I tried to see the number of entries that get added to urlSet in v3.0 and 3.1
          and it remains the same (highest being 52 for one of the classloader instances).
          I am not sure what causes list.contains() to take more time in 3.1 though the
          size remained the same between v3.0 and 3.1

          However, I thought urlSet can be made as a LinkedHashSet and tried changing the
          type. It seems to reduce the time taken significantly.
          v3.0 - ClassLoaderHierarchy.getConnectorClassLoader() -> 1.164 sec.
          3.1 (b23 workspace) - ClassLoaderHierarchy.getConnectorClassLoader() -> 1.6+ sec.
          3.1 (changed urlSet to LinkedHashSet) - 0.464 sec.

          Transferring to Sahoo for further investigation.

          Show
          Jagadish added a comment - Please find my observations : The change in the time taken to create the connector classloader happens due to ASURLClassLoader.appendURL. In turn, the urlSet.contains() in ASURLClassLoader is the root cause which accounts for about .42 seconds. urlSet is realized as ArrayList and "list.contains()" call seems to take more time as it iterates through the entries. I tried to see the number of entries that get added to urlSet in v3.0 and 3.1 and it remains the same (highest being 52 for one of the classloader instances). I am not sure what causes list.contains() to take more time in 3.1 though the size remained the same between v3.0 and 3.1 However, I thought urlSet can be made as a LinkedHashSet and tried changing the type. It seems to reduce the time taken significantly. v3.0 - ClassLoaderHierarchy.getConnectorClassLoader() -> 1.164 sec. 3.1 (b23 workspace) - ClassLoaderHierarchy.getConnectorClassLoader() -> 1.6+ sec. 3.1 (changed urlSet to LinkedHashSet) - 0.464 sec. Transferring to Sahoo for further investigation.
          Hide
          Jagadish added a comment -

          Created an attachment (id=5112)
          changes to use LinkedHashmap, QL (Web, Classic) passed with these changes

          Show
          Jagadish added a comment - Created an attachment (id=5112) changes to use LinkedHashmap, QL (Web, Classic) passed with these changes
          Hide
          Sanjeeb Sahoo added a comment -

          Thanks Jagadish for the excellent work. As per your email to me, you plan to
          check in the patch, so reassigning to you.

          Show
          Sanjeeb Sahoo added a comment - Thanks Jagadish for the excellent work. As per your email to me, you plan to check in the patch, so reassigning to you.
          Hide
          Jagadish added a comment -

          FIX INFORMATION :

          svn log -v -r 41679
          https://glassfish-svn.dev.java.net/servlets/ReadMsg?list=commits&msgNo=24233

          Fix will be available in 3.1-b25 / 13th-Oct-2010 nightly onwards

          Show
          Jagadish added a comment - FIX INFORMATION : svn log -v -r 41679 https://glassfish-svn.dev.java.net/servlets/ReadMsg?list=commits&msgNo=24233 Fix will be available in 3.1-b25 / 13th-Oct-2010 nightly onwards
          Hide
          Hong Zhang added a comment -

          Verified the fix by looking the numbers on the profiles that Tom collected with
          today's build:

          3.0:
          0. 1.397
          org.glassfish.deployment.common.DeploymentContextImpl.createApplicationClassLoad
          er(org.glassfish.internal.api.ClassLoaderHierarchy,
          org.glassfish.api.deployment.archive.ArchiveHandler)

          3.1:
          0. 0.798
          org.glassfish.deployment.common.DeploymentContextImpl.createApplicationClassLoad
          er(org.glassfish.internal.api.ClassLoaderHierarchy,
          org.glassfish.api.deployment.archive.ArchiveHandler)

          Show
          Hong Zhang added a comment - Verified the fix by looking the numbers on the profiles that Tom collected with today's build: 3.0: 0. 1.397 org.glassfish.deployment.common.DeploymentContextImpl.createApplicationClassLoad er(org.glassfish.internal.api.ClassLoaderHierarchy, org.glassfish.api.deployment.archive.ArchiveHandler) 3.1: 0. 0.798 org.glassfish.deployment.common.DeploymentContextImpl.createApplicationClassLoad er(org.glassfish.internal.api.ClassLoaderHierarchy, org.glassfish.api.deployment.archive.ArchiveHandler)

            People

            • Assignee:
              Jagadish
              Reporter:
              Hong Zhang
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: