nicmichael opened a new pull request #2054: Issue 2053: Bugfix for Percentile 
Calculation in FastCodahale Timer Implementation
URL: https://github.com/apache/bookkeeper/pull/2054
 
 
   This bugfix for the FastCodahale timer implementation ensures that 
percentiles provided by a FastSnapshot are calculated correctly even if the 
total count of events (provided by FastTimer) is out of sync with the recorded 
events in the percentile buckets.
   
   ### Motivation
   
   FastCodahale Timer implementation may miscalculate percentiles if snapshots 
of values are slightly out of sync, and if only few events have been recorded.
   
   FastCodahale Timers use fine-grained locking and are meant to tolerate that 
(some) values change while being recorded or while snapshots are created. 
Currently, the total count of requests is not synchronized with the number of 
requests recorded in percentile buckets. If a snapshot is created while the 
total count of the timer has been incremented beyond the sum of values in the 
percentile buckets, the percentile calculation may produce wrong values.
   
   For example, if 3 percentile values have been recorded, but the overall 
count is 4, then the percentile calculation would be based on 4 values. This 
becomes most obvious if a percentile > .75 (e.g. p95) is being calculated. For 
this, the implementation will try to find 0.95 * 4 values, which is more than 
the 3 values recorded in the buckets. Since no bucket fulfills the criteria, 
the bound of the last (overflow) bucket will be returned, i.e. Long.MAX_VALUE.
   
   ### Changes
   
   FastSnapshots now bases the percentile calculation on the sum of values in 
the percentile buckets rather than a count provided by the caller (i.e. 
FastTimer). This ensures that percentiles are calculated correctly without the 
need of having all counters fully synchronized.
   
   Master Issue: #2053 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to