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

private class Tuner.SendPoolCapacityParamextends Tuner.BaseParam
Tunes NTCP send pool capacity based on peer count, latency, backlog, and eviction rate.

The send pool is the shared handoff buffer between producer threads (I2CP handlers, tunnel gateways) and the EventPumper dispatch path. With priority eviction, lower-priority transit messages are evicted to make room for client data — but excessive evictions signal undersizing.

Signals:

  • Primary: ntcp.sendPool.utilization (pct 0–100)
  • Cross-ref: transport.sendProcessingTime (latency), active peers count
  • Cross-ref: ntcp.sendFinisher.queueSize (backlog), udp.sendConfirmTime (RTT)
  • Cross-ref: transport.sendPool.evicted (eviction rate)
  • Constructor Details

    • SendPoolCapacityParam

      SendPoolCapacityParam()
      Creates the parameter that tunes the NTCP send pool capacity.
  • Method Details

    • getDefaultMin

      protected int getDefaultMin(RouterContext ctx)
      Description copied from class: Tuner.BaseParam
      Effective default min — override for bandwidth-scaled params. Called by Tuner.BaseParam.refreshRanges(RouterContext) instead of _defaultMin.
      Overrides:
      getDefaultMin in class Tuner.BaseParam
      Parameters:
      ctx - router context passed by refreshRanges, for bandwidth-scaled overrides
      Returns:
      the default min
    • getDefaultMax

      protected int getDefaultMax(RouterContext ctx)
      Description copied from class: Tuner.BaseParam
      Effective default max — override for bandwidth-scaled params. Called by refreshRanges() instead of _defaultMax.
      Overrides:
      getDefaultMax in class Tuner.BaseParam
      Parameters:
      ctx - router context passed by refreshRanges, for bandwidth-scaled overrides
      Returns:
      the default max
    • 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)
      Description copied from class: Tuner.BaseParam
      Observed stat value used for autotuning.

      ctx is always this param's own context: Tuner takes a single RouterContext, hands the same instance to every BaseParam constructor, and both call sites pass Tuner.BaseParam._ctx. It was previously passed as null, 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 either ctx or Tuner.BaseParam._ctx; both are the same object.

      Specified by:
      getObservedStat in class Tuner.BaseParam
      Parameters:
      ctx - router context, never null
      Returns:
      observed stat value for autotuning
    • computeTarget

      protected int computeTarget(double observed)
      Compute target value based on observed stat and configured limits.
      Specified by:
      computeTarget in class Tuner.BaseParam
      Parameters:
      observed - current stat value
      Returns:
      target tunable value