I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit ea9c4a19 authored by zzz's avatar zzz
Browse files

Router, naming, I2CP: Increase lookup cache max sizes (except on Android),

reduce max lookup depth, and increase non-floodfill profile bonus
to attempt to reduce load on floodfills
parent 7680ecbd
No related branches found
No related tags found
No related merge requests found
......@@ -170,11 +170,12 @@ public abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2
private volatile boolean _routerSupportsFastReceive;
private volatile boolean _routerSupportsHostLookup;
protected static final int CACHE_MAX_SIZE = SystemVersion.isAndroid() ? 32 : 128;
/**
* Since 0.9.11, key is either a Hash or a String
* @since 0.8.9
*/
private static final Map<Object, Destination> _lookupCache = new LHMCache<Object, Destination>(64);
private static final Map<Object, Destination> _lookupCache = new LHMCache<Object, Destination>(CACHE_MAX_SIZE);
private static final String MIN_HOST_LOOKUP_VERSION = "0.9.11";
private static final boolean TEST_LOOKUP = false;
......
......@@ -15,6 +15,7 @@ import net.i2p.I2PAppContext;
import net.i2p.client.I2PSessionException;
import net.i2p.data.Destination;
import net.i2p.util.LHMCache;
import net.i2p.util.SystemVersion;
/**
* A Dummy naming service that can only handle base64 and b32 destinations.
......@@ -23,7 +24,7 @@ class DummyNamingService extends NamingService {
protected static final int BASE32_HASH_LENGTH = 52; // 1 + Hash.HASH_LENGTH * 8 / 5
public final static String PROP_B32 = "i2p.naming.hostsTxt.useB32";
protected static final int CACHE_MAX_SIZE = 32;
protected static final int CACHE_MAX_SIZE = SystemVersion.isAndroid() ? 32 : 128;
public static final int DEST_SIZE = 516; // Std. Base64 length (no certificate)
/**
......
......@@ -74,7 +74,7 @@ class IterativeSearchJob extends FloodSearchJob {
private static final int MAX_NON_FF = 3;
/** Max number of peers to query */
private static final int TOTAL_SEARCH_LIMIT = 6;
private static final int TOTAL_SEARCH_LIMIT = 5;
/** Max number of peers to query if we are ff */
private static final int TOTAL_SEARCH_LIMIT_WHEN_FF = 3;
/** TOTAL_SEARCH_LIMIT * SINGLE_SEARCH_TIME, plus some extra */
......@@ -539,16 +539,20 @@ class IterativeSearchJob extends FloodSearchJob {
unheard = new ArrayList<Hash>(_unheardFrom);
}
// blame the unheard-from (others already blamed in failed() above)
for (Hash h : unheard)
for (Hash h : unheard) {
getContext().profileManager().dbLookupFailed(h);
}
long time = System.currentTimeMillis() - _created;
if (_log.shouldLog(Log.INFO)) {
long timeRemaining = _expiration - getContext().clock().now();
_log.info(getJobId() + ": ISJ for " + _key + " failed with " + timeRemaining + " remaining after " + time +
", peers queried: " + tries);
}
getContext().statManager().addRateData("netDb.failedTime", time);
getContext().statManager().addRateData("netDb.failedRetries", Math.max(0, tries - 1));
if (tries > 0) {
// don't bias the stats with immediate fails
getContext().statManager().addRateData("netDb.failedTime", time);
getContext().statManager().addRateData("netDb.failedRetries", tries - 1);
}
for (Job j : _onFailed) {
getContext().jobQueue().addJob(j);
}
......
......@@ -29,7 +29,7 @@ class CapacityCalculator {
private static final double PENALTY_UNREACHABLE = 2;
// we make this a bonus for non-ff, not a penalty for ff, so we
// don't drive the ffs below the default
private static final double BONUS_NON_FLOODFILL = 0.5;
private static final double BONUS_NON_FLOODFILL = 1.0;
public static double calc(PeerProfile profile) {
double capacity;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment