[ 
https://issues.apache.org/jira/browse/SLING-2361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13185516#comment-13185516
 ] 

Felix Meschberger commented on SLING-2361:
------------------------------------------

We could inline but the dependencies are tremendous (kind of) and the 
replacement code is dead simple:

        double delta = value - this.mean;
        this.mean = this.mean + delta / this.n;
        if (n > 1) {
            this.m2 += delta * (value - this.mean);
        }
        this.sigma = this.m2 / this.n;

Where this.m2 is a helper variable, this.mean is the cumulated mean value and 
this.sigma is the cumulated variance.
                
> Drop commons.math dependency
> ----------------------------
>
>                 Key: SLING-2361
>                 URL: https://issues.apache.org/jira/browse/SLING-2361
>             Project: Sling
>          Issue Type: Improvement
>          Components: Engine
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>             Fix For: Engine 2.2.6
>
>
> As of Rev. 1138159 (SLING-1476) the RequestProcessorMBeanImpl exists to 
> convey Sling request processing statistics. For the mean and variance values 
> the Commons Math SynchronizedSummaryStatistics class is used.
> IMHO this is quite a heavy dependency for such a simple computation (well, 
> the mathematics behind this are not simple, at least not to me ;-) ). So I 
> suggest we in lie a simple continuously updating algorithm into the 
> addRequestDuration method, which is modified to be synchronized.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to