Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

implemented automatic adoption of chunk-read-ahead in kelondroTree to needed chunk size

orbitera37b09e30376
diff --git a/build.properties b/build.properties
index 46632d8a2..85db3bd12 100644
--- a/build.properties
+++ b/build.properties
@@ -3,7 +3,7 @@ javacSource=1.4
javacTarget=1.4
# Release Configuration
-releaseVersion=0.441
+releaseVersion=0.442
releaseFile=yacy_dev_v${releaseVersion}_${DSTAMP}_${releaseNr}.tar.gz
#releaseFile=yacy_v${releaseVersion}_${DSTAMP}_${releaseNr}.tar.gz
releaseDir=yacy_dev_v${releaseVersion}_${DSTAMP}_${releaseNr}
diff --git a/source/de/anomic/kelondro/kelondroTree.java b/source/de/anomic/kelondro/kelondroTree.java
index 9770ce5b5..e69e43d82 100644
--- a/source/de/anomic/kelondro/kelondroTree.java
+++ b/source/de/anomic/kelondro/kelondroTree.java
@@ -83,6 +83,8 @@ public class kelondroTree extends kelondroRecords implements kelondroIndex {
private Search writeSearchObj = new Search();
protected kelondroOrder objectOrder = new kelondroNaturalOrder(true);
private final kelondroOrder loopDetectionOrder = new kelondroNaturalOrder(true);
+ private int readAheadChunkSize = 100;
+ private long lastIteratorCount = readAheadChunkSize;
public kelondroTree(File file, long buffersize, int key, int value, boolean exitOnFail) {
this(file, buffersize, new int[] { key, value }, new kelondroNaturalOrder(true), 1, 8, exitOnFail);
@@ -1057,9 +1059,12 @@ public class kelondroTree extends kelondroRecords implements kelondroIndex {
rot = rotating;
count = 0;
lastKey = null;
- chunkSize = (int) Math.min(100, guessedCountLimit);
+ //System.out.println("*** rowIterator: " + filename + ": readAheadChunkSize = " + readAheadChunkSize + ", lastIteratorCount = " + lastIteratorCount);
+ readAheadChunkSize = Math.min(1000, 3 + (int) ((3 * readAheadChunkSize + lastIteratorCount) / 4));
+ chunkSize = (int) Math.min(readAheadChunkSize / 3, guessedCountLimit);
rowBuffer = rowMap(inc, rot, start, true, chunkSize);
bufferIterator = rowBuffer.entrySet().iterator();
+ lastIteratorCount = 0;
}
public boolean hasNext() {
@@ -1085,6 +1090,7 @@ public class kelondroTree extends kelondroRecords implements kelondroIndex {
// return the row
count++;
+ lastIteratorCount++;
return entry.getValue();
}
@@ -1114,9 +1120,12 @@ public class kelondroTree extends kelondroRecords implements kelondroIndex {
rot = rotating;
count = 0;
lastKey = null;
- chunkSize = (int) Math.min(100, guessedCountLimit);
+ //System.out.println("*** keyIterator: " + filename + ": readAheadChunkSize = " + readAheadChunkSize + ", lastIteratorCount = " + lastIteratorCount);
+ readAheadChunkSize = Math.min(1000, 3 + (int) ((3 * readAheadChunkSize + lastIteratorCount) / 4));
+ chunkSize = (int) Math.min(readAheadChunkSize / 3, guessedCountLimit);
keyBuffer = keySet(inc, rot, start, true, chunkSize);
bufferIterator = keyBuffer.iterator();
+ lastIteratorCount = 0;
}
public boolean hasNext() {
@@ -1141,6 +1150,7 @@ public class kelondroTree extends kelondroRecords implements kelondroIndex {
// return the row
count++;
+ lastIteratorCount++;
return lastKey;
}