2004-12-21 jrandom

* Cleaned up the postinstall/startup scripts a bit more to handle winME,
      and added windows info to the headless docs. (thanks ardvark!)
    * Fixed a harmless (yet NPE inspiring) race during the final shutdown of
      a stream (thanks frosk!)
    * Add a pair of new stats for monitoring tunnel participation -
      tunnel.participatingBytesProcessed (total # bytes transferred) and
      tunnel.participatingBytesProcessedActive (total # bytes transferred for
      tunnels whose byte count exceed the 10m average).  This should help
      further monitor congestion issues.
    * Made the NamingService factory property public (thanks susi!)
This commit is contained in:
jrandom
2004-12-21 16:32:49 +00:00
committed by zzz
parent 6cb316b33e
commit 758293dc02
13 changed files with 96 additions and 89 deletions

View File

@@ -110,22 +110,7 @@ class RouterThrottleImpl implements RouterThrottle {
return false;
}
// ok, we're not hosed, but can we handle the bandwidth requirements
// of another tunnel?
rs = _context.statManager().getRate("tunnel.participatingMessagesProcessed");
r = null;
if (rs != null)
r = rs.getRate(10*60*1000);
double msgsPerTunnel = (r != null ? r.getAverageValue() : 0);
r = null;
rs = _context.statManager().getRate("tunnel.relayMessageSize");
if (rs != null)
r = rs.getRate(10*60*1000);
double bytesPerMsg = (r != null ? r.getAverageValue() : 0);
double bytesPerTunnel = msgsPerTunnel * bytesPerMsg;
int numTunnels = _context.tunnelManager().getParticipatingCount();
double bytesAllocated = (numTunnels + 1) * bytesPerTunnel;
if (_context.getProperty(Router.PROP_SHUTDOWN_IN_PROGRESS) != null) {
if (_log.shouldLog(Log.WARN))
@@ -209,6 +194,14 @@ class RouterThrottleImpl implements RouterThrottle {
// no default, ignore it
}
}
// ok, we're not hosed, but can we handle the bandwidth requirements
// of another tunnel?
rs = _context.statManager().getRate("tunnel.participatingBytesProcessed");
r = null;
if (rs != null)
r = rs.getRate(10*60*1000);
double bytesAllocated = r.getCurrentTotalValue();
if (!allowTunnel(bytesAllocated, numTunnels)) {
_context.statManager().addRateData("router.throttleTunnelBandwidthExceeded", (long)bytesAllocated, 0);

View File

@@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
public final static String ID = "$Revision: 1.120 $ $Date: 2004/12/19 13:55:09 $";
public final static String ID = "$Revision: 1.121 $ $Date: 2004/12/20 00:14:56 $";
public final static String VERSION = "0.4.2.4";
public final static long BUILD = 5;
public final static long BUILD = 6;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION);
System.out.println("Router ID: " + RouterVersion.ID);

View File

@@ -115,6 +115,8 @@ public class StatisticsManager implements Service {
//includeRate("jobQueue.droppedJobs", stats, new long[] { 60*60*1000, 24*60*60*1000 });
//includeRate("inNetPool.dropped", stats, new long[] { 60*60*1000, 24*60*60*1000 });
includeRate("tunnel.participatingTunnels", stats, new long[] { 5*60*1000, 60*60*1000 });
includeRate("tunnel.participatingBytesProcessed", stats, new long[] { 10*60*1000 });
includeRate("tunnel.participatingBytesProcessedActive", stats, new long[] { 10*60*1000 });
includeRate("tunnel.testSuccessTime", stats, new long[] { 60*60*1000l, 24*60*60*1000l });
//includeRate("tunnel.outboundMessagesProcessed", stats, new long[] { 10*60*1000, 60*60*1000 });
//includeRate("tunnel.inboundMessagesProcessed", stats, new long[] { 10*60*1000, 60*60*1000 });

View File

@@ -56,6 +56,7 @@ public class TunnelInfo extends DataStructureImpl {
private boolean _wasEverReady;
private int _messagesProcessed;
private int _tunnelFailures;
private long _bytesProcessed;
public TunnelInfo(I2PAppContext context) {
_context = context;
@@ -79,6 +80,7 @@ public class TunnelInfo extends DataStructureImpl {
_lastTested = -1;
_messagesProcessed = 0;
_tunnelFailures = 0;
_bytesProcessed = 0;
}
public TunnelId getTunnelId() { return _id; }
@@ -182,7 +184,12 @@ public class TunnelInfo extends DataStructureImpl {
return _messagesProcessed;
}
/** we have just processed a message for this tunnel */
public void messageProcessed() { _messagesProcessed++; }
public void messageProcessed(int size) {
_messagesProcessed++;
_bytesProcessed += size;
}
/** how many bytes have been pumped through this tunnel in its lifetime? */
public long getBytesProcessed() { return _bytesProcessed; }
/**
* the tunnel was (potentially) unable to pass a message through.

View File

@@ -240,7 +240,7 @@ public class HandleTunnelMessageJob extends JobImpl {
if (info == null)
return;
info.messageProcessed();
info.messageProcessed(_message.getMessageSize());
//if ( (_message.getVerificationStructure() == null) && (info.getSigningKey() != null) ) {
if (_message.getVerificationStructure() == null) {

View File

@@ -121,7 +121,7 @@ public class SendTunnelMessageJob extends JobImpl {
}
}
info.messageProcessed();
info.messageProcessed(_message.getMessageSize());
if (isEndpoint(info)) {
if (_log.shouldLog(Log.INFO))

View File

@@ -68,6 +68,8 @@ class TunnelPool {
_context.statManager().createRateStat("tunnel.outboundMessagesProcessed", "How many messages does an inbound tunnel process in its lifetime?", "Tunnels", new long[] { 10*60*1000l, 60*60*1000l, 24*60*60*1000l });
_context.statManager().createRateStat("tunnel.participatingMessagesProcessed", "How many messages does an inbound tunnel process in its lifetime?", "Tunnels", new long[] { 10*60*1000l, 60*60*1000l, 24*60*60*1000l });
_context.statManager().createRateStat("tunnel.participatingMessagesProcessedActive", "How many messages beyond the average were processed in a more-than-average tunnel's lifetime?", "Tunnels", new long[] { 10*60*1000l, 60*60*1000l, 24*60*60*1000l });
_context.statManager().createRateStat("tunnel.participatingBytesProcessed", "How many bytes does an inbound tunnel process in its lifetime?", "Tunnels", new long[] { 10*60*1000l, 60*60*1000l, 24*60*60*1000l });
_context.statManager().createRateStat("tunnel.participatingBytesProcessedActive", "How many bytes beyond the average were processed in a more-than-average tunnel's lifetime?", "Tunnels", new long[] { 10*60*1000l, 60*60*1000l, 24*60*60*1000l });
_isLive = true;
_persistenceHelper = new TunnelPoolPersistenceHelper(_context);
@@ -662,6 +664,11 @@ class TunnelPool {
numMsgs-lastAvg,
info.getSettings().getExpiration() -
info.getSettings().getCreated());
long numBytes = info.getBytesProcessed();
lastAvg = (long)_context.statManager().getRate("tunnel.participatingBytesProcessed").getRate(10*60*1000l).getAverageValue();
_context.statManager().addRateData("tunnel.participatingBytesProcessed", numBytes, numMsgs);
if (numBytes > lastAvg)
_context.statManager().addRateData("tunnel.participatingBytesProcessedActive", numBytes-lastAvg, numMsgs);
break;
case TunnelId.TYPE_UNSPECIFIED:
default: