App Metrics Fork me on GitHub
Show / Hide Table of Contents

Class DefaultForwardDecayingReservoir

A histogram with an exponentially decaying reservoir produces quantiles which are representative of (roughly) the last five minutes of data.

The reservoir is produced by using a forward-decaying reservoir with an exponential weighty towards recent data unlike a Uniform Reservoir which does not provide a sense of recency.

This sampling reservoir can be used when you are interested in recent changes to the distribution of data rather than a median on the lifetime of the histgram.

Inheritance
System.Object
DefaultForwardDecayingReservoir
Namespace:App.Metrics.ReservoirSampling.ExponentialDecay
Assembly:cs.temp.dll.dll
Syntax
public sealed class DefaultForwardDecayingReservoir : IReservoir, IDisposable

Constructors

DefaultForwardDecayingReservoir()

Initializes a new instance of the DefaultForwardDecayingReservoir class.

Declaration
public DefaultForwardDecayingReservoir()
Remarks

The default size and alpha values offer a 99.9% confidence level with a 5% margin of error assuming a normal distribution and heavily biases the reservoir to the past 5 minutes of measurements.

DefaultForwardDecayingReservoir(Int32, Double)

Initializes a new instance of the DefaultForwardDecayingReservoir class.

Declaration
public DefaultForwardDecayingReservoir(int sampleSize, double alpha)
Parameters
Type Name Description
System.Int32 sampleSize

The number of samples to keep in the sampling reservoir.

System.Double alpha

The alpha value, e.g 0.015 will heavily biases the reservoir to the past 5 mins of measurements. The higher the value the more biased the reservoir will be towards newer values.

Remarks

The default size and alpha values offer a 99.9% confidence level with a 5% margin of error assuming a normal distribution and heavily biases the reservoir to the past 5 minutes of measurements.

DefaultForwardDecayingReservoir(Int32, Double, IClock, IScheduler)

Initializes a new instance of the DefaultForwardDecayingReservoir class.

Declaration
public DefaultForwardDecayingReservoir(int sampleSize, double alpha, IClock clock, IScheduler scheduler = null)
Parameters
Type Name Description
System.Int32 sampleSize

The number of samples to keep in the sampling reservoir

System.Double alpha

The alpha value, e.g 0.015 will heavily biases the reservoir to the past 5 mins of measurements. The higher the value the more biased the reservoir will be towards newer values.

IClock clock

The IClock type to use for calculating processing time.

IScheduler scheduler

asdfasf

Properties

Size

Gets the size.

Declaration
public int Size { get; }
Property Value
Type Description
System.Int32

The size.

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Declaration
public void Dispose()
Implements
System.IDisposable.Dispose()

Dispose(Boolean)

Releases unmanaged and - optionally - managed resources.

Declaration
public void Dispose(bool disposing)
Parameters
Type Name Description
System.Boolean disposing

true to release both managed and unmanaged resources; false to release only unmanaged resources.

GetSnapshot()

Declaration
public IReservoirSnapshot GetSnapshot()
Returns
Type Description
IReservoirSnapshot

GetSnapshot(Boolean)

Declaration
public IReservoirSnapshot GetSnapshot(bool resetReservoir)
Parameters
Type Name Description
System.Boolean resetReservoir
Returns
Type Description
IReservoirSnapshot

Rescale()

A common feature of the above techniques—indeed, the key technique that allows us to track the decayed weights efficiently—is that they maintain counts and other quantities based on g(ti − L), and only scale by g(t − L) at query time. But while g(ti −L)/g(t−L) is guaranteed to lie between zero and one, the intermediate values of g(ti − L) could become very large. For polynomial functions, these values should not grow too large, and should be effectively represented in practice by floating point values without loss of precision. For exponential functions, these values could grow quite large as new values of (ti − L) become large, and potentially exceed the capacity of common floating point types. However, since the values stored by the algorithms are linear combinations of g values (scaled sums), they can be rescaled relative to a new landmark. That is, by the analysis of exponential decay in Section III-A, the choice of L does not affect the final result. We can therefore multiply each value based on L by a factor of exp(−α(L′ − L)), and obtain the correct value as if we had instead computed relative to a new landmark L′ (and then use this new L′ at query time). This can be done with a linear pass over whatever data structure is being used."

Declaration
public void Rescale()

Reset()

Declaration
public void Reset()

Update(Int64)

Declaration
public void Update(long value)
Parameters
Type Name Description
System.Int64 value

Update(Int64, String)

Declaration
public void Update(long value, string userValue)
Parameters
Type Name Description
System.Int64 value
System.String userValue
Back to top Copyright © 2017 Allan Hardy
Generated by DocFX