2005-01-12 jrandom

* Only create the loadtest.log if requested to do so (thanks zzz!)
    * Make sure we cleanly take into consideration the appropriate data
      points when filtering out duplicate messages in the message validator,
      and report the right bloom filter false positives rate (not used for
      anything except debugging)
This commit is contained in:
jrandom
2006-01-12 19:35:54 +00:00
committed by zzz
parent a638301b5c
commit 205d8de281
5 changed files with 32 additions and 17 deletions

View File

@ -112,6 +112,7 @@ public class BloomSHA1 {
for (int i = 0; i < filterWords; i++) {
filter[i] = 0;
}
count = 0;
}
/** Synchronized version */
public void clear() {
@ -198,7 +199,7 @@ public class BloomSHA1 {
public final double falsePositives(int n) {
// (1 - e(-kN/M))^k
return java.lang.Math.pow (
(1l - java.lang.Math.exp( ((double)k) * (long)n / (long)filterBits)), (long)k);
(1l - java.lang.Math.exp(0d- ((double)k) * (long)n / (long)filterBits)), (long)k);
}
public final double falsePositives() {

View File

@ -1,4 +1,11 @@
$Id: history.txt,v 1.384 2006/01/11 18:19:38 jrandom Exp $
$Id: history.txt,v 1.385 2006/01/12 04:59:57 cervantes Exp $
2005-01-12 jrandom
* Only create the loadtest.log if requested to do so (thanks zzz!)
* Make sure we cleanly take into consideration the appropriate data
points when filtering out duplicate messages in the message validator,
and report the right bloom filter false positives rate (not used for
anything except debugging)
2005-01-12 cervantes
* Syndie CSS tweaks to removed some redundant declarations, improve font

View File

@ -45,15 +45,21 @@ public class LoadTestManager {
private Writer _out;
private List _untestedPeers;
private List _active;
private static final String PROP_LOG_DATA = "router.loadTestLog";
private static final String DEFAULT_LOG_DATA = "false";
public LoadTestManager(RouterContext ctx) {
_context = ctx;
_log = ctx.logManager().getLog(LoadTestManager.class);
_active = Collections.synchronizedList(new ArrayList());
try {
_out = new BufferedWriter(new FileWriter("loadtest.log", true));
_out.write("startup at " + ctx.clock().now() + "\n");
} catch (IOException ioe) {
_log.log(Log.CRIT, "error creating log", ioe);
if (Boolean.valueOf(ctx.getProperty(PROP_LOG_DATA, DEFAULT_LOG_DATA)).booleanValue()) {
try {
_out = new BufferedWriter(new FileWriter("loadtest.log", true));
_out.write("startup at " + ctx.clock().now() + "\n");
} catch (IOException ioe) {
_log.log(Log.CRIT, "error creating log", ioe);
}
}
_context.statManager().createRateStat("test.lifetimeSuccessful", "How many messages we can pump through a load test during a tunnel's lifetime", "test", new long[] { 60*1000, 5*60*1000, 60*60*1000 });
_context.statManager().createRateStat("test.lifetimeFailed", "How many messages we fail to pump through (period == successful)", "test", new long[] { 60*1000, 5*60*1000, 60*60*1000 });
@ -373,7 +379,7 @@ public class LoadTestManager {
}
private void log(LoadTestTunnelConfig tunnel, String msg) {
//if (!_log.shouldLog(Log.INFO)) return;
if (_out == null) return;
StringBuffer buf = new StringBuffer(128);
if (tunnel.getInbound() == null) {
for (int i = 0; i < tunnel.getLength()-1; i++) {

View File

@ -40,8 +40,8 @@ public class MessageValidator {
boolean isDuplicate = noteReception(messageId, expiration);
if (isDuplicate) {
if (_log.shouldLog(Log.WARN))
_log.warn("Rejecting message " + messageId + " because it is a duplicate", new Exception("Duplicate origin"));
if (_log.shouldLog(Log.INFO))
_log.info("Rejecting message " + messageId + " because it is a duplicate", new Exception("Duplicate origin"));
_context.statManager().addRateData("router.duplicateMessageId", 1, 0);
return "duplicate";
} else {
@ -56,13 +56,13 @@ public class MessageValidator {
public String validateMessage(long expiration) {
long now = _context.clock().now();
if (now - Router.CLOCK_FUDGE_FACTOR >= expiration) {
if (_log.shouldLog(Log.WARN))
_log.warn("Rejecting message because it expired " + (now-expiration) + "ms ago");
if (_log.shouldLog(Log.INFO))
_log.info("Rejecting message because it expired " + (now-expiration) + "ms ago");
_context.statManager().addRateData("router.invalidMessageTime", (now-expiration), 0);
return "expired " + (now-expiration) + "ms ago";
} else if (now + 4*Router.CLOCK_FUDGE_FACTOR < expiration) {
if (_log.shouldLog(Log.WARN))
_log.warn("Rejecting message because it will expire too far in the future (" + (expiration-now) + "ms)");
if (_log.shouldLog(Log.INFO))
_log.info("Rejecting message because it will expire too far in the future (" + (expiration-now) + "ms)");
_context.statManager().addRateData("router.invalidMessageTime", (now-expiration), 0);
return "expire too far in the future (" + (expiration-now) + "ms)";
}
@ -82,7 +82,8 @@ public class MessageValidator {
private boolean noteReception(long messageId, long messageExpiration) {
long val = messageId;
// tweak the high order bits with the message expiration /seconds/
val ^= (messageExpiration & TIME_MASK) << 16;
////val ^= (messageExpiration & TIME_MASK) << 16;
val ^= (messageExpiration & TIME_MASK);
boolean dup = _filter.add(val);
if (dup && _log.shouldLog(Log.WARN)) {
_log.warn("Duplicate with " + _filter.getCurrentDuplicateCount()

View File

@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
public final static String ID = "$Revision: 1.329 $ $Date: 2006/01/11 15:32:36 $";
public final static String ID = "$Revision: 1.330 $ $Date: 2006/01/12 05:00:26 $";
public final static String VERSION = "0.6.1.8";
public final static long BUILD = 13;
public final static long BUILD = 14;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
System.out.println("Router ID: " + RouterVersion.ID);