Top Description Fields Constructors Methods
io.rsocket.loadbalance

public Class BaseWeightedStats

extends Object
implements WeightedStats
Class Inheritance
All Implemented Interfaces
io.rsocket.loadbalance.WeightedStats
Known Direct Subclasses
io.rsocket.loadbalance.WeightedStatsRequestInterceptor
Imports
io.rsocket.util.Clock, java.util.concurrent.TimeUnit, java.util.concurrent.atomic.AtomicIntegerFieldUpdater

Implementation of WeightedStats that manages tracking state and exposes the required stats.

A sub-class or a different class (delegation) needs to call startStream(), stopStream(), startRequest(), and stopRequest(long) to drive state tracking.

Since
1.1
See Also
WeightedStatsRequestInterceptor

Field Summary

Modifier and TypeField and Description
private final Ewma
private static final double
private static final long
private static final double
private long
private long
private final Quantile
private static final int
private final long
private final Ewma
private final Quantile
private final Median
private static final AtomicIntegerFieldUpdater<BaseWeightedStats>
private static final AtomicIntegerFieldUpdater<BaseWeightedStats>
private volatile int
private volatile int
private long
private long
private static final double
private final long

Constructor Summary

AccessConstructor and Description
protected
private
BaseWeightedStats(Quantile lowerQuantile, Quantile higherQuantile, long inactivityFactor)

Method Summary

Modifier and TypeMethod and Description
public double
pack-priv long
instantaneous(long now, int pending)

public double
public int
public double
pack-priv synchronized void
record(double roundTripTime)

pack-priv synchronized long
pack-priv void
pack-priv synchronized long
stopRequest(long timestamp)

pack-priv void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
pack-priv void
updateAvailability(double value)

public double
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

availabilityPercentageback to summary
private final Ewma availabilityPercentage
DEFAULT_HIGHER_QUANTILEback to summary
private static final double DEFAULT_HIGHER_QUANTILE
DEFAULT_INITIAL_INTER_ARRIVAL_TIMEback to summary
private static final long DEFAULT_INITIAL_INTER_ARRIVAL_TIME
DEFAULT_LOWER_QUANTILEback to summary
private static final double DEFAULT_LOWER_QUANTILE
durationback to summary
private long duration
errorStampback to summary
private long errorStamp
higherQuantileback to summary
private final Quantile higherQuantile
INACTIVITY_FACTORback to summary
private static final int INACTIVITY_FACTOR
inactivityFactorback to summary
private final long inactivityFactor
interArrivalTimeback to summary
private final Ewma interArrivalTime
lowerQuantileback to summary
private final Quantile lowerQuantile
medianback to summary
private final Median median
PENDING_REQUESTSback to summary
private static final AtomicIntegerFieldUpdater<BaseWeightedStats> PENDING_REQUESTS
PENDING_STREAMSback to summary
private static final AtomicIntegerFieldUpdater<BaseWeightedStats> PENDING_STREAMS
pendingRequestsback to summary
private volatile int pendingRequests
pendingStreamsback to summary
private volatile int pendingStreams
stampback to summary
private long stamp
stamp0back to summary
private long stamp0
STARTUP_PENALTYback to summary
private static final double STARTUP_PENALTY
tauback to summary
private final long tau

Constructor Detail

BaseWeightedStatsback to summary
protected BaseWeightedStats()
BaseWeightedStatsback to summary
private BaseWeightedStats(Quantile lowerQuantile, Quantile higherQuantile, long inactivityFactor)

Method Detail

higherQuantileLatencyback to summary
public double higherQuantileLatency()

Implements io.rsocket.loadbalance.WeightedStats.higherQuantileLatency.

Annotations
@Override
instantaneousback to summary
pack-priv long instantaneous(long now, int pending)
lowerQuantileLatencyback to summary
public double lowerQuantileLatency()

Implements io.rsocket.loadbalance.WeightedStats.lowerQuantileLatency.

Annotations
@Override
pendingback to summary
public int pending()

Implements io.rsocket.loadbalance.WeightedStats.pending.

Annotations
@Override
predictedLatencyback to summary
public double predictedLatency()

Implements io.rsocket.loadbalance.WeightedStats.predictedLatency.

Annotations
@Override
recordback to summary
pack-priv synchronized void record(double roundTripTime)
startRequestback to summary
pack-priv synchronized long startRequest()
startStreamback to summary
pack-priv void startStream()
stopRequestback to summary
pack-priv synchronized long stopRequest(long timestamp)
stopStreamback to summary
pack-priv void stopStream()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
updateAvailabilityback to summary
pack-priv void updateAvailability(double value)
weightedAvailabilityback to summary
public double weightedAvailability()

Implements io.rsocket.loadbalance.WeightedStats.weightedAvailability.

Annotations
@Override