2005-12-13 zzz

* Don't test tunnels expiring within 90 seconds
    * Defer Test Tunnel jobs if job lag too large
    * Use JobQueue.getMaxLag() rather than the jobQueue.jobLag stat to measure
      job lag for tunnel build backoff, allowing for more agile handling
      (since the stat is only updated once a minute)
    * Use tunnel length override if all tunnels are expiring within one
      minute.
This commit is contained in:
jrandom
2005-12-13 21:56:41 +00:00
committed by zzz
parent 6e5114a4c2
commit 5033a22a9b
4 changed files with 28 additions and 10 deletions

View File

@ -1,4 +1,13 @@
$Id: history.txt,v 1.352 2005/12/09 03:05:48 jrandom Exp $
$Id: history.txt,v 1.353 2005/12/13 04:38:52 jrandom Exp $
2005-12-13 zzz
* Don't test tunnels expiring within 90 seconds
* Defer Test Tunnel jobs if job lag too large
* Use JobQueue.getMaxLag() rather than the jobQueue.jobLag stat to measure
job lag for tunnel build backoff, allowing for more agile handling
(since the stat is only updated once a minute)
* Use tunnel length override if all tunnels are expiring within one
minute.
2005-12-13 jrandom
* Fixed I2PSnark's handling of some torrent files to deal with those

View File

@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
public final static String ID = "$Revision: 1.308 $ $Date: 2005/12/08 15:53:41 $";
public final static String ID = "$Revision: 1.309 $ $Date: 2005/12/09 03:05:48 $";
public final static String VERSION = "0.6.1.7";
public final static long BUILD = 2;
public final static long BUILD = 3;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
System.out.println("Router ID: " + RouterVersion.ID);

View File

@ -50,6 +50,14 @@ class TestJob extends JobImpl {
}
public String getName() { return "Test tunnel"; }
public void runJob() {
long lag = getContext().jobQueue().getMaxLag();
if (lag > 3000) {
if (_log.shouldLog(Log.WARN))
_log.warn("Deferring test of " + _cfg + " due to job lag = " + lag);
getContext().statManager().addRateData("tunnel.testAborted", _cfg.getLength(), 0);
scheduleRetest();
return;
}
_found = false;
// note: testing with exploratory tunnels always, even if the tested tunnel
// is a client tunnel (per _cfg.getDestination())
@ -166,7 +174,7 @@ class TestJob extends JobImpl {
_outTunnel = null;
_replyTunnel = null;
int delay = getDelay();
if (_cfg.getExpiration() > getContext().clock().now() + delay)
if (_cfg.getExpiration() > getContext().clock().now() + delay + (3 * getTestPeriod()) + 30*1000)
requeue(delay);
}

View File

@ -141,7 +141,7 @@ public class TunnelPool {
if (maxBuild > 0 && build > maxBuild)
build = maxBuild;
int buildThrottle = MAX_BUILDS_PER_MINUTE;
int lag = (int) _context.statManager().getRate("jobQueue.jobLag").getRate(60*1000).getAverageValue();
long lag = _context.jobQueue().getMaxLag();
int netErrors = (int) _context.statManager().getRate("udp.sendException").getRate(60*1000).getLastEventCount();
if (lag > 3 * 1000 || netErrors > 5) {
if (_log.shouldLog(Log.WARN))
@ -161,10 +161,11 @@ public class TunnelPool {
if (build <= 0) return 0;
if ((_settings.isExploratory() && baseTarget > countUsableTunnels(1)) ||
((!_settings.isExploratory()) && baseTarget > countUsableTunnels(0)))
_settings.setLengthOverride(1);
else
_settings.setLengthOverride(0);
((!_settings.isExploratory()) && baseTarget > countUsableTunnels(0)) ||
((!_settings.isExploratory()) && countUsableTunnels(1) == 0))
_settings.setLengthOverride(1);
else
_settings.setLengthOverride(0);
int wanted = build;
build = _manager.allocateBuilds(build);
@ -540,7 +541,7 @@ public class TunnelPool {
else
added = refreshBuilders(0, 1);
if ( (added > 0) && (_log.shouldLog(Log.WARN)) )
_log.warn("Additional parallel rebuilding of tunnel for " + TunnelPool.this.toString());
_log.warn(added + " additional parallel rebuild(s) for " + TunnelPool.this.toString());
requeue(30*1000);
}
}