* Profiles: Penalize capacity when tunnel build request times out
* Tunnel BuildExecutor: Debug cleanup
This commit is contained in:
@ -1,3 +1,10 @@
|
|||||||
|
2008-08-29 zzz
|
||||||
|
* Tunnel BuildExecutor: Debug cleanup
|
||||||
|
* Profiles: Penalize capacity when tunnel build request times out
|
||||||
|
* Shutdown: Call the shutdown hooks before the router shutdown
|
||||||
|
rather than after
|
||||||
|
* Stats: Remove tunnel.Bps.* stats when the tunnel pool is closed
|
||||||
|
|
||||||
2008-08-27 zzz
|
2008-08-27 zzz
|
||||||
* Floodfill Peer Selector: Prefer already-connected floodfill
|
* Floodfill Peer Selector: Prefer already-connected floodfill
|
||||||
peer for direct RouterInfo stores, to mimimize floodfill
|
peer for direct RouterInfo stores, to mimimize floodfill
|
||||||
|
@ -54,6 +54,13 @@ public interface ProfileManager {
|
|||||||
*/
|
*/
|
||||||
void tunnelRejected(Hash peer, long responseTimeMs, int severity);
|
void tunnelRejected(Hash peer, long responseTimeMs, int severity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Note that a router timed out joining a tunnel
|
||||||
|
*
|
||||||
|
* @param peer who rejected us
|
||||||
|
*/
|
||||||
|
void tunnelTimedOut(Hash peer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note that a tunnel that the router is participating in
|
* Note that a tunnel that the router is participating in
|
||||||
* was successfully tested with the given round trip latency
|
* was successfully tested with the given round trip latency
|
||||||
|
@ -17,7 +17,7 @@ import net.i2p.CoreVersion;
|
|||||||
public class RouterVersion {
|
public class RouterVersion {
|
||||||
public final static String ID = "$Revision: 1.548 $ $Date: 2008-06-07 23:00:00 $";
|
public final static String ID = "$Revision: 1.548 $ $Date: 2008-06-07 23:00:00 $";
|
||||||
public final static String VERSION = "0.6.3";
|
public final static String VERSION = "0.6.3";
|
||||||
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);
|
||||||
|
@ -103,6 +103,18 @@ public class ProfileManagerImpl implements ProfileManager {
|
|||||||
data.getTunnelHistory().incrementRejected(severity);
|
data.getTunnelHistory().incrementRejected(severity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Note that a router did not respond to a tunnel join.
|
||||||
|
*
|
||||||
|
* Since TunnelHistory doesn't have a timeout stat, pretend we were
|
||||||
|
* rejected for bandwidth reasons.
|
||||||
|
*/
|
||||||
|
public void tunnelTimedOut(Hash peer) {
|
||||||
|
PeerProfile data = getProfile(peer);
|
||||||
|
if (data == null) return;
|
||||||
|
data.getTunnelHistory().incrementRejected(TunnelHistory.TUNNEL_REJECT_BANDWIDTH);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note that a tunnel that the router is participating in
|
* Note that a tunnel that the router is participating in
|
||||||
* was successfully tested with the given round trip latency
|
* was successfully tested with the given round trip latency
|
||||||
|
@ -67,12 +67,6 @@ class BuildExecutor implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int allowed() {
|
private int allowed() {
|
||||||
StringBuffer buf = null;
|
|
||||||
if (_log.shouldLog(Log.DEBUG)) {
|
|
||||||
buf = new StringBuffer(128);
|
|
||||||
buf.append("Allowed: ");
|
|
||||||
}
|
|
||||||
|
|
||||||
int maxKBps = _context.bandwidthLimiter().getOutboundKBytesPerSecond();
|
int maxKBps = _context.bandwidthLimiter().getOutboundKBytesPerSecond();
|
||||||
int allowed = maxKBps / 6; // Max. 1 concurrent build per 6 KB/s outbound
|
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 < 2) allowed = 2; // Never choke below 2 builds (but congestion may)
|
||||||
@ -99,39 +93,36 @@ class BuildExecutor implements Runnable {
|
|||||||
}
|
}
|
||||||
concurrent = _currentlyBuilding.size();
|
concurrent = _currentlyBuilding.size();
|
||||||
allowed -= concurrent;
|
allowed -= concurrent;
|
||||||
if (buf != null)
|
|
||||||
buf.append(allowed).append(" ").append(_currentlyBuilding.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (expired != null) {
|
if (expired != null) {
|
||||||
for (int i = 0; i < expired.size(); i++) {
|
for (int i = 0; i < expired.size(); i++) {
|
||||||
PooledTunnelCreatorConfig cfg = (PooledTunnelCreatorConfig)expired.get(i);
|
PooledTunnelCreatorConfig cfg = (PooledTunnelCreatorConfig)expired.get(i);
|
||||||
// note the fact that this tunnel request timed out in the peers' profiles.
|
|
||||||
// or... not.
|
|
||||||
if (_log.shouldLog(Log.INFO))
|
if (_log.shouldLog(Log.INFO))
|
||||||
_log.info("Timed out waiting for reply asking for " + cfg);
|
_log.info("Timed out waiting for reply asking for " + cfg);
|
||||||
|
|
||||||
// Iterate through peers in the tunnel, get their bandwidth tiers,
|
// Iterate through peers in the tunnel, get their bandwidth tiers,
|
||||||
// record for each that a peer of the given tier expired
|
// record for each that a peer of the given tier expired
|
||||||
|
// Also note the fact that this tunnel request timed out in the peers' profiles.
|
||||||
for (int iPeer = 0; iPeer < cfg.getLength(); iPeer++) {
|
for (int iPeer = 0; iPeer < cfg.getLength(); iPeer++) {
|
||||||
// Look up peer
|
// Look up peer
|
||||||
Hash peer = cfg.getPeer(iPeer);
|
Hash peer = cfg.getPeer(iPeer);
|
||||||
// Avoid recording ourselves
|
// Avoid recording ourselves
|
||||||
if (peer.toBase64().equals(_context.routerHash().toBase64())) {
|
if (peer.toBase64().equals(_context.routerHash().toBase64()))
|
||||||
if (_log.shouldLog(Log.DEBUG)) _log.debug("Not recording our own expiry in stats.");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
// Look up routerInfo
|
// Look up routerInfo
|
||||||
RouterInfo ri = _context.netDb().lookupRouterInfoLocally(peer);
|
RouterInfo ri = _context.netDb().lookupRouterInfoLocally(peer);
|
||||||
// Default and detect bandwidth tier
|
// Default and detect bandwidth tier
|
||||||
String bwTier = "Unknown";
|
String bwTier = "Unknown";
|
||||||
if (ri != null) bwTier = ri.getBandwidthTier(); // Returns "Unknown" if none recognized
|
if (ri != null) bwTier = ri.getBandwidthTier(); // Returns "Unknown" if none recognized
|
||||||
else if (_log.shouldLog(Log.WARN)) _log.warn("Failed detecting bwTier, null routerInfo for: " + peer);
|
|
||||||
// Record that a peer of the given tier expired
|
// Record that a peer of the given tier expired
|
||||||
_context.statManager().addRateData("tunnel.tierExpire" + bwTier, 1, 0);
|
_context.statManager().addRateData("tunnel.tierExpire" + bwTier, 1, 0);
|
||||||
|
didNotReply(cfg.getReplyMessageId(), peer);
|
||||||
|
// Blame everybody since we don't know whose fault it is.
|
||||||
|
// (it could be our exploratory tunnel's fault too...)
|
||||||
|
_context.profileManager().tunnelTimedOut(peer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TunnelPool pool = cfg.getTunnelPool();
|
TunnelPool pool = cfg.getTunnelPool();
|
||||||
if (pool != null)
|
if (pool != null)
|
||||||
pool.buildComplete(cfg);
|
pool.buildComplete(cfg);
|
||||||
@ -139,14 +130,9 @@ class BuildExecutor implements Runnable {
|
|||||||
_context.statManager().addRateData("tunnel.buildExploratoryExpire", 1, 0);
|
_context.statManager().addRateData("tunnel.buildExploratoryExpire", 1, 0);
|
||||||
else
|
else
|
||||||
_context.statManager().addRateData("tunnel.buildClientExpire", 1, 0);
|
_context.statManager().addRateData("tunnel.buildClientExpire", 1, 0);
|
||||||
for (int j = 0; j < cfg.getLength(); j++)
|
|
||||||
didNotReply(cfg.getReplyMessageId(), cfg.getPeer(j));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (buf != null)
|
|
||||||
// _log.debug(buf.toString());
|
|
||||||
|
|
||||||
_context.statManager().addRateData("tunnel.concurrentBuilds", concurrent, 0);
|
_context.statManager().addRateData("tunnel.concurrentBuilds", concurrent, 0);
|
||||||
|
|
||||||
long lag = _context.jobQueue().getMaxLag();
|
long lag = _context.jobQueue().getMaxLag();
|
||||||
@ -167,7 +153,7 @@ class BuildExecutor implements Runnable {
|
|||||||
|
|
||||||
|
|
||||||
// Estimated cost of tunnel build attempt, bytes
|
// Estimated cost of tunnel build attempt, bytes
|
||||||
private static final int BUILD_BANDWIDTH_ESTIMATE_BYTES = 5*1024;
|
// private static final int BUILD_BANDWIDTH_ESTIMATE_BYTES = 5*1024;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Don't even try to build tunnels if we're saturated
|
* Don't even try to build tunnels if we're saturated
|
||||||
|
Reference in New Issue
Block a user