public class Tuner extends SimpleTimer2.TimedEvent
Runs every 30 seconds via SimpleTimer2. Each parameter
implements an AIMD-style feedback loop bounded within safe ranges:
New parameters are added by extending Tuner.BaseParam and
implementing:
applyValue(int) — push value to router subsystemgetRuntimeValue() — read current value from subsystemgetObservedStat(RouterContext) — read primary signalcomputeTarget(double) — feedback logic with cross-refsParams can be tuned live via the console UI or persisted to
autotune.config (separate from router.config).
Auto-revert to factory defaults triggers when system health drops
below 0.3.
| Modifier and Type | Class and Description |
|---|---|
static class | Tuner.AutotuneConfigManages the autotune.config file — separate from router.config. |
(package private) static class | Tuner.BaseParamBase class for tunable params with history tracking and auto-revert. |
static class | Tuner.ParamSnapshotSnapshot of a subsystem's tunable parameter values at a point in time. |
static class | Tuner.SubsystemScorePer-subsystem health scores. |
(package private) static class | Tuner.SystemHealthTracks overall router health score for adaptive tuning decisions. |
static interface | Tuner.TunableParamA tunable parameter with name, description, bounds, and default value. |
| Modifier and Type | Field and Description |
|---|---|
(package private) static int | MAX_HISTORYMax history samples for sparklines (30 samples @ 30s = 15min) |
(package private) static String | PROP_PREFIXProperty prefix for tuner ranges. |
(package private) static long | STAT_PERIODPeriod for short-term bandwidth stats. |
(package private) static long | STAT_PERIOD_LONGPeriod for long-term bandwidth stats. |
static String | SUB_CONGESTIONCongestion subsystem identifier. |
static String | SUB_CRYPTOCrypto subsystem identifier. |
static String | SUB_I2CPI2CP subsystem identifier. |
static String | SUB_NETDBNetDB subsystem identifier. |
static String | SUB_PEERPeers subsystem identifier. |
static String | SUB_ROUTERRouter subsystem identifier. |
static String | SUB_STREAMINGStreaming subsystem identifier. |
static String | SUB_TRANSITTransit subsystem identifier. |
static String | SUB_TRANSPORTSubsystem labels for grouping in the UI |
static String | SUB_TUNNELTunnel subsystem identifier. |
_state, DEFAULT_FUZZ| Constructor and Description |
|---|
Tuner(RouterContext ctx)Set up the tuner with all tunable parameters. |
| Modifier and Type | Method and Description |
|---|---|
static void | adjustHandlerPriority()Adjust the current thread's priority to the target handler priority. |
Tuner.AutotuneConfig | getAutotune()Shared AutotuneConfig instance. |
static int | getBuildFailureBuffer()The build failure buffer. |
static int | getHandlerThreadPriority()The handler thread priority. |
double | getHealthScore()Latest system health score (0.0 = worst, 1.0 = perfect). |
static int | getInternalQueueSize()The I2CP internal queue size. |
static int | getMaxDispatchAgeMs()The max dispatch age in ms. |
(package private) static double | getMemoryPressure()Returns current heap memory pressure as a ratio from 0.0 (no pressure)
to 1.0 (heap full). |
Tuner.TunableParam | getParam(String name)Tunable param by name. |
List<Tuner.ParamSnapshot> | getSnapshots()Snapshots of all tunable params. |
List<Tuner.SubsystemScore> | getSubsystemScores()Per-subsystem health scores computed during the last tuning cycle. |
static int | getTestClientBudget()The test client budget. |
static int | getTestRetestBackoff()The test retest backoff. |
void | restoreDefaults()Restore all params to factory defaults (code-level, not persisted) |
(package private) static int | scaleForSystem(int base,
int hardMin,
int hardMax)Compute a system-scaled value: base * factor, bounded by min and max. |
static void | setInternalQueueSize(int size)Set the I2CP internal queue size (called by Tuner). |
void | setOverride(String name,
int value)Set an override value for a param. |
void | shutdown()Flush on shutdown — unconditional write if dirty |
void | timeReached()Expire entries and reschedule the next check. |
cancel, forceReschedule, reschedule, reschedule, run, schedule, setFuzz, setPool, toStringstatic final int MAX_HISTORY
static final String PROP_PREFIX
static final long STAT_PERIOD
static final long STAT_PERIOD_LONG
public static final String SUB_CONGESTION
public static final String SUB_CRYPTO
public static final String SUB_I2CP
public static final String SUB_NETDB
public static final String SUB_PEER
public static final String SUB_ROUTER
public static final String SUB_STREAMING
public static final String SUB_TRANSIT
public static final String SUB_TRANSPORT
public static final String SUB_TUNNEL
public Tuner(RouterContext ctx)
ctx - the router contextpublic static void adjustHandlerPriority()
public Tuner.AutotuneConfig getAutotune()
public static int getBuildFailureBuffer()
public static int getHandlerThreadPriority()
public double getHealthScore()
public static int getInternalQueueSize()
public static int getMaxDispatchAgeMs()
static double getMemoryPressure()
public Tuner.TunableParam getParam(String name)
name - the param namepublic List<Tuner.ParamSnapshot> getSnapshots()
public List<Tuner.SubsystemScore> getSubsystemScores()
public static int getTestClientBudget()
public static int getTestRetestBackoff()
public void restoreDefaults()
static int scaleForSystem(int base,
int hardMin,
int hardMax)public static void setInternalQueueSize(int size)
size - the queue sizepublic void setOverride(String name, int value)
name - the param namevalue - the override valuepublic void shutdown()
public void timeReached()
timeReached in class SimpleTimer2.TimedEvent