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

private class Tuner.StreamingReceiveWorkersParamextends Tuner.BaseParam
Tunes inbound packet receive worker shards (i2p.streaming.receiveWorkerThreads). Grows the per-destination dispatch pool while producers are blocked on a full receive shard queue (throughput: a slow connection no longer stalls the session notifier, more connections are processed in parallel), and reclaims threads when the shard queue stays near-empty (latency: only as many threads as the traffic needs). Refuses to shrink while the path is lossy so retransmission traffic keeps its dispatch capacity (reliability). Live dispatchers are resized immediately via I2PSocketManagerFull.resizeReceiveWorkers. Primary signal: stream.receiveBacklogged. Cross-refs: stream.receiveQueueDepth, stream.rtxRatio, jobQueue.jobLag.
  • Constructor Details

    • StreamingReceiveWorkersParam

      StreamingReceiveWorkersParam()
      Creates the parameter that tunes the streaming receive worker threads.
  • Method Details

    • applyValue

      protected void applyValue(int value)
      Apply the tunable value to the worker default and every live dispatcher.
      Specified by:
      applyValue in class Tuner.BaseParam
      Parameters:
      value - the tunable value to apply to router configuration
    • getRuntimeValue

      protected int getRuntimeValue()
      Current live worker default; falls back to the core-derived count.
      Specified by:
      getRuntimeValue in class Tuner.BaseParam
      Returns:
      current runtime value read from router config
    • getObservedStat

      protected double getObservedStat(RouterContext ctx)
      Read the observed stat (receiveBacklogged avg per period). Returns NaN only when there is no inbound packet traffic at all, so a healthy router with light traffic still reaches the reclaim decision: with no backlog events but live queue-depth observations, the cycle runs with observed == 0, letting computeTarget shrink a pool that has stopped blocking.
      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