public class RequestThrottler extends Object
| Modifier and Type | Field and Description |
|---|---|
static int | _highLoadCpuPctHigh-load CPU threshold (percent) @since 0.9.70+ |
static int | _highLoadLagMsHigh-load job lag threshold (ms) @since 0.9.70+ |
static int | _highLoadSysLoadPctHigh-load system load threshold (percent, normalized by cores) @since 0.9.70+ |
static int | _moderateLoadCpuPctModerate-load CPU threshold (percent) @since 0.9.70+ |
static int | _moderateLoadLagMsModerate-load job lag threshold (ms) @since 0.9.70+ |
static int | _moderateLoadSysLoadPctModerate-load system load threshold (percent, normalized by cores) @since 0.9.70+ |
static int | _reqBurst1sThresholdBurst threshold for 1-second sliding window (requests per second). |
static int | _reqLoadWeightLoad weight: how much load inflates effective ratio (0-300%, default 100%). |
static int | _reqMaxLimitMaximum request limit per peer. |
static int | _reqMinLimitMinimum request limit per peer. |
static int | _reqPercentLimitRequest limit as percentage of participating tunnel count. |
static int | _reqRejectSteepnessRejection steepness: 100=linear ramp, 200=quadratic. |
static int | _reqRejectThresholdRejection threshold: start rejecting at count/limit ratio this high (30-100, default 70%). |
static long | _sustainedHighLoadMsDuration (ms) high load must persist before gating requests @since 0.9.70+ |
static long | _sustainedModerateLoadMsDuration (ms) moderate load must persist before disconnecting low-share peers @since 0.9.70+ |
| Constructor and Description |
|---|
RequestThrottler(RouterContext ctx)Creates a new RequestThrottler bound to the given router context. |
| Modifier and Type | Method and Description |
|---|---|
static int | getHighLoadCpuPct()Get the high-load CPU threshold percentage. |
static int | getHighLoadLagMs()Get the high-load job lag threshold in milliseconds. |
static int | getHighLoadSysLoadPct()Get the high-load system load threshold percentage (normalized by cores). |
static int | getModerateLoadCpuPct()Get the moderate-load CPU threshold percentage. |
static int | getModerateLoadLagMs()Get the moderate-load job lag threshold in milliseconds. |
static int | getModerateLoadSysLoadPct()Get the moderate-load system load threshold percentage (normalized by cores). |
static int | getRequestBurst1sThreshold()Get the burst threshold for 1-second sliding window. |
static int | getRequestLoadWeight()Get the load weight (how much load inflates effective ratio, 0-300%). |
static int | getRequestMaxLimit()Get the maximum request limit per peer. |
static int | getRequestMinLimit()Get the minimum request limit per peer. |
static int | getRequestPctLimit()Get the request limit as percentage of participating tunnel count. |
static int | getRequestRejectSteepness()Get the rejection steepness (100=linear ramp, 200=quadratic). |
static int | getRequestRejectThreshold()Get the rejection threshold (30-100, default 70%). |
static long | getSustainedHighLoadMs()Get the duration (ms) high load must persist before gating requests. |
static long | getSustainedModerateLoadMs()Get the duration (ms) moderate load must persist before disconnecting low-share peers. |
static void | setHighLoadCpuPct(int val)Set the high-load CPU threshold percentage. |
static void | setHighLoadLagMs(int val)Set the high-load job lag threshold in milliseconds. |
static void | setHighLoadSysLoadPct(int val)Set the high-load system load threshold percentage. |
static void | setModerateLoadCpuPct(int val)Set the moderate-load CPU threshold percentage. |
static void | setModerateLoadLagMs(int val)Set the moderate-load job lag threshold in milliseconds. |
static void | setModerateLoadSysLoadPct(int val)Set the moderate-load system load threshold percentage. |
static void | setRequestBurst1sThreshold(int val)Set the burst threshold for 1-second sliding window. |
static void | setRequestLoadWeight(int val)Set the load weight percentage. |
static void | setRequestMaxLimit(int val)Set the maximum request limit per peer. |
static void | setRequestMinLimit(int val)Set the minimum request limit per peer. |
static void | setRequestPctLimit(int val)Set the request limit as percentage of participating tunnel count. |
static void | setRequestRejectSteepness(int val)Set the rejection steepness (100=linear, 500=max curve). |
static void | setRequestRejectThreshold(int val)Set the rejection threshold percentage. |
static void | setSustainedHighLoadMs(long val)Set the duration (ms) high load must persist before gating requests. |
static void | setSustainedModerateLoadMs(long val)Set the duration (ms) moderate load must persist before disconnecting low-share peers. |
(package private) boolean | shouldThrottle(Hash h)Checks if the given router's tunnel requests should be throttled. |
public static volatile int _highLoadCpuPct
public static volatile int _highLoadLagMs
public static volatile int _highLoadSysLoadPct
public static volatile int _moderateLoadCpuPct
public static volatile int _moderateLoadLagMs
public static volatile int _moderateLoadSysLoadPct
public static volatile int _reqBurst1sThreshold
public static volatile int _reqLoadWeight
public static volatile int _reqMaxLimit
public static volatile int _reqMinLimit
public static volatile int _reqPercentLimit
public static volatile int _reqRejectSteepness
public static volatile int _reqRejectThreshold
public static volatile long _sustainedHighLoadMs
public static volatile long _sustainedModerateLoadMs
RequestThrottler(RouterContext ctx)
ctx - the router contextpublic static int getHighLoadCpuPct()
public static int getHighLoadLagMs()
public static int getHighLoadSysLoadPct()
public static int getModerateLoadCpuPct()
public static int getModerateLoadLagMs()
public static int getModerateLoadSysLoadPct()
public static int getRequestBurst1sThreshold()
public static int getRequestLoadWeight()
public static int getRequestMaxLimit()
public static int getRequestMinLimit()
public static int getRequestPctLimit()
public static int getRequestRejectSteepness()
public static int getRequestRejectThreshold()
public static long getSustainedHighLoadMs()
public static long getSustainedModerateLoadMs()
public static void setHighLoadCpuPct(int val)
val - the CPU percentage (clamped to 50-100)public static void setHighLoadLagMs(int val)
val - the high-load lag threshold (clamped to 200-5000)public static void setHighLoadSysLoadPct(int val)
val - the system load percentage (clamped to 50-100)public static void setModerateLoadCpuPct(int val)
val - the CPU percentage (clamped to 40-100)public static void setModerateLoadLagMs(int val)
val - the moderate-load lag threshold (clamped to 100-3000)public static void setModerateLoadSysLoadPct(int val)
val - the system load percentage (clamped to 30-100)public static void setRequestBurst1sThreshold(int val)
val - the burst threshold (clamped to 1-100)public static void setRequestLoadWeight(int val)
val - the load weight (clamped to 0-300)public static void setRequestMaxLimit(int val)
val - the maximum limit (clamped to 10-1000)public static void setRequestMinLimit(int val)
val - the minimum limit (clamped to 1-100)public static void setRequestPctLimit(int val)
val - the percentage limit (clamped to 1-100)public static void setRequestRejectSteepness(int val)
val - the steepness value (clamped to 100-500)public static void setRequestRejectThreshold(int val)
val - the rejection threshold (clamped to 30-100)public static void setSustainedHighLoadMs(long val)
val - the sustained high load duration (clamped to 5-120s)public static void setSustainedModerateLoadMs(long val)
val - the sustained moderate load duration (clamped to 10-300s)boolean shouldThrottle(Hash h)
h - the router's hash