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

private class Tuner.TimerThreadsParamextends Tuner.BaseParam
Tunes the global max window size ceiling for all streaming connections. Higher = more in-flight data, higher peak throughput, but more memory and worse loss recovery when congestion hits. Adjusted based on loss, congestion, and memory pressure so the cap lifts off clean paths (letting a fast pipe actually reach it) and only comes back down under hard negative signals, without over-committing memory on constrained routers. The ceiling spans the full streaming range up to the absolute cap (8192, mirroring streaming's ABSOLUTE_MAX_WINDOW) so that on low-RTT, high-bandwidth paths the window can reach ~15.7 MB/s (8192 messages × 1730 bytes / 0.89 s RTT).
  • Constructor Details

    • TimerThreadsParam

      TimerThreadsParam()
      Creates the parameter that tunes the timer thread count.
  • Method Details

    • timerBacklogMs

      private double timerBacklogMs()
      How far behind the timer is running, in ms. Zero when nothing is late.

      This rather than an occupancy or queue-depth reading because an executor whose events run back-to-back looks idle between them: the queue is often empty at any instant while every event is late. The delay is what the router experiences, so it is what the worker count is sized against.

      Returns:
      the worst recent execution delay in ms
    • 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