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

private class Tuner.MessageProcessingThrottleParamextends Tuner.BaseParam
Threshold for the message-processing-latency transit throttle (router.defaultProcessingTimeThrottle, read by RouterThrottleImpl). When the 1-minute sendProcessingTime average stays above this for the sustain window, tunnel requests are rejected as transient overload.

The target tracks the router's *stable* processing baseline (10-minute average), not the live spiking value, so a router that routinely runs at higher latency raises its own threshold instead of throttling on its normal (recoverable) load — while a router under genuine, sustained congestion still trips the throttle. Floor/ceiling keep protection on.

  • Field Details

    • THROTTLE_TARGET_STAT

      private static final String THROTTLE_TARGET_STAT
      The raw target the formula produces, recorded as a rate stat.

      This exists because the units of the Tuner's raw integers were only ever inferred: the logged clamp showed target 1500 against min 2000, and observed 38-55 ms, and those two are consistent with 0.1 ms units (making the min 200 ms) or with ms units and a different reading, but not with both at once. A stat whose value is the target as computed settles it from the next window instead of another round of inference.

      See Also:
  • Constructor Details

    • MessageProcessingThrottleParam

      MessageProcessingThrottleParam()
      Creates the parameter that tunes the message processing time throttle in ms.
  • 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)
      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)
      Description copied from class: Tuner.BaseParam
      Target tunable value computed from the observed stat.
      Specified by:
      computeTarget in class Tuner.BaseParam
      Parameters:
      observed - current stat value
      Returns:
      target tunable value