java.lang.Object
net.i2p.router.Tuner.BaseParam
net.i2p.router.Tuner.ActivityWindowParam
All Implemented Interfaces:
Tuner.TunableParam
Enclosing class:
Tuner

private class Tuner.ActivityWindowParamextends Tuner.BaseParam
Tunes the peer-selection activity-window multiplier to the recency window that peer supply actually warrants.

The window exists to trade recency for pool thickness when, and only when, the router is short of the peers selection would otherwise use. An earlier version drove it from tunnel.buildSuccessRate instead, which was a category error: build success measures outcomes, not supply, and is depressed just as much by unresponsive peers, build timeouts and unreachable destinations as by an over-tight recency window. Keying the window to it closed a positive feedback loop — worse builds widened the window, admitting older peers, which worsened the builds — and did so while ample fast and high-capacity peers sat unused.

The sole gate is now peer supply, shared with TunnelPeerSelector and the pool starvation bypass so all three callers agree. Above TunnelPeerSelector.SCARCE_FAST_PEERS fast peers the multiplier stays at its floor regardless of build success. The one exception is the startup grace period, where a cold profile set makes every peer look stale for want of test history rather than fault.

Value is a multiplier (1-4) applied to the base activity window.

  • Field Details

    • _healthyCycles

      private int _healthyCycles
      Consecutive cycles observed with ample peer supply, counting toward Tuner.HEALTHY_CYCLES_TO_TIGHTEN. Reset whenever supply is scarce or the router is in its startup grace period, so relief is withdrawn only after sustained evidence that it is no longer needed.
  • Constructor Details

    • ActivityWindowParam

      ActivityWindowParam()
      Creates the parameter that multiplies the peer selection activity window.
  • Method Details

    • applyValue

      protected void applyValue(int value)
      Description copied from class: Tuner.BaseParam
      Apply the tunable value to the router configuration.
      Specified by:
      applyValue in class Tuner.BaseParam
      Parameters:
      value - the tunable value to apply to router configuration
    • getRuntimeValue

      protected int getRuntimeValue()
      Description copied from class: Tuner.BaseParam
      Current runtime value read from the router configuration.
      Specified by:
      getRuntimeValue in class Tuner.BaseParam
      Returns:
      current runtime value read from router config
    • getObservedStat

      protected double getObservedStat(RouterContext ctx)
      Observed stat, retained for the base-class contract and the console cross-reference only. This param no longer gates on it: build success is an outcome, not a measure of peer supply, so widening the recency window in response to it fed back on itself. See the class javadoc.
      Specified by:
      getObservedStat in class Tuner.BaseParam
      Parameters:
      ctx - router context, never null
      Returns:
      the current build success rate, or NaN when unavailable
    • computeTarget

      protected int computeTarget(double observed)
      Compute the target multiplier from peer supply, ignoring the observed build success rate. Ample fast peers pin the window at its floor no matter how degraded builds look. Scarcity, or the startup grace period, is the only thing that widens it.
      Specified by:
      computeTarget in class Tuner.BaseParam
      Parameters:
      observed - build success rate; carried for the base-class contract and deliberately not consulted
      Returns:
      the multiplier to apply