Tunnels: New Bloom filter size, increase bandwidth limit (ticket #1505)

This commit is contained in:
zzz
2015-07-08 13:40:26 +00:00
parent 817888c23c
commit 2c191e7bf8
3 changed files with 21 additions and 4 deletions

View File

@ -75,7 +75,7 @@ public class FIFOBandwidthRefiller implements Runnable {
* Do not increase without adding a new Bloom filter size!
* See util/DecayingBloomFilter and tunnel/BloomFilterIVValidator.
*/
public static final int MAX_OUTBOUND_BANDWIDTH = 8192;
public static final int MAX_OUTBOUND_BANDWIDTH = 16384;
/**
* how often we replenish the queues.

View File

@ -30,10 +30,12 @@ class BloomFilterIVValidator implements IVValidator {
private static final int MIN_SHARE_KBPS_FOR_BIG_BLOOM = 512;
private static final int MIN_SHARE_KBPS_FOR_HUGE_BLOOM = 1536;
private static final int MIN_SHARE_KBPS_FOR_HUGE2_BLOOM = 4096;
private static final int MIN_SHARE_KBPS_FOR_HUGE3_BLOOM = 8192;
private static final long MIN_MEM_TO_USE_BLOOM = 64*1024*1024l;
private static final long MIN_MEM_FOR_BIG_BLOOM = 128*1024*1024l;
private static final long MIN_MEM_FOR_HUGE_BLOOM = 256*1024*1024l;
private static final long MIN_MEM_FOR_HUGE2_BLOOM = 384*1024*1024l;
private static final long MIN_MEM_FOR_HUGE3_BLOOM = 512*1024*1024l;
/** for testing */
private static final String PROP_FORCE = "router.forceDecayingBloomFilter";
/** for testing */
@ -57,8 +59,12 @@ class BloomFilterIVValidator implements IVValidator {
if (KBps >= MIN_SHARE_KBPS_TO_USE_BLOOM)
warn(maxMemory, KBps, MIN_MEM_TO_USE_BLOOM, MIN_SHARE_KBPS_TO_USE_BLOOM);
_filter = new DecayingHashSet(ctx, HALFLIFE_MS, 16, "TunnelIVV"); // appx. 4MB max
} else if (KBps >= MIN_SHARE_KBPS_FOR_HUGE3_BLOOM && maxMemory >= MIN_MEM_FOR_HUGE3_BLOOM) {
_filter = new DecayingBloomFilter(ctx, HALFLIFE_MS, 16, "TunnelIVV", 27); // 32MB fixed
} else if (KBps >= MIN_SHARE_KBPS_FOR_HUGE2_BLOOM && maxMemory >= MIN_MEM_FOR_HUGE2_BLOOM) {
_filter = new DecayingBloomFilter(ctx, HALFLIFE_MS, 16, "TunnelIVV", 26); // 16MB fixed
if (KBps >= MIN_SHARE_KBPS_FOR_HUGE3_BLOOM)
warn(maxMemory, KBps, MIN_MEM_FOR_HUGE3_BLOOM, MIN_SHARE_KBPS_FOR_HUGE3_BLOOM);
} else if (KBps >= MIN_SHARE_KBPS_FOR_HUGE_BLOOM && maxMemory >= MIN_MEM_FOR_HUGE_BLOOM) {
if (KBps >= MIN_SHARE_KBPS_FOR_HUGE2_BLOOM)
warn(maxMemory, KBps, MIN_MEM_FOR_HUGE2_BLOOM, MIN_SHARE_KBPS_FOR_HUGE2_BLOOM);

View File

@ -86,16 +86,24 @@ public class DecayingBloomFilter {
this(context, durationMs, entryBytes, name, context.getProperty("router.decayingBloomFilterM", DEFAULT_M));
}
/** @param m filter size exponent */
/**
* @param m filter size exponent, max is 29
*/
public DecayingBloomFilter(I2PAppContext context, int durationMs, int entryBytes, String name, int m) {
_context = context;
_log = context.logManager().getLog(DecayingBloomFilter.class);
_entryBytes = entryBytes;
_name = name;
int k = DEFAULT_K;
// max is (23,11) or (26,10); see KeySelector for details
if (m > DEFAULT_M)
// max is (23,11) or (26,10) or (29,9); see KeySelector for details
if (m > DEFAULT_M) {
k--;
if (m > 26) {
k--;
if (m > 29)
throw new IllegalArgumentException("Max m is 29");
}
}
_current = new BloomSHA1(m, k);
_previous = new BloomSHA1(m, k);
_durationMs = durationMs;
@ -375,6 +383,9 @@ public class DecayingBloomFilter {
*
* Following stats for m=26, k=10:
* 4096 7.3E-6; 5120 4.5E-5; 6144 1.8E-4; 8192 0.14%; 10240 0.6%, 12288 1.7%
*
* Following stats for m=27, k=9:
* 8192 1.1E-5; 10240 5.6E-5; 12288 2.0E-4; 14336 5.8E-4; 16384 0.14%
*</pre>
*/
/*****