Skip to content

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

finetuning

orbiterdd560e4b2f96
diff --git a/source/de/anomic/kelondro/kelondroRecords.java b/source/de/anomic/kelondro/kelondroRecords.java
index 4e216b32c..6a7842bbe 100644
--- a/source/de/anomic/kelondro/kelondroRecords.java
+++ b/source/de/anomic/kelondro/kelondroRecords.java
@@ -81,7 +81,7 @@ public class kelondroRecords {
// constants
private static final int NUL = Integer.MIN_VALUE; // the meta value for the kelondroRecords' NUL abstraction
- private static final long memBlock = 50000000; // do not fill cache further if the amount of available memory is less that this
+ private static final long memBlock = 500000; // do not fill cache further if the amount of available memory is less that this
public final static boolean useWriteBuffer = false;
// memory calculation
@@ -427,9 +427,9 @@ public class kelondroRecords {
this.cacheScore = new kelondroMScoreCluster(); // cache control of CP_HIGH caches
}
this.cacheHeaders = new kelondroIntBytesMap[]{
+ new kelondroIntBytesMap(this.headchunksize, this.cacheSize / 4),
new kelondroIntBytesMap(this.headchunksize, 0),
- new kelondroIntBytesMap(this.headchunksize, 0),
- new kelondroIntBytesMap(this.headchunksize, this.cacheSize / 2)
+ new kelondroIntBytesMap(this.headchunksize, this.cacheSize / 4)
};
this.cacheHeaders[0].setOrdering(kelondroNaturalOrder.naturalOrder, 0);
this.cacheHeaders[1].setOrdering(kelondroNaturalOrder.naturalOrder, 0);
@@ -447,7 +447,7 @@ public class kelondroRecords {
private static final long max = Runtime.getRuntime().maxMemory();
private static final Runtime runtime = Runtime.getRuntime();
- private static long availableMemory() {
+ public static long availableMemory() {
// memory that is available including increasing total memory up to maximum
return max - runtime.totalMemory() + runtime.freeMemory();
}
@@ -930,9 +930,9 @@ public class kelondroRecords {
// we simply clear the cache
String error = "cachScore error: " + e.getMessage() + "; cachesize=" + cacheSize + ", cache.size()=[" + cacheHeaders[0].size() + "," + cacheHeaders[1].size() + "," + cacheHeaders[2].size() + "], cacheScore.size()=" + cacheScore.size();
cacheScore = new kelondroMScoreCluster();
- cacheHeaders[CP_LOW] = new kelondroIntBytesMap(headchunksize, 0);
+ cacheHeaders[CP_LOW] = new kelondroIntBytesMap(headchunksize, cacheSize / 4);
cacheHeaders[CP_MEDIUM] = new kelondroIntBytesMap(headchunksize, 0);
- cacheHeaders[CP_HIGH] = new kelondroIntBytesMap(headchunksize, cacheSize / 2);
+ cacheHeaders[CP_HIGH] = new kelondroIntBytesMap(headchunksize, cacheSize / 4);
cacheHeaders[0].setOrdering(kelondroNaturalOrder.naturalOrder, 0);
cacheHeaders[1].setOrdering(kelondroNaturalOrder.naturalOrder, 0);
cacheHeaders[2].setOrdering(kelondroNaturalOrder.naturalOrder, 0);
diff --git a/source/de/anomic/kelondro/kelondroRowBufferedSet.java b/source/de/anomic/kelondro/kelondroRowBufferedSet.java
index f5240259e..679c4f933 100644
--- a/source/de/anomic/kelondro/kelondroRowBufferedSet.java
+++ b/source/de/anomic/kelondro/kelondroRowBufferedSet.java
@@ -31,7 +31,9 @@ import java.util.Random;
public class kelondroRowBufferedSet extends kelondroRowSet {
- private static final int bufferFlushLimit = 10000;
+ private static final long memBlockLimit = 2000000; // do not fill cache further if the amount of available memory is less that this
+ private static final int bufferFlushLimit = 100000;
+ private static final int bufferFlushMinimum = 1000;
private final boolean useRowCollection = true;
private TreeMap buffer; // this must be a TreeSet bacause HashMap does not work with byte[]
@@ -145,7 +147,8 @@ public class kelondroRowBufferedSet extends kelondroRowSet {
if (oldentry == null) {
// this was not anywhere
buffer.put(key, newentry);
- if (buffer.size() > bufferFlushLimit) flush();
+ if (((buffer.size() > bufferFlushMinimum) && (kelondroRecords.availableMemory() > memBlockLimit)) ||
+ (buffer.size() > bufferFlushLimit)) flush();
return null;
} else {
// replace old entry