Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-3277

RequestProcessorMBeanImpl.resetStatistics does not reset sum and squared sum variable values

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • Engine 2.2.10
    • Engine 2.3.0
    • Engine
    • None

    Description

      The RequestProcessorMBeanImpl uses the variables: durationMsecSumX and durationMsecSumX2 to store the sum and squared sum of request durations. These variables are used later to calculate the statistics MeanRequestDurationMsec and StandardDeviationDurationMsec.

      To calculate these statistics it uses the mentioned sum and sumX2 variables and the number of requests processed.

      The issue arises when the resetStatistics method is invoked: it resets the number of processed requests to 0, but not the sum and squared sum variables.

      For instance, if you have an accumulated processing time of 10000 msecs and 100 requests, the MeanRequestDurationMsec will be 100 msecs, which is correct.
      If you invoke resetStatistics method at that time, the number of request will be reset to 0 while the sum of request durations will keep being 10000 msecs.
      If next request is processed in 10msecs you will have accumulated a sum of request durations of 10010 msecs and only one request. So the MeanRequestDurationMsec statistic will display 10010msecs, which is wrong.

      The same issue occurs with the statistics for ServletCallCount and PeakRecursionDepth.

      To solve this issue the following variables need to be reset (set to 0) in the resetStatistics method:

      • durationMsecSumX
      • durationMsecSumX2
      • servletCallCountSumX
      • servletCallCountSumX2
      • peakRecursionDepthSumX
      • peakRecursionDepthSumX2

      Attachments

        1. RequestProcessorMBeanImplTest.java
          9 kB
          Francisco Chicharro
        2. RequestProcessorMBeanImpl.java
          6 kB
          Francisco Chicharro

        Activity

          People

            bdelacretaz Bertrand Delacretaz
            fchicharro Francisco Chicharro
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: