- All Implemented Interfaces:
Tuner.TunableParam
- Enclosing class:
Tuner
Field Summary
FieldsModifier and TypeFieldDescriptionprivate doubleClose time of the loss window this decision was last taken on.private intConsecutive windows in the climb direction.private intConsecutive windows in the shrink direction.Fields inherited from class Tuner.BaseParam
_autotune, _autoTuning, _cpuDriven, _ctx, _defaultMax, _defaultMin, _defaultStep, _defaultValue, _description, _effMax, _factoryDefault, _firstTick, _health, _historyCount, _initialValue, _log, _max, _min, _name, _override, _propPrefix, _statHistory, _statName, _step, _subsystem, _valueHistory, sharedAutotuneModifier and TypeFieldDescriptionprotected final Tuner.AutotuneConfigAutotune profile for this tunable parameter.protected booleanWhether autotuning is active for this parameter.protected booleanWhether this param's value is being driven by CPU load rather than its own stat.protected final RouterContextRouter context.protected final intDefault maximum value from code or config.protected final intDefault minimum value from code or config.protected final intDefault step/increment size for adjustments.protected intFactory default: value before any tuning.protected final StringHuman-readable label for display in the Tuner UI.protected intEffective ceiling = min(_max, memory-derived bound); never exceeds _max.protected final intCode-level default captured at construction time.protected booleanTrue until firstTuner.BaseParam.update()call — applies persisted value from autotune.config.protected Tuner.SystemHealthHealth score and subsystem for autotune decisions.protected intNumber of valid entries in _valueHistory / _statHistory.protected final intLast known value (from persistence or runtime default).protected final LogClass logger.protected intCurrent maximum value (may differ from default after tuning).protected intCurrent minimum value (may differ from default after tuning).protected final StringInternal config property key (e.g.protected intUser-set override value, or Integer.MIN_VALUE if unset.protected final StringConfig key prefix for property lookups.protected final double[]Rolling window of recent stat values for trend analysis.protected final StringRouter stat name for observed value feedback.protected intCurrent step/increment size (may differ from default).protected final StringSubsystem identifier this parameter belongs to.protected final int[]Rolling window of recent tunable values for trend analysis.(package private) static Tuner.AutotuneConfigShared instance — set once in Tuner constructor, used by all BaseParams.Constructor Summary
ConstructorsConstructorDescriptionCreates the parameter that tunes the streaming max window size.Method Summary
Private MethodsModifier and TypeMethodDescriptionprotected voidapplyValue(int value) Apply the tunable value to the router configuration.private doubleMean size in bytes of a retransmitted message, or NaN when unread.protected intcomputeTarget(double observed) Target tunable value computed from the observed stat.protected StringName the gate that decided the ceiling's direction.protected doubleObserved stat value used for autotuning.protected intCurrent runtime value read from the router configuration.private doubleThe true byte-weighted retransmission rate: total bytes resent divided by total bytes sent over the window.Methods inherited from class Tuner.BaseParam
clamp, getAdditionalEventCount, getAdditionalEventCountHourly, getAdditionalStat, getAdditionalStat5Min, getAdditionalStatHourly, getAdditionalStatLong, getBuildSuccessRate, getCoDelDropEventCount, getCurrentValue, getDefaultMax, getDefaultMin, getDefaultStep, getDefaultValue, getDescription, getHeavyTransitThreshold, getMax, getMessageReceiverUtilization, getMin, getName, getObservedRTT, getPacketHandlerUtilization, getPumperUtilization, getReaderUtilization, getSendFinisherUtilization, getShareBps, getStatHistory, getStatPeriodStamp, getStep, getStreamingLossRate, getSubsystem, getSustainedHeavyTransitThreshold, getValueHistory, getWriterUtilization, isAutoTuning, persistValue, reclaimIfIdle, recordHistory, refreshDefault, refreshRanges, setHealth, setOverride, signalIsFresh, snapshot, updateModifier and TypeMethodDescriptionprotected static intclamp(int current, int target, int step) Move from current toward target, but at most one step per cycle.protected doublegetAdditionalEventCount(RouterContext ctx, String statName) Fetch the event count for an additional stat using the 60s period.protected doublegetAdditionalEventCountHourly(RouterContext ctx, String statName) Fetch the event count for an additional stat using the 1-hour period.protected doublegetAdditionalStat(RouterContext ctx, String statName) Fetch an additional stat value for cross-reference decisions.protected doublegetAdditionalStat5Min(RouterContext ctx, String statName) Fetch an additional stat value using the 5-minute average.protected doublegetAdditionalStatHourly(RouterContext ctx, String statName) Fetch an additional stat value using the 1-hour average.protected doublegetAdditionalStatLong(RouterContext ctx, String statName) Fetch an additional stat value using the 10-minute average.protected doubleCompute actual tunnel build success rate from event counts.protected doublegetCoDelDropEventCount(RouterContext ctx, String prefix) Fetch the total CoDel drop event count across all priority levels.intThe value in effect right now.protected intEffective default max — override for bandwidth-scaled params.protected intEffective default min — override for bandwidth-scaled params.protected intEffective default step — override for bandwidth-scaled params.intDefault value.Param description.protected static intTransit bandwidth threshold for "heavy" — 80% of configured share bandwidth.intgetMax()Maximum value.protected doubleUDP message receiver pool utilization (0.0-1.0).intgetMin()Minimum value.getName()Param name.protected doublegetObservedRTT(RouterContext ctx, String primaryStat) Fetch observed RTT, falling back toudp.sendConfirmTimewhen the primary stat has no events (lightly loaded router).protected doubleUDP packet handler pool utilization (0.0-1.0).protected doubleTunnel pumper pool utilization (0.0-1.0).protected doubleNTCP reader pool utilization (0.0-1.0).protected doubleNTCP send finisher pool utilization (0.0-1.0).protected static intgetShareBps(RouterContext ctx) Current share bandwidth in bytes per second.double[]Rolling window of recent stat values.protected doublegetStatPeriodStamp(RouterContext ctx, String statName) When the window behind a stat's event count last completed, in ms, or NaN when it cannot be determined.intgetStep()Step size.protected doubleRecent streaming retransmission rate for this tuning cycle.Subsystem name.protected static intTransit bandwidth threshold for "sustained heavy" — 50% of configured share.int[]Rolling window of recent tunable values.protected doubleNTCP writer pool utilization (0.0-1.0).booleanWhether auto-tuning is enabled.protected voidpersistValue(RouterContext ctx, int value) Persist a tuned value to autotune.config.protected static intreclaimIfIdle(double utilization, int current, int min, double idleThreshold) Reclaim parked threads from a thread pool that is massively under-utilized.protected voidrecordHistory(double observed) Record history.voidRe-read the default value from autotune.config for live updates.voidRe-read min/max/step from autotune.config — live update, no restart.(package private) voidsetHealth(Tuner.SystemHealth health) The current system health score for this update cycle.voidsetOverride(int value) A manual override value.(package private) static booleansignalIsFresh(double periodStamp, double lastStamp) Whether a signal reading is from a window that closed since the stored stamp.snapshot()Capture snapshot of current tunable state for display.voidupdate()Main tuning loop for this param.
Field Details
_lastLossStamp
private double _lastLossStampClose time of the loss window this decision was last taken on._riseShrink
private int _riseShrinkConsecutive windows in the shrink direction._riseClimb
private int _riseClimbConsecutive windows in the climb direction.
Constructor Details
MaxWindowSizeParam
MaxWindowSizeParam()Creates the parameter that tunes the streaming max window size.
Method Details
applyValue
protected void applyValue(int value) Description copied from class:Tuner.BaseParamApply the tunable value to the router configuration.- Specified by:
applyValuein classTuner.BaseParam- Parameters:
value- the tunable value to apply to router configuration
getRuntimeValue
protected int getRuntimeValue()Description copied from class:Tuner.BaseParamCurrent runtime value read from the router configuration.- Specified by:
getRuntimeValuein classTuner.BaseParam- Returns:
- current runtime value read from router config
getObservedStat
Description copied from class:Tuner.BaseParamObserved stat value used for autotuning.ctxis always this param's own context:Tunertakes a singleRouterContext, hands the same instance to everyBaseParamconstructor, and both call sites passTuner.BaseParam._ctx. It was previously passed asnull, which silently broke any implementation that used the argument instead of the field — a param reading a cross-reference stat then threw on every tuning cycle, was caught by the cycle handler, and never tuned at all, with nothing but a repeated WARN to show for it. Implementations may use eitherctxorTuner.BaseParam._ctx; both are the same object.- Specified by:
getObservedStatin classTuner.BaseParam- Parameters:
ctx- router context, never null- Returns:
- observed stat value for autotuning
computeTarget
protected int computeTarget(double observed) Description copied from class:Tuner.BaseParamTarget tunable value computed from the observed stat.- Specified by:
computeTargetin classTuner.BaseParam- Parameters:
observed- current stat value- Returns:
- target tunable value
decisionReason
Name the gate that decided the ceiling's direction.Reads the same three signals
computeTarget(double)decides from. Asked only on a cycle that moves the value, so the extra reads cost nothing.- Overrides:
decisionReasonin classTuner.BaseParam- Returns:
- the reason, or null when the param has nothing to report
averageDuplicateMessageSize
private double averageDuplicateMessageSize()Mean size in bytes of a retransmitted message, or NaN when unread.The discriminator the two loss ratios cannot supply. The event-count ratio counts every resend alike and the byte ratio weights by bytes, so their divergence says the two disagree but not whether the resends are small control-plane messages that a byte-in-flight window can ignore or real payload that it cannot. This is the size of an average resend.
Both inputs are recorded at the same stream-close event over the same 5-minute window, so the two window means divide into the size. The byte figure cannot be recovered from
stream.rtxRatioBytes: that stat records 1000*dupBytes/bytesSent per close, so its mean is a mean of per-stream ratios and dividing it into anything to get a size is invalid.Bounded by the streams that closed inside the window, so it is a closure-biased lifetime figure rather than a true traffic-rate one: one long stream closing in the window contributes its whole lifetime.
- Returns:
- bytes per retransmitted message, or NaN when either input is absent
trueByteWeightedLossRate
private double trueByteWeightedLossRate()The true byte-weighted retransmission rate: total bytes resent divided by total bytes sent over the window.Unlike
stream.rtxRatioBytesthis is not a mean of per-connection ratios. That stat records 1000*dupBytes/bytesSent once per closed connection, so its window mean is a mean of ratios: a three-message connection that resent everything counts the same as a three-thousand-message connection that resent one record, and on this router it reads 3.47 % while the byte-weighted figure reads 39-58 %. This method divides the window's total resent bytes by its total sent bytes, so a connection that carried most of the bytes in the window carries most of the weight — the quantity a byte-in-flight ceiling actually needs.Both inputs are recorded at the same stream-close event over the same 5-minute window, so the two window means divide into a rate.
Bounded by the streams that closed inside the window, so it is a closure-biased lifetime figure rather than a true traffic-rate one: one long stream closing in the window contributes its whole lifetime.
- Returns:
- the byte-weighted rate 0.0-1.0, or NaN when either input is absent