2006-05-03 Complication

* Allow a single build attempt to proceed despite 1-minute overload
      only if the 1-second rate shows enough spare bandwidth
      (e.g. overload has already eased)
This commit is contained in:
complication
2006-05-03 11:13:26 +00:00
committed by zzz
parent 4307097472
commit 46ac9292e8
3 changed files with 25 additions and 7 deletions

View File

@ -1,4 +1,9 @@
$Id: history.txt,v 1.466 2006/05/01 17:42:24 jrandom Exp $ $Id: history.txt,v 1.467 2006/05/02 23:30:28 complication Exp $
2006-05-03 Complication
* Allow a single build attempt to proceed despite 1-minute overload
only if the 1-second rate shows enough spare bandwidth
(e.g. overload has already eased)
2006-05-02 Complication 2006-05-02 Complication
* Correct a misnamed property in SummaryHelper.java * Correct a misnamed property in SummaryHelper.java

View File

@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
* *
*/ */
public class RouterVersion { public class RouterVersion {
public final static String ID = "$Revision: 1.406 $ $Date: 2006/05/01 17:40:23 $"; public final static String ID = "$Revision: 1.407 $ $Date: 2006/05/02 23:30:27 $";
public final static String VERSION = "0.6.1.17"; public final static String VERSION = "0.6.1.17";
public final static long BUILD = 5; public final static long BUILD = 6;
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);

View File

@ -46,6 +46,9 @@ class BuildExecutor implements Runnable {
_handler = new BuildHandler(ctx, this); _handler = new BuildHandler(ctx, this);
} }
// Estimated cost of one tunnel build attempt, bytes
private static final int BUILD_BANDWIDTH_ESTIMATE_BYTES = 5*1024;
private int allowed() { private int allowed() {
StringBuffer buf = null; StringBuffer buf = null;
if (_log.shouldLog(Log.DEBUG)) { if (_log.shouldLog(Log.DEBUG)) {
@ -112,13 +115,23 @@ class BuildExecutor implements Runnable {
if (_log.shouldLog(Log.WARN)) if (_log.shouldLog(Log.WARN))
_log.warn("Too lagged [" + lag + "], don't allow building"); _log.warn("Too lagged [" + lag + "], don't allow building");
_context.statManager().addRateData("tunnel.concurrentBuildsLagged", concurrent, lag); _context.statManager().addRateData("tunnel.concurrentBuildsLagged", concurrent, lag);
_log.error("Allowed was " + allowed + ", but we had lag issues, so ended up allowing " + Math.min(allowed,1)); return 0; // if we have a job heavily blocking our jobqueue, ssllloowww dddooowwwnnn
return Math.min(allowed,1); // if we have a job heavily blocking our jobqueue, ssllloowww dddooowwwnnn
} }
if (isOverloaded()) { if (isOverloaded()) {
_log.error("Allowed was " + allowed + ", but we were overloaded, so ended up allowing " + Math.min(allowed,1)); int used1s = _context.router().get1sRate(true);
return Math.min(allowed,1); // If 1-second average indicates we could manage building one tunnel
if ((maxKBps*1024) - used1s > BUILD_BANDWIDTH_ESTIMATE_BYTES) {
// Allow one
if (_log.shouldLog(Log.WARN))
_log.warn("We had overload, but 1s bandwidth was " + used1s + " so allowed building 1.");
return 1;
} else {
// Allow none
if (_log.shouldLog(Log.WARN))
_log.warn("We had serious overload, so allowed building 0.");
return 0;
}
} }
return allowed; return allowed;