Francisco Chicharro created SLING-3277:
------------------------------------------

             Summary: RequestProcessorMBeanImpl.resetStatistics does not reset 
sum and squared sum variable values
                 Key: SLING-3277
                 URL: https://issues.apache.org/jira/browse/SLING-3277
             Project: Sling
          Issue Type: Bug
          Components: Engine
    Affects Versions: Engine 2.2.10
            Reporter: Francisco Chicharro
            Priority: Minor


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




--
This message was sent by Atlassian JIRA
(v6.1.4#6159)

Reply via email to