From d8fde14c3a30888b51bb7751982414905ed4e9b3 Mon Sep 17 00:00:00 2001
From: hermens <hermens@6c8d7289-2bf4-0310-a012-ef5d649a1542>
Date: Fri, 22 Sep 2006 12:44:58 +0000
Subject: [PATCH] Make maximum number of words in DHT-In cache configurable at
 runtime

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2652 6c8d7289-2bf4-0310-a012-ef5d649a1542
---
 htroot/PerformanceQueues_p.html | 12 ++++++++----
 htroot/PerformanceQueues_p.java | 13 +++++++++----
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/htroot/PerformanceQueues_p.html b/htroot/PerformanceQueues_p.html
index 86a2c82ee..ea34bf6bc 100644
--- a/htroot/PerformanceQueues_p.html
+++ b/htroot/PerformanceQueues_p.html
@@ -120,8 +120,11 @@
       </tr>
       <tr valign="top" class="TableCellDark">
         <td>Maximum number of words in cache:</td>
-        <td colspan="2">
-          <input name="wordCacheMaxCount" type="text" size="20" maxlength="100" value="#[wordCacheMaxCount]#" />
+        <td>
+          <input name="wordOutCacheMaxCount" type="text" size="10" maxlength="100" value="#[wordOutCacheMaxCount]#" />
+        </td>
+        <td>
+          <input name="wordInCacheMaxCount" type="text" size="10" maxlength="100" value="#[wordInCacheMaxCount]#" />
         </td>
         <td>
           This is is the number of word indexes that shall be held in the
@@ -131,9 +134,10 @@
       </tr>
       <tr valign="top" class="TableCellDark">
         <td>Initial space of words in cache:</td>
-        <td colspan="2">
-          <input name="wordCacheInitCount" type="text" size="20" maxlength="100" value="#[wordCacheInitCount]#" />
+        <td>
+          <input name="wordCacheInitCount" type="text" size="10" maxlength="100" value="#[wordCacheInitCount]#" />
         </td>
+        <td>-</td>
         <td>
           This is is the init size of space for words in cache.
         </td>
diff --git a/htroot/PerformanceQueues_p.java b/htroot/PerformanceQueues_p.java
index 4464233ca..b8e6aef55 100644
--- a/htroot/PerformanceQueues_p.java
+++ b/htroot/PerformanceQueues_p.java
@@ -171,9 +171,13 @@ public class PerformanceQueues_p {
         prop.put("table", c);
         
         if ((post != null) && (post.containsKey("cacheSizeSubmit"))) {
-            int wordCacheMaxCount = post.getInt("wordCacheMaxCount", 20000);
-            switchboard.setConfig("wordCacheMaxCount", Integer.toString(wordCacheMaxCount));
-            switchboard.wordIndex.setMaxWordCount(wordCacheMaxCount);
+            int wordOutCacheMaxCount = post.getInt("wordOutCacheMaxCount", 20000);
+            switchboard.setConfig("wordCacheMaxCount", Integer.toString(wordOutCacheMaxCount));
+            switchboard.wordIndex.setMaxWordCount(wordOutCacheMaxCount);
+
+            int wordInCacheMaxCount = post.getInt("wordInCacheMaxCount", 1000);
+            switchboard.setConfig("indexDistribution.dhtReceiptLimit", Integer.toString(wordInCacheMaxCount));
+            switchboard.wordIndex.setInMaxWordCount(wordInCacheMaxCount);
             
             int wordCacheInitCount = post.getInt("wordCacheInitCount", 30000);
             switchboard.setConfig("wordCacheInitCount", Integer.toString(wordCacheInitCount));
@@ -268,7 +272,8 @@ public class PerformanceQueues_p {
         prop.put("minAgeOfWCache", "" + (switchboard.wordIndex.minAgeOfDHTOutCache() / 1000 / 60)); // minutes
         prop.put("minAgeOfKCache", "" + (switchboard.wordIndex.minAgeOfDHTInCache() / 1000 / 60)); // minutes
         prop.put("maxWaitingWordFlush", switchboard.getConfig("maxWaitingWordFlush", "180"));
-        prop.put("wordCacheMaxCount", switchboard.getConfigLong("wordCacheMaxCount", 20000));
+        prop.put("wordOutCacheMaxCount", switchboard.getConfigLong("wordCacheMaxCount", 20000));
+        prop.put("wordInCacheMaxCount", switchboard.getConfigLong("indexDistribution.dhtReceiptLimit", 1000));
         prop.put("wordCacheInitCount", switchboard.getConfigLong("wordCacheInitCount", 30000));
         prop.put("wordFlushIdleDivisor", switchboard.getConfigLong("wordFlushIdleDivisor", 420));
         prop.put("wordFlushBusyDivisor", switchboard.getConfigLong("wordFlushBusyDivisor", 5000));