You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Bertrand Delacretaz (JIRA)" <ji...@apache.org> on 2013/12/11 11:37:09 UTC

[jira] [Resolved] (SLING-3277) RequestProcessorMBeanImpl.resetStatistics does not reset sum and squared sum variable values

     [ https://issues.apache.org/jira/browse/SLING-3277?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bertrand Delacretaz resolved SLING-3277.
----------------------------------------

       Resolution: Fixed
    Fix Version/s: Engine 2.2.12
         Assignee: Bertrand Delacretaz

Committed your patch and tests in http://svn.apache.org/r1550098, thanks very much for your contribution!

If you have more patches to suggest, we prefer svn diff format if possible. In this case the changes were sufficiently small to be usable as you provided them.

> 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
>            Assignee: Bertrand Delacretaz
>            Priority: Minor
>             Fix For: Engine 2.2.12
>
>         Attachments: RequestProcessorMBeanImpl.java, RequestProcessorMBeanImplTest.java
>
>
> 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)