forked from I2P_Developers/i2p.i2p
Throttle: Reduce threshold for probabalistic throttling on slow platforms (ticket #1964)
This commit is contained in:
@ -8,6 +8,7 @@ import net.i2p.stat.RateAverages;
|
|||||||
import net.i2p.stat.RateStat;
|
import net.i2p.stat.RateStat;
|
||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
||||||
import net.i2p.util.SimpleTimer;
|
import net.i2p.util.SimpleTimer;
|
||||||
|
import net.i2p.util.SystemVersion;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple throttle that basically stops accepting messages or nontrivial
|
* Simple throttle that basically stops accepting messages or nontrivial
|
||||||
@ -33,6 +34,8 @@ public class RouterThrottleImpl implements RouterThrottle {
|
|||||||
private static final String PROP_MAX_PROCESSINGTIME = "router.defaultProcessingTimeThrottle";
|
private static final String PROP_MAX_PROCESSINGTIME = "router.defaultProcessingTimeThrottle";
|
||||||
private static final long DEFAULT_REJECT_STARTUP_TIME = 10*60*1000;
|
private static final long DEFAULT_REJECT_STARTUP_TIME = 10*60*1000;
|
||||||
private static final String PROP_REJECT_STARTUP_TIME = "router.rejectStartupTime";
|
private static final String PROP_REJECT_STARTUP_TIME = "router.rejectStartupTime";
|
||||||
|
private static final int DEFAULT_MIN_THROTTLE_TUNNELS = SystemVersion.isAndroid() ? 100 :
|
||||||
|
SystemVersion.isARM() ? 500 : 1000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TO BE FIXED - SEE COMMENTS BELOW
|
* TO BE FIXED - SEE COMMENTS BELOW
|
||||||
@ -200,6 +203,10 @@ public class RouterThrottleImpl implements RouterThrottle {
|
|||||||
/*
|
/*
|
||||||
* Throttle if we go above a minimum level of tunnels AND the maximum participating
|
* Throttle if we go above a minimum level of tunnels AND the maximum participating
|
||||||
* tunnels is default or lower.
|
* tunnels is default or lower.
|
||||||
|
*
|
||||||
|
* Lag based statistics use a moving average window (of for example 10 minutes), they are therefore
|
||||||
|
* sensitive to sudden rapid growth of load, which are not instantly detected by these metrics.
|
||||||
|
* Reduce tunnel growth if we are growing faster than the lag based metrics can detect reliably.
|
||||||
*/
|
*/
|
||||||
if ((numTunnels > getMinThrottleTunnels()) && (DEFAULT_MAX_TUNNELS >= maxTunnels)) {
|
if ((numTunnels > getMinThrottleTunnels()) && (DEFAULT_MAX_TUNNELS >= maxTunnels)) {
|
||||||
Rate avgTunnels = _context.statManager().getRate("tunnel.participatingTunnels").getRate(10*60*1000);
|
Rate avgTunnels = _context.statManager().getRate("tunnel.participatingTunnels").getRate(10*60*1000);
|
||||||
@ -461,7 +468,7 @@ public class RouterThrottleImpl implements RouterThrottle {
|
|||||||
|
|
||||||
/** dont ever probabalistically throttle tunnels if we have less than this many */
|
/** dont ever probabalistically throttle tunnels if we have less than this many */
|
||||||
private int getMinThrottleTunnels() {
|
private int getMinThrottleTunnels() {
|
||||||
return _context.getProperty("router.minThrottleTunnels", 1000);
|
return _context.getProperty("router.minThrottleTunnels", DEFAULT_MIN_THROTTLE_TUNNELS);
|
||||||
}
|
}
|
||||||
|
|
||||||
private double getTunnelGrowthFactor() {
|
private double getTunnelGrowthFactor() {
|
||||||
|
Reference in New Issue
Block a user