summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfuchsi <fuchsi@6c8d7289-2bf4-0310-a012-ef5d649a1542>2007-10-19 21:47:07 +0000
committerfuchsi <fuchsi@6c8d7289-2bf4-0310-a012-ef5d649a1542>2007-10-19 21:47:07 +0000
commit35303f95046e017748dc0f96ec304e388ff1ecbb (patch)
tree64a691d1d1e71d4973dfe58621fc7947762c9d01
parenta9aef8e5e0349fd31bc6db4caf6db367987f86b9 (diff)
add real size values (KBytes) of the DHT-In/Out-RAM-Caches to the PerformanceQueues page. A lot of users seem to tweak this value and it might help in finding the best size in relation to the peer's memory ressources.
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4169 6c8d7289-2bf4-0310-a012-ef5d649a1542
-rw-r--r--htroot/PerformanceQueues_p.html6
-rw-r--r--htroot/PerformanceQueues_p.java2
-rw-r--r--source/de/anomic/plasma/plasmaWordIndex.java17
3 files changed, 21 insertions, 4 deletions
diff --git a/htroot/PerformanceQueues_p.html b/htroot/PerformanceQueues_p.html
index 2140175a0..6d9a1d083 100644
--- a/htroot/PerformanceQueues_p.html
+++ b/htroot/PerformanceQueues_p.html
@@ -84,9 +84,9 @@
</td>
</tr>
<tr valign="top" class="TableCellDark">
- <td>Words in RAM cache:</td>
- <td>#[wordCacheWSize]#</td>
- <td>#[wordCacheKSize]#</td>
+ <td>Words in RAM cache:<br>(Size in KBytes)</td>
+ <td>#[wordCacheWSize]#<br>(#[wordCacheWSizeKBytes]# KB)</td>
+ <td>#[wordCacheKSize]#<br>(#[wordCacheKSizeKBytes]# KB)</td>
<td>
This is the current size of the word caches.
The indexing cache speeds up the indexing process, the DHT cache holds indexes temporary for approval.
diff --git a/htroot/PerformanceQueues_p.java b/htroot/PerformanceQueues_p.java
index 0f81f7875..992352b7a 100644
--- a/htroot/PerformanceQueues_p.java
+++ b/htroot/PerformanceQueues_p.java
@@ -295,6 +295,8 @@ public class PerformanceQueues_p {
prop.put("urlCacheSize", switchboard.wordIndex.loadedURL.writeCacheSize());
prop.put("wordCacheWSize", switchboard.wordIndex.dhtOutCacheSize());
prop.put("wordCacheKSize", switchboard.wordIndex.dhtInCacheSize());
+ prop.putNum("wordCacheWSizeKBytes", switchboard.wordIndex.dhtCacheSizeBytes(false)/1024);
+ prop.putNum("wordCacheKSizeKBytes", switchboard.wordIndex.dhtCacheSizeBytes(true)/1024);
prop.put("maxURLinWCache", "" + switchboard.wordIndex.maxURLinDHTOutCache());
prop.put("maxURLinKCache", "" + switchboard.wordIndex.maxURLinDHTInCache());
prop.put("maxAgeOfWCache", "" + (switchboard.wordIndex.maxAgeOfDHTOutCache() / 1000 / 60)); // minutes
diff --git a/source/de/anomic/plasma/plasmaWordIndex.java b/source/de/anomic/plasma/plasmaWordIndex.java
index ad5a9db54..b632e6969 100644
--- a/source/de/anomic/plasma/plasmaWordIndex.java
+++ b/source/de/anomic/plasma/plasmaWordIndex.java
@@ -125,6 +125,21 @@ public final class plasmaWordIndex implements indexRI {
public int dhtInCacheSize() {
return dhtInCache.size();
}
+
+ public long dhtCacheSizeBytes(boolean in) {
+ // calculate the real size in bytes of DHT-In/Out-Cache
+ long cacheBytes = 0;
+ long entryBytes = indexRWIEntry.urlEntryRow.objectsize();
+ indexRAMRI cache = (in ? dhtInCache : dhtOutCache);
+ Iterator it = cache.wordContainers(null, false);
+ indexContainer ic;
+ while ( it.hasNext() ) {
+ ic = (indexContainer)it.next();
+ cacheBytes += ic.size() * entryBytes;
+ }
+
+ return cacheBytes;
+ }
public void setMaxWordCount(int maxWords) {
dhtOutCache.setMaxWordCount(maxWords);
@@ -520,7 +535,7 @@ public final class plasmaWordIndex implements indexRI {
public synchronized kelondroCloneableIterator wordContainers(String startWordHash, boolean ram) {
kelondroOrder containerOrder = new indexContainerOrder((kelondroOrder) indexOrder.clone());
- containerOrder.rotate(startWordHash.getBytes());
+ containerOrder.rotate(startWordHash.getBytes());
if (ram) {
return dhtOutCache.wordContainers(startWordHash, false);
} else {