public class ParticipatingThrottler extends Object
| Modifier and Type | Class and Description |
|---|---|
static class | ParticipatingThrottler.ResultResult of throttling decision for tunnel participation requests. |
| Modifier and Type | Field and Description |
|---|---|
static int | _loadWeightLoad weight: how much load inflates effective ratio (0-300%, default 100%). |
static int | _maxLimitMax tunnels per peer before throttling. |
static int | _minLimitMin tunnels per peer before throttling. |
static int | _percentLimitMax pct of participating tunnels per peer. |
static int | _rejectSteepnessRejection steepness: 100=linear ramp, 200=quadratic, higher=faster escalation. |
static int | _rejectThresholdRejection threshold: start rejecting at count/limit ratio this high (30-100, default 70%). |
| Constructor and Description |
|---|
ParticipatingThrottler(RouterContext ctx)Participating throttler |
| Modifier and Type | Method and Description |
|---|---|
(package private) static float | calculateLoadScore(RouterContext context)Computes a 0.0–1.0 load score from job queue lag, CPU load, system load,
and bandwidth queue pressure. |
static int | getLoadWeight()The load weight. |
static int | getParticipatingMaxLimit()The participating maximum limit. |
static int | getParticipatingMinLimit()The participating minimum limit. |
static int | getParticipatingPctLimit()The participating percent limit. |
static int | getRejectSteepness()The rejection steepness. |
static int | getRejectThreshold()The rejection threshold. |
static void | setLoadWeight(int val)The load weight. |
static void | setParticipatingMaxLimit(int val)The participating maximum limit. |
static void | setParticipatingMinLimit(int val)The participating minimum limit. |
static void | setParticipatingPctLimit(int val)The participating percent limit. |
static void | setRejectSteepness(int val)The rejection steepness. |
static void | setRejectThreshold(int val)The rejection threshold. |
(package private) ParticipatingThrottler.Result | shouldThrottle(Hash h)Determines whether to throttle tunnel participation for the given router,
counting the request against the peer's limit. |
(package private) ParticipatingThrottler.Result | shouldThrottle(Hash h,
boolean countRequest)Determines whether to throttle tunnel participation for the given router. |
public static volatile int _loadWeight
public static volatile int _maxLimit
public static volatile int _minLimit
public static volatile int _percentLimit
public static volatile int _rejectSteepness
public static volatile int _rejectThreshold
ParticipatingThrottler(RouterContext ctx)
static float calculateLoadScore(RouterContext context)
public static int getLoadWeight()
public static int getParticipatingMaxLimit()
public static int getParticipatingMinLimit()
public static int getParticipatingPctLimit()
public static int getRejectSteepness()
public static int getRejectThreshold()
public static void setLoadWeight(int val)
val - load weightpublic static void setParticipatingMaxLimit(int val)
val - max limitpublic static void setParticipatingMinLimit(int val)
val - min limitpublic static void setParticipatingPctLimit(int val)
val - pct limitpublic static void setRejectSteepness(int val)
val - reject steepnesspublic static void setRejectThreshold(int val)
val - reject thresholdParticipatingThrottler.Result shouldThrottle(Hash h)
h - the hash of the router to checkParticipatingThrottler.Result shouldThrottle(Hash h, boolean countRequest)
countRequest is set the request increments the peer's counter;
consult-only checks read the current count without advancing it, and never
DROP or ban on it: a count this request did not contribute to must not
silently kill it, and mid-chain hops would otherwise accumulate roughly
twice per tunnel via both their prev-hop and next-hop roles.h - the hash of the router to checkcountRequest - true to increment the peer's counter