2006-05-02 Complication

* Correct a misnamed property in SummaryHelper.java
      to avoid confusion
    * Make the maximum allowance of our own concurrent
      tunnel builds slightly adaptive: one concurrent build per 6 KB/s
      within the fixed range 2..10
    * While overloaded, try to avoid completely choking our own build attempts,
      instead prefer limiting them to 1
This commit is contained in:
complication
2006-05-03 04:30:26 +00:00
committed by zzz
parent ed3fdaf4f1
commit 4307097472
5 changed files with 30 additions and 13 deletions

View File

@ -213,11 +213,11 @@ public class SummaryHelper {
}
/**
* How fast we have been receiving data over the last minute (pretty printed
* How fast we have been receiving data over the last second (pretty printed
* string with 2 decimal places representing the KBps)
*
*/
public String getInboundMinuteKBps() {
public String getInboundSecondKBps() {
if (_context == null)
return "0.0";
double kbps = _context.bandwidthLimiter().getReceiveBps()/1024d;
@ -225,11 +225,11 @@ public class SummaryHelper {
return fmt.format(kbps);
}
/**
* How fast we have been sending data over the last minute (pretty printed
* How fast we have been sending data over the last second (pretty printed
* string with 2 decimal places representing the KBps)
*
*/
public String getOutboundMinuteKBps() {
public String getOutboundSecondKBps() {
if (_context == null)
return "0.0";
double kbps = _context.bandwidthLimiter().getSendBps()/1024d;

View File

@ -65,7 +65,7 @@
%><hr />
<u><b><a href="config.jsp" title="Configure the bandwidth limits">Bandwidth in/out</a></b></u><br />
<b>1s:</b> <jsp:getProperty name="helper" property="inboundMinuteKBps" />/<jsp:getProperty name="helper" property="outboundMinuteKBps" />KBps<br />
<b>1s:</b> <jsp:getProperty name="helper" property="inboundSecondKBps" />/<jsp:getProperty name="helper" property="outboundSecondKBps" />KBps<br />
<b>5m:</b> <jsp:getProperty name="helper" property="inboundFiveMinuteKBps" />/<jsp:getProperty name="helper" property="outboundFiveMinuteKBps" />KBps<br />
<b>Total:</b> <jsp:getProperty name="helper" property="inboundLifetimeKBps" />/<jsp:getProperty name="helper" property="outboundLifetimeKBps" />KBps<br />
<b>Used:</b> <jsp:getProperty name="helper" property="inboundTransferred" />/<jsp:getProperty name="helper" property="outboundTransferred" /><br />

View File

@ -1,4 +1,13 @@
$Id: history.txt,v 1.465 2006/05/01 14:09:02 jrandom Exp $
$Id: history.txt,v 1.466 2006/05/01 17:42:24 jrandom Exp $
2006-05-02 Complication
* Correct a misnamed property in SummaryHelper.java
to avoid confusion
* Make the maximum allowance of our own concurrent
tunnel builds slightly adaptive: one concurrent build per 6 KB/s
within the fixed range 2..10
* While overloaded, try to avoid completely choking our own build attempts,
instead prefer limiting them to 1
2006-05-01 jrandom
* Adjust the tunnel build timeouts to cut down on expirations, and

View File

@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
public final static String ID = "$Revision: 1.405 $ $Date: 2006/05/01 14:09:02 $";
public final static String ID = "$Revision: 1.406 $ $Date: 2006/05/01 17:40:23 $";
public final static String VERSION = "0.6.1.17";
public final static long BUILD = 4;
public final static long BUILD = 5;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
System.out.println("Router ID: " + RouterVersion.ID);

View File

@ -52,7 +52,12 @@ class BuildExecutor implements Runnable {
buf = new StringBuffer(128);
buf.append("Allowed: ");
}
int allowed = 5;
int maxKBps = _context.bandwidthLimiter().getOutboundKBytesPerSecond();
int allowed = maxKBps / 6; // Max. 1 concurrent build per 6 KB/s outbound
if (allowed < 2) allowed = 2; // Never choke below 2 builds (but congestion may)
if (allowed > 10) allowed = 10; // Never go beyond 10, that is uncharted territory (old limit was 5)
String prop = _context.getProperty("router.tunnelConcurrentBuilds");
if (prop != null)
try { allowed = Integer.valueOf(prop).intValue(); } catch (NumberFormatException nfe) {}
@ -107,11 +112,14 @@ class BuildExecutor implements Runnable {
if (_log.shouldLog(Log.WARN))
_log.warn("Too lagged [" + lag + "], don't allow building");
_context.statManager().addRateData("tunnel.concurrentBuildsLagged", concurrent, lag);
return 0; // if we have a job heavily blocking our jobqueue, ssllloowww dddooowwwnnn
_log.error("Allowed was " + allowed + ", but we had lag issues, so ended up allowing " + Math.min(allowed,1));
return Math.min(allowed,1); // if we have a job heavily blocking our jobqueue, ssllloowww dddooowwwnnn
}
if (isOverloaded())
return 0;
if (isOverloaded()) {
_log.error("Allowed was " + allowed + ", but we were overloaded, so ended up allowing " + Math.min(allowed,1));
return Math.min(allowed,1);
}
return allowed;
}
@ -124,7 +132,7 @@ class BuildExecutor implements Runnable {
// dont include the inbound rates when throttling tunnel building, since
// that'd expose a pretty trivial attack.
int maxKBps = _context.bandwidthLimiter().getOutboundKBytesPerSecond();
int used1s = _context.router().get1sRate(true); // dont throttle on the 1s rate, its too volatile
int used1s = 0; // dont throttle on the 1s rate, its too volatile
int used1m = _context.router().get1mRate(true);
int used5m = 0; //get5mRate(_context); // don't throttle on the 5m rate, as that'd hide available bandwidth
int used = Math.max(Math.max(used1s, used1m), used5m);