Skip to content

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

some correction algorithm for preload time computation during assortment open

orbiterb0ca5fa78409
diff --git a/source/de/anomic/plasma/plasmaWordIndexAssortment.java b/source/de/anomic/plasma/plasmaWordIndexAssortment.java
index 81ea5e6a7..a116941e8 100644
--- a/source/de/anomic/plasma/plasmaWordIndexAssortment.java
+++ b/source/de/anomic/plasma/plasmaWordIndexAssortment.java
@@ -114,12 +114,15 @@ public final class plasmaWordIndexAssortment {
if (assortmentFile.exists()) {
// open existing assortment tree file
try {
+ long start = System.currentTimeMillis();
assortments = new kelondroTree(assortmentFile, bufferSize, preloadTime, kelondroTree.defaultObjectCachePercent);
+ long stop = System.currentTimeMillis();
if (log != null)
- log.logConfig("Opened Assortment Database, " +
+ log.logConfig("Opened Assortment, " +
assortments.size() + " entries, width " +
assortmentLength + ", " + bufferkb + "kb buffer, " +
preloadTime + " ms preloadTime, " +
+ (stop - start) + " ms effective, " +
assortments.cacheNodeStatus()[1] + " preloaded");
return;
} catch (IOException e){
@@ -131,7 +134,7 @@ public final class plasmaWordIndexAssortment {
}
// create new assortment tree file
assortments = new kelondroTree(assortmentFile, bufferSize, preloadTime, kelondroTree.defaultObjectCachePercent, new kelondroRow(bufferStructure(assortmentLength)), true);
- if (log != null) log.logConfig("Created new Assortment Database, width " + assortmentLength + ", " + bufferkb + "kb buffer");
+ if (log != null) log.logConfig("Created new Assortment, width " + assortmentLength + ", " + bufferkb + "kb buffer");
}
public void store(indexContainer newContainer) {
diff --git a/source/de/anomic/plasma/plasmaWordIndexAssortmentCluster.java b/source/de/anomic/plasma/plasmaWordIndexAssortmentCluster.java
index 746b192db..7e8841191 100644
--- a/source/de/anomic/plasma/plasmaWordIndexAssortmentCluster.java
+++ b/source/de/anomic/plasma/plasmaWordIndexAssortmentCluster.java
@@ -95,12 +95,19 @@ public final class plasmaWordIndexAssortmentCluster extends indexAbstractRI impl
// initialize cluster using the cluster elements size for optimal buffer
// size
+ long nextTime;
+ long startTime;
+ long sS = (long) sumSizes;
for (int i = 0; i < clusterCount; i++) {
+ nextTime = Math.max(0, preloadTime * ((long) sizes[i]) / sS);
+ startTime = System.currentTimeMillis();
assortments[i] = new plasmaWordIndexAssortment(
assortmentsPath, i + 1,
(int) (completeBufferKB * (long) sizes[i] / (long) sumSizes),
- preloadTime * (long) sizes[i] / (long) sumSizes,
+ nextTime,
log);
+ preloadTime -= System.currentTimeMillis() - startTime;
+ sS -= sizes[i];
}
}