Uploaded image for project: 'Jackrabbit Oak'
  1. Jackrabbit Oak
  2. OAK-4483

Remove synchronized access requirement from MetricStatisticsProvider#getStats

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.4
    • 1.4.4, 1.5.4, 1.6.0
    • core
    • None

    Description

      MetricStatisticsProvider makes getStats as synchronized. This can cause contention in concurrent scenarios specially when lots of Sessions are created as the stats instance are looked at time of session creation

      "qtp618865225-3444" #3444 prio=5 os_prio=0 tid=0x00007f7fe5083800 nid=0x7629 waiting for monitor entry [0x00007f7fdb9f7000]
         java.lang.Thread.State: BLOCKED (on object monitor)
      	at org.apache.jackrabbit.oak.plugins.metric.MetricStatisticsProvider.getStats(MetricStatisticsProvider.java:129)
      	- waiting to lock <0x00000003c1bfb1d0> (a org.apache.jackrabbit.oak.plugins.metric.MetricStatisticsProvider)
      	at org.apache.jackrabbit.oak.plugins.metric.MetricStatisticsProvider.getCounterStats(MetricStatisticsProvider.java:107)
      	at org.apache.jackrabbit.oak.stats.StatisticManager.getStatsCounter(StatisticManager.java:99)
      	at org.apache.jackrabbit.oak.jcr.session.SessionStats.<init>(SessionStats.java:83)
      	at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.<init>(SessionDelegate.java:150)
      	at org.apache.jackrabbit.oak.jcr.repository.RepositoryImpl$1.<init>(RepositoryImpl.java:301)
      	at org.apache.jackrabbit.oak.jcr.repository.RepositoryImpl.createSessionDelegate(RepositoryImpl.java:299)
      	at org.apache.jackrabbit.oak.jcr.repository.RepositoryImpl.login(RepositoryImpl.java:281)
      	at com.adobe.granite.repository.impl.CRX3RepositoryImpl.login(CRX3RepositoryImpl.java:94)
      

      Instead of current approach it should use ConcurrentHashMap and still ensure that duplicate metric instance did not get created

      Attachments

        Activity

          People

            chetanm Chetan Mehrotra
            chetanm Chetan Mehrotra
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: