diff --git a/htroot/PerformanceQueues_p.java b/htroot/PerformanceQueues_p.java index 72b07c667..762133131 100644 --- a/htroot/PerformanceQueues_p.java +++ b/htroot/PerformanceQueues_p.java @@ -227,6 +227,7 @@ public class PerformanceQueues_p { final int wordCacheMaxCount = post.getInt("wordCacheMaxCount", 20000); switchboard.setConfig(plasmaSwitchboardConstants.WORDCACHE_MAX_COUNT, Integer.toString(wordCacheMaxCount)); switchboard.webIndex.setMaxWordCount(wordCacheMaxCount); + switchboard.setConfig(plasmaSwitchboardConstants.INDEX_DIST_DHT_RECEIPT_LIMIT, wordCacheMaxCount); final int wordCacheInitCount = post.getInt(plasmaSwitchboardConstants.WORDCACHE_INIT_COUNT, 30000); switchboard.setConfig(plasmaSwitchboardConstants.WORDCACHE_INIT_COUNT, Integer.toString(wordCacheInitCount)); diff --git a/htroot/yacy/transferRWI.java b/htroot/yacy/transferRWI.java index 7b1a27148..2cd63f09f 100644 --- a/htroot/yacy/transferRWI.java +++ b/htroot/yacy/transferRWI.java @@ -35,6 +35,7 @@ import de.anomic.http.httpRequestHeader; import de.anomic.index.indexRWIRowEntry; import de.anomic.index.indexReferenceBlacklist; import de.anomic.plasma.plasmaSwitchboard; +import de.anomic.plasma.plasmaSwitchboardConstants; import de.anomic.server.serverCore; import de.anomic.server.serverObjects; import de.anomic.server.serverSwitch; @@ -81,7 +82,7 @@ public final class transferRWI { boolean granted = sb.getConfig("allowReceiveIndex", "false").equals("true"); final boolean blockBlacklist = sb.getConfig("indexReceiveBlockBlacklist", "false").equals("true"); final boolean checkLimit = sb.getConfigBool("indexDistribution.transferRWIReceiptLimitEnabled", true); - final long cachelimit = sb.getConfigLong("indexDistribution.dhtReceiptLimit", 10000); + final long cachelimit = sb.getConfigLong(plasmaSwitchboardConstants.INDEX_DIST_DHT_RECEIPT_LIMIT, 10000); final yacySeed otherPeer = sb.webIndex.seedDB.get(iam); final String otherPeerName = iam + ":" + ((otherPeer == null) ? "NULL" : (otherPeer.getName() + "/" + otherPeer.getVersion())); diff --git a/source/de/anomic/plasma/plasmaWordIndex.java b/source/de/anomic/plasma/plasmaWordIndex.java index efb1ded01..0e5eec57f 100644 --- a/source/de/anomic/plasma/plasmaWordIndex.java +++ b/source/de/anomic/plasma/plasmaWordIndex.java @@ -527,11 +527,19 @@ public final class plasmaWordIndex implements indexRI { } private synchronized void flushCacheUntil(long timeout) { - while (System.currentTimeMillis() < timeout && - (dhtOutCache.size() > 0 || dhtInCache.size() > 0)) { - flushCacheOne(dhtOutCache); + long timeout0 = System.currentTimeMillis() + (timeout - System.currentTimeMillis()) / 10 * 6; + // we give 60% for dhtIn to prefer filling of cache with dht transmission + //int cIn = 0; + while (System.currentTimeMillis() < timeout0 && dhtInCache.size() > 0) { flushCacheOne(dhtInCache); + //cIn++; } + //int cOut = 0; + while (System.currentTimeMillis() < timeout && dhtOutCache.size() > 0) { + flushCacheOne(dhtOutCache); + //cOut++; + } + //System.out.println("*** DEBUG cache flush: cIn = " + cIn + ", cOut = " + cOut); } private synchronized void flushCacheOne(final indexRAMRI ram) {