Uploaded image for project: 'Nuxeo Studio'
  1. Nuxeo Studio
  2. NXS-4927

Fix ClassLoader locking issues

    XMLWordPrintable

    Details

    • Tags:
    • Sprint:
      NOS 10.3.6
    • Story Points:
      2

      Description

      On 09/20/2018 we experienced performance issues, seemingly related to a "coarse lock" in Tomcat's classLoader. eg:

      pool-1002-thread-24 - priority:5 - threadId:0x00007f3f00459800 - nativeId:0x2ee - state:BLOCKED
      stackTrace:
      java.lang.Thread.State: BLOCKED (on object monitor)
      at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1769)
      - waiting to lock <0x00000005c0023fe8> (a org.nuxeo.runtime.tomcat.NuxeoWebappClassLoader)
      at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)
      at com.thoughtworks.xstream.core.util.CompositeClassLoader.loadClass(CompositeClassLoader.java:136)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:348)
      at com.thoughtworks.xstream.XStream.buildMapperDynamically(XStream.java:623)
      at com.thoughtworks.xstream.XStream.buildMapper(XStream.java:596)
      at com.thoughtworks.xstream.XStream.<init>(XStream.java:568)
      at com.thoughtworks.xstream.XStream.<init>(XStream.java:496)
      at com.thoughtworks.xstream.XStream.<init>(XStream.java:465)
      at com.thoughtworks.xstream.XStream.<init>(XStream.java:411)
      at com.thoughtworks.xstream.XStream.<init>(XStream.java:378)
      at com.nuxeo.studio.core.builders.AbstractFeatureBuilder$1.<init>(AbstractFeatureBuilder.java:104)
      at com.nuxeo.studio.core.builders.AbstractFeatureBuilder.getBareXStream(AbstractFeatureBuilder.java:104)
      at com.nuxeo.studio.core.builders.AbstractFeatureBuilder.initializeXStream(AbstractFeatureBuilder.java:139)
      at com.nuxeo.studio.core.builders.AbstractFeatureBuilder.getXStream(AbstractFeatureBuilder.java:180)
      at com.nuxeo.studio.core.builders.AbstractFeatureBuilder.read(AbstractFeatureBuilder.java:187)
      at com.nuxeo.studio.core.builders.AbstractFeatureBuilder.readFile(AbstractFeatureBuilder.java:199)
      at com.nuxeo.studio.core.buildservices.FeatureServiceImpl.getFeature(FeatureServiceImpl.java:229)
      at com.nuxeo.studio.core.buildservices.FeatureServiceImpl.lambda$getFeatures$0(FeatureServiceImpl.java:309)
      at com.nuxeo.studio.core.buildservices.FeatureServiceImpl$$Lambda$141/1237593768.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at java.lang.Thread.run(Thread.java:748)
      

      To reduce the risk of congestion on the class loader lock, we should reduce the number of threads using it.

      In FeatureServiceImpl#getFeatures), we are spawning threads to parse the features in parallel. For almost every project, we end up creating at least 24 threads due to how the number is computed.

      We propose instead that we use the fixed number of 8 threads for each project, and consider a small project to have under 80 features.

      These values could be tweaked in the future.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 days
                  2d