2006-06-08 jrandom

* Be more conservative in the proactive rejections
This commit is contained in:
jrandom
2006-06-09 01:02:40 +00:00
committed by zzz
parent 6fd7881f8e
commit a3a4888e0b
3 changed files with 16 additions and 10 deletions

View File

@@ -1,4 +1,7 @@
$Id: history.txt,v 1.481 2006-06-04 17:25:08 jrandom Exp $ $Id: history.txt,v 1.482 2006-06-04 20:33:03 complication Exp $
2006-06-08 jrandom
* Be more conservative in the proactive rejections
2006-06-04 Complication 2006-06-04 Complication
* Trim out sending a blank line before USER in susimail. * Trim out sending a blank line before USER in susimail.

View File

@@ -151,8 +151,8 @@ class RouterThrottleImpl implements RouterThrottle {
else else
avg10m = tunnelTestTime10m.getLifetimeAverageValue(); avg10m = tunnelTestTime10m.getLifetimeAverageValue();
if (avg10m < 2000) if (avg10m < 5000)
avg10m = 2000; // minimum before complaining avg10m = 5000; // minimum before complaining
if ( (avg10m > 0) && (avg1m > avg10m * tunnelTestTimeGrowthFactor) ) { if ( (avg10m > 0) && (avg1m > avg10m * tunnelTestTimeGrowthFactor) ) {
double probAccept = (avg10m*tunnelTestTimeGrowthFactor)/avg1m; double probAccept = (avg10m*tunnelTestTimeGrowthFactor)/avg1m;
@@ -163,7 +163,7 @@ class RouterThrottleImpl implements RouterThrottle {
if (_log.shouldLog(Log.INFO)) if (_log.shouldLog(Log.INFO))
_log.info("Probabalistically accept tunnel request (p=" + probAccept _log.info("Probabalistically accept tunnel request (p=" + probAccept
+ " v=" + v + " test time avg 1m=" + avg1m + " 10m=" + avg10m + ")"); + " v=" + v + " test time avg 1m=" + avg1m + " 10m=" + avg10m + ")");
} else { } else if (false) {
if (_log.shouldLog(Log.WARN)) if (_log.shouldLog(Log.WARN))
_log.warn("Probabalistically refusing tunnel request (test time avg 1m=" + avg1m _log.warn("Probabalistically refusing tunnel request (test time avg 1m=" + avg1m
+ " 10m=" + avg10m + ")"); + " 10m=" + avg10m + ")");
@@ -228,7 +228,7 @@ class RouterThrottleImpl implements RouterThrottle {
timePerRequest = (int)rs.getLifetimeAverageValue(); timePerRequest = (int)rs.getLifetimeAverageValue();
} }
float pctFull = (queuedRequests * timePerRequest) / (10*1000f); float pctFull = (queuedRequests * timePerRequest) / (10*1000f);
float pReject = 1 - ((1-pctFull) * (1-pctFull)); float pReject = pctFull * pctFull; //1 - ((1-pctFull) * (1-pctFull));
if ( (pctFull >= 1) || (pReject >= _context.random().nextFloat()) ) { if ( (pctFull >= 1) || (pReject >= _context.random().nextFloat()) ) {
if (_log.shouldLog(Log.WARN)) if (_log.shouldLog(Log.WARN))
_log.warn("Rejecting a new tunnel request because we have too many pending requests (" + queuedRequests _log.warn("Rejecting a new tunnel request because we have too many pending requests (" + queuedRequests
@@ -269,7 +269,10 @@ class RouterThrottleImpl implements RouterThrottle {
_context.statManager().addRateData("router.throttleTunnelBytesUsed", used, maxKBps); _context.statManager().addRateData("router.throttleTunnelBytesUsed", used, maxKBps);
_context.statManager().addRateData("router.throttleTunnelBytesAllowed", availBps, (long)bytesAllocated); _context.statManager().addRateData("router.throttleTunnelBytesAllowed", availBps, (long)bytesAllocated);
if (used1m > (maxKBps*1024)) { long overage = used1m - (maxKBps*1024);
if ( (overage > 0) &&
((overage/(float)(maxKBps*1024f)) > _context.random().nextFloat()) ) {
if (_log.shouldLog(Log.WARN)) _log.warn("Reject tunnel, 1m rate (" + used1m + ") indicates overload."); if (_log.shouldLog(Log.WARN)) _log.warn("Reject tunnel, 1m rate (" + used1m + ") indicates overload.");
return false; return false;
} }
@@ -342,9 +345,9 @@ 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() {
try { try {
return Integer.parseInt(_context.getProperty("router.minThrottleTunnels", "40")); return Integer.parseInt(_context.getProperty("router.minThrottleTunnels", "1000"));
} catch (NumberFormatException nfe) { } catch (NumberFormatException nfe) {
return 40; return 1000;
} }
} }

View File

@@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
* *
*/ */
public class RouterVersion { public class RouterVersion {
public final static String ID = "$Revision: 1.421 $ $Date: 2006-06-04 17:25:20 $"; public final static String ID = "$Revision: 1.422 $ $Date: 2006-06-04 20:33:04 $";
public final static String VERSION = "0.6.1.20"; public final static String VERSION = "0.6.1.20";
public final static long BUILD = 1; public final static long BUILD = 2;
public static void main(String args[]) { public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION + "-" + BUILD); System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
System.out.println("Router ID: " + RouterVersion.ID); System.out.println("Router ID: " + RouterVersion.ID);