Skip to content

Commit

Permalink
better dht-in cache flush. see also:
Browse files Browse the repository at this point in the history
  • Loading branch information
orbiter committed Jan 11, 2009
1 parent 941ab78 commit efe8011
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions htroot/PerformanceQueues_p.java
Expand Up @@ -227,6 +227,7 @@ else if (threadName.equals(plasmaSwitchboardConstants.CRAWLJOB_REMOTE_CRAWL_LOAD
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));
Expand Down
3 changes: 2 additions & 1 deletion htroot/yacy/transferRWI.java
Expand Up @@ -35,6 +35,7 @@
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;
Expand Down Expand Up @@ -81,7 +82,7 @@ public static serverObjects respond(final httpRequestHeader header, final server
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()));

Expand Down
14 changes: 11 additions & 3 deletions source/de/anomic/plasma/plasmaWordIndex.java
Expand Up @@ -527,11 +527,19 @@ public void flushCacheFor(int time) {
}

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) {
Expand Down

0 comments on commit efe8011

Please sign in to comment.