various configuration options in memory performance

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@763 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 19 years ago
parent 2f732e32a2
commit 07f30931ec

@ -19,7 +19,7 @@
<td class="small">After Startup<br>&nbsp;</td> <td class="small">After Startup<br>&nbsp;</td>
<td class="small">After Initializations<br>before GC</td> <td class="small">After Initializations<br>before GC</td>
<td class="small">After Initializations<br>after GC</td> <td class="small">After Initializations<br>after GC</td>
<td class="small">Now<br>&nbsp;</td> <td class="small">Now<br>#(gc)#before <a href="PerformanceMemory_p.html?gc=">GC</a>::after GC#(/gc)#</td>
<td class="small">Description<br>&nbsp;</td> <td class="small">Description<br>&nbsp;</td>
</tr> </tr>
<tr class="TableCellDark"> <tr class="TableCellDark">
@ -28,6 +28,14 @@
<td class="small" align="left">maximum memory that the JVM will attempt to use</td> <td class="small" align="left">maximum memory that the JVM will attempt to use</td>
</tr> </tr>
<tr class="TableCellDark"> <tr class="TableCellDark">
<td class="TableHeader" align="left">Available</td>
<td class="small" align="right">#[memoryAvailAfterStartup]# KByte</td>
<td class="small" align="right">#[memoryAvailAfterInitBGC]# KByte</td>
<td class="small" align="right">#[memoryAvailAfterInitAGC]# KByte</td>
<td class="small" align="right">#[memoryAvailNow]# MByte</td>
<td class="small" align="left">total available memory including free for the JVM within maximum</td>
</tr>
<tr class="TableCellDark">
<td class="TableHeader" align="left">Total</td> <td class="TableHeader" align="left">Total</td>
<td class="small" align="right">#[memoryTotalAfterStartup]# KByte</td> <td class="small" align="right">#[memoryTotalAfterStartup]# KByte</td>
<td class="small" align="right">#[memoryTotalAfterInitBGC]# KByte</td> <td class="small" align="right">#[memoryTotalAfterInitBGC]# KByte</td>
@ -62,7 +70,7 @@
<td class="small" rowspan="2">Database<br>&nbsp;</td> <td class="small" rowspan="2">Database<br>&nbsp;</td>
<td class="small" rowspan="2">Chunk Size<br>(bytes)</td> <td class="small" rowspan="2">Chunk Size<br>(bytes)</td>
<td class="small" colspan="5">#Slots</td> <td class="small" colspan="5">#Slots</td>
<td class="small" colspan="4">Memory Occupation (KBytes)</td> <td class="small" colspan="5">Memory Occupation (KBytes)</td>
<td class="small" rowspan="2">Description<br>&nbsp;</td> <td class="small" rowspan="2">Description<br>&nbsp;</td>
</tr> </tr>
@ -74,6 +82,7 @@
<td class="small">Used<br>Low Prio</td> <td class="small">Used<br>Low Prio</td>
<td class="small">Used Now</td> <td class="small">Used Now</td>
<td class="small">Assigned Max</td> <td class="small">Assigned Max</td>
<td class="small">Default Max</td>
<td class="small">Good Max</td> <td class="small">Good Max</td>
<td class="small">Best Max</td> <td class="small">Best Max</td>
</tr> </tr>
@ -88,6 +97,7 @@
<td class="small" align="right">#[sllowRWI]#</td> <td class="small" align="right">#[sllowRWI]#</td>
<td class="small" align="right">#[usedRWI]#</td> <td class="small" align="right">#[usedRWI]#</td>
<td class="small" align="right"><input name="ramCacheRWI" type="text" align="right" size="5" maxlength="6" value="#[ramCacheRWI]#"></td> <td class="small" align="right"><input name="ramCacheRWI" type="text" align="right" size="5" maxlength="6" value="#[ramCacheRWI]#"></td>
<td class="small" align="right">#[dfltRWI]#</td>
<td class="small" align="right">#[goodRWI]#</td> <td class="small" align="right">#[goodRWI]#</td>
<td class="small" align="right">#[bestRWI]#</td> <td class="small" align="right">#[bestRWI]#</td>
<td class="small" align="left">The Assortment Cluster stores most of the page indexes. <td class="small" align="left">The Assortment Cluster stores most of the page indexes.
@ -105,6 +115,7 @@ cache will speed up crawls with a depth > 3.</td>
<td class="small" align="right">#[sllowHTTP]#</td> <td class="small" align="right">#[sllowHTTP]#</td>
<td class="small" align="right">#[usedHTTP]#</td> <td class="small" align="right">#[usedHTTP]#</td>
<td class="small" align="right"><input name="ramCacheHTTP" type="text" align="right" size="5" maxlength="6" value="#[ramCacheHTTP]#"></td> <td class="small" align="right"><input name="ramCacheHTTP" type="text" align="right" size="5" maxlength="6" value="#[ramCacheHTTP]#"></td>
<td class="small" align="right">#[dfltHTTP]#</td>
<td class="small" align="right">#[goodHTTP]#</td> <td class="small" align="right">#[goodHTTP]#</td>
<td class="small" align="right">#[bestHTTP]#</td> <td class="small" align="right">#[bestHTTP]#</td>
<td class="small" align="left">The Response Header database stores the HTTP heades that other servers send when YaCy retrieves web pages <td class="small" align="left">The Response Header database stores the HTTP heades that other servers send when YaCy retrieves web pages
@ -122,6 +133,7 @@ Increasing this cache will be most important for a fast proxy mode.</td>
<td class="small" align="right">#[sllowLURL]#</td> <td class="small" align="right">#[sllowLURL]#</td>
<td class="small" align="right">#[usedLURL]#</td> <td class="small" align="right">#[usedLURL]#</td>
<td class="small" align="right"><input name="ramCacheLURL" type="text" align="right" size="5" maxlength="6" value="#[ramCacheLURL]#"></td> <td class="small" align="right"><input name="ramCacheLURL" type="text" align="right" size="5" maxlength="6" value="#[ramCacheLURL]#"></td>
<td class="small" align="right">#[dfltLURL]#</td>
<td class="small" align="right">#[goodLURL]#</td> <td class="small" align="right">#[goodLURL]#</td>
<td class="small" align="right">#[bestLURL]#</td> <td class="small" align="right">#[bestLURL]#</td>
<td class="small" align="left">This is the database that holds the hash/url - relation and properties regarding the url like load date and server date. <td class="small" align="left">This is the database that holds the hash/url - relation and properties regarding the url like load date and server date.
@ -138,6 +150,7 @@ This cache is very important for a fast search process. Increasing the cache siz
<td class="small" align="right">#[sllowNURL]#</td> <td class="small" align="right">#[sllowNURL]#</td>
<td class="small" align="right">#[usedNURL]#</td> <td class="small" align="right">#[usedNURL]#</td>
<td class="small" align="right"><input name="ramCacheNURL" type="text" align="right" size="5" maxlength="6" value="#[ramCacheNURL]#"></td> <td class="small" align="right"><input name="ramCacheNURL" type="text" align="right" size="5" maxlength="6" value="#[ramCacheNURL]#"></td>
<td class="small" align="right">#[dfltNURL]#</td>
<td class="small" align="right">#[goodNURL]#</td> <td class="small" align="right">#[goodNURL]#</td>
<td class="small" align="right">#[bestNURL]#</td> <td class="small" align="right">#[bestNURL]#</td>
<td class="small" align="left">A noticed URL is one that was discovered during crawling but was not loaded yet. <td class="small" align="left">A noticed URL is one that was discovered during crawling but was not loaded yet.
@ -154,6 +167,7 @@ Increasing the cache size will result in faster double-check during URL recognit
<td class="small" align="right">#[sllowEURL]#</td> <td class="small" align="right">#[sllowEURL]#</td>
<td class="small" align="right">#[usedEURL]#</td> <td class="small" align="right">#[usedEURL]#</td>
<td class="small" align="right"><input name="ramCacheEURL" type="text" align="right" size="5" maxlength="6" value="#[ramCacheEURL]#"></td> <td class="small" align="right"><input name="ramCacheEURL" type="text" align="right" size="5" maxlength="6" value="#[ramCacheEURL]#"></td>
<td class="small" align="right">#[dfltEURL]#</td>
<td class="small" align="right">#[goodEURL]#</td> <td class="small" align="right">#[goodEURL]#</td>
<td class="small" align="right">#[bestEURL]#</td> <td class="small" align="right">#[bestEURL]#</td>
<td class="small" align="left">URLs that cannot be loaded are stored in this database. It is also used for double-checked during crawling. <td class="small" align="left">URLs that cannot be loaded are stored in this database. It is also used for double-checked during crawling.
@ -170,6 +184,7 @@ Increasing the cache size will most probably speed up crawling slightly, but not
<td class="small" align="right">#[sllowDHT]#</td> <td class="small" align="right">#[sllowDHT]#</td>
<td class="small" align="right">#[usedDHT]#</td> <td class="small" align="right">#[usedDHT]#</td>
<td class="small" align="right"><input name="ramCacheDHT" type="text" align="right" size="5" maxlength="6" value="#[ramCacheDHT]#"></td> <td class="small" align="right"><input name="ramCacheDHT" type="text" align="right" size="5" maxlength="6" value="#[ramCacheDHT]#"></td>
<td class="small" align="right">#[dfltDHT]#</td>
<td class="small" align="right">#[goodDHT]#</td> <td class="small" align="right">#[goodDHT]#</td>
<td class="small" align="right">#[bestDHT]#</td> <td class="small" align="right">#[bestDHT]#</td>
<td class="small" align="left">This is simply the cache for the seed-dbs (active, passive, potential). <td class="small" align="left">This is simply the cache for the seed-dbs (active, passive, potential).
@ -187,6 +202,7 @@ Increasing this cache may speed up many functions, but we need to test this to s
<td class="small" align="right">#[sllowMessage]#</td> <td class="small" align="right">#[sllowMessage]#</td>
<td class="small" align="right">#[usedMessage]#</td> <td class="small" align="right">#[usedMessage]#</td>
<td class="small" align="right"><input name="ramCacheMessage" type="text" align="right" size="5" maxlength="6" value="#[ramCacheMessage]#"></td> <td class="small" align="right"><input name="ramCacheMessage" type="text" align="right" size="5" maxlength="6" value="#[ramCacheMessage]#"></td>
<td class="small" align="right">#[dfltMessage]#</td>
<td class="small" align="right">#[goodMessage]#</td> <td class="small" align="right">#[goodMessage]#</td>
<td class="small" align="right">#[bestMessage]#</td> <td class="small" align="right">#[bestMessage]#</td>
<td class="small" align="left">The Message cache for peer-to-peer messages. Less important.</td> <td class="small" align="left">The Message cache for peer-to-peer messages. Less important.</td>
@ -202,6 +218,7 @@ Increasing this cache may speed up many functions, but we need to test this to s
<td class="small" align="right">#[sllowWiki]#</td> <td class="small" align="right">#[sllowWiki]#</td>
<td class="small" align="right">#[usedWiki]#</td> <td class="small" align="right">#[usedWiki]#</td>
<td class="small" align="right"><input name="ramCacheWiki" type="text" align="right" size="5" maxlength="6" value="#[ramCacheWiki]#"></td> <td class="small" align="right"><input name="ramCacheWiki" type="text" align="right" size="5" maxlength="6" value="#[ramCacheWiki]#"></td>
<td class="small" align="right">#[dfltWiki]#</td>
<td class="small" align="right">#[goodWiki]#</td> <td class="small" align="right">#[goodWiki]#</td>
<td class="small" align="right">#[bestWiki]#</td> <td class="small" align="right">#[bestWiki]#</td>
<td class="small" align="left">The YaCy-Wiki uses a database to store its pages. <td class="small" align="left">The YaCy-Wiki uses a database to store its pages.
@ -219,17 +236,32 @@ Increasing this cache may speed up access to the wiki pages.</td>
<td class="small" align="right">#[sllowNews]#</td> <td class="small" align="right">#[sllowNews]#</td>
<td class="small" align="right">#[usedNews]#</td> <td class="small" align="right">#[usedNews]#</td>
<td class="small" align="right"><input name="ramCacheNews" type="text" align="right" size="5" maxlength="6" value="#[ramCacheNews]#"></td> <td class="small" align="right"><input name="ramCacheNews" type="text" align="right" size="5" maxlength="6" value="#[ramCacheNews]#"></td>
<td class="small" align="right">#[dfltNews]#</td>
<td class="small" align="right">#[goodNews]#</td> <td class="small" align="right">#[goodNews]#</td>
<td class="small" align="right">#[bestNews]#</td> <td class="small" align="right">#[bestNews]#</td>
<td class="small" align="left">The News-DB stores property-lists for news that are included in seeds. <td class="small" align="left">The News-DB stores property-lists for news that are included in seeds.
Increasing this cache may speed up the peer-ping.</td> Increasing this cache may speed up the peer-ping.</td>
</tr> </tr>
<tr class="TableCellSummary">
<td class="small" align="left" colspan="7">Totals</td>
<td class="small" align="right">#[usedTotal]# MB</td>
<td class="small" align="right">#[currTotal]# MB</td>
<td class="small" align="right">#[dfltTotal]# MB</td>
<td class="small" align="right">#[goodTotal]# MB</td>
<td class="small" align="right">#[bestTotal]# MB</td>
<td class="small" align="left">Sum of memory amounts</td>
</tr>
<tr class="TableCellLight"> <tr class="TableCellLight">
<td class="small" align="left" colspan="18"> <td class="small" align="left" colspan="8">Re-Configuration:</td>
<input type="submit" name="submitcache" value="Submit New Cache Values">&nbsp;&nbsp;&nbsp; <td class="small" align="center"><input type="submit" name="setCustom" value="Set"><br>these<br>custom<br>values<br>&nbsp;</td>
Changes take effect after re-start of YaCy</td> <td class="small" align="center"><input type="submit" name="setDefault" value="Set"><br>all<br>default<br>values<br>&nbsp;</td>
<td class="small" align="center"><input type="submit" name="setGood" value="Set"><br>all<br>recom-<br>mended values</td>
<td class="small" align="center"><input type="submit" name="setBest" value="Set"><br>all<br>optimum<br>values<br>&nbsp;</td>
<td class="small" align="center">Changes take effect after <b>re-start</b> of YaCy</td>
</tr> </tr>
</form> </form>
</table> </table>
</p> </p>

@ -61,118 +61,147 @@ public class PerformanceMemory_p {
private static final int KB = 1024; private static final int KB = 1024;
private static final int MB = 1024 * KB; private static final int MB = 1024 * KB;
private static Map defaultSettings = null;
private static int[] slt; private static int[] slt;
private static int req,chk,usd,bst,god; private static int req,chk,usd,bst,god;
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch sb) { private static long usedTotal, currTotal, dfltTotal, goodTotal, bestTotal;
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) {
// return variable that accumulates replacements // return variable that accumulates replacements
plasmaSwitchboard switchboard = (plasmaSwitchboard) sb; plasmaSwitchboard sb = (plasmaSwitchboard) env;
serverObjects prop = new serverObjects(); serverObjects prop = new serverObjects();
File defaultSettingsFile = new File(switchboard.getRootPath(), "yacy.init"); if (defaultSettings == null) {
Map defaultSettings = ((post == null) || (!(post.containsKey("submitdefault")))) ? null : serverFileUtils.loadHashMap(defaultSettingsFile); defaultSettings = serverFileUtils.loadHashMap(new File(env.getRootPath(), "yacy.init"));
}
if ((post != null) && (post.containsKey("submitcache"))) { prop.put("gc", 0);
sb.setConfig("ramCacheRWI", Long.parseLong(post.get("ramCacheRWI", "0")) * KB); String set = "";
sb.setConfig("ramCacheHTTP", Long.parseLong(post.get("ramCacheHTTP", "0")) * KB); if (post != null) {
sb.setConfig("ramCacheLURL", Long.parseLong(post.get("ramCacheLURL", "0")) * KB); if (post.containsKey("setCustom")) {
sb.setConfig("ramCacheNURL", Long.parseLong(post.get("ramCacheNURL", "0")) * KB); env.setConfig("ramCacheRWI", Long.parseLong(post.get("ramCacheRWI", "0")) * KB);
sb.setConfig("ramCacheEURL", Long.parseLong(post.get("ramCacheEURL", "0")) * KB); env.setConfig("ramCacheHTTP", Long.parseLong(post.get("ramCacheHTTP", "0")) * KB);
sb.setConfig("ramCacheDHT", Long.parseLong(post.get("ramCacheDHT", "0")) * KB); env.setConfig("ramCacheLURL", Long.parseLong(post.get("ramCacheLURL", "0")) * KB);
sb.setConfig("ramCacheMessage", Long.parseLong(post.get("ramCacheMessage", "0")) * KB); env.setConfig("ramCacheNURL", Long.parseLong(post.get("ramCacheNURL", "0")) * KB);
sb.setConfig("ramCacheWiki", Long.parseLong(post.get("ramCacheWiki", "0")) * KB); env.setConfig("ramCacheEURL", Long.parseLong(post.get("ramCacheEURL", "0")) * KB);
sb.setConfig("ramCacheNews", Long.parseLong(post.get("ramCacheNews", "0")) * KB); env.setConfig("ramCacheDHT", Long.parseLong(post.get("ramCacheDHT", "0")) * KB);
env.setConfig("ramCacheMessage", Long.parseLong(post.get("ramCacheMessage", "0")) * KB);
env.setConfig("ramCacheWiki", Long.parseLong(post.get("ramCacheWiki", "0")) * KB);
env.setConfig("ramCacheNews", Long.parseLong(post.get("ramCacheNews", "0")) * KB);
}
if (post.containsKey("setDefault")) {
env.setConfig("ramCacheRWI", Long.parseLong((String) defaultSettings.get("ramCacheRWI")));
env.setConfig("ramCacheHTTP", Long.parseLong((String) defaultSettings.get("ramCacheHTTP")));
env.setConfig("ramCacheLURL", Long.parseLong((String) defaultSettings.get("ramCacheLURL")));
env.setConfig("ramCacheNURL", Long.parseLong((String) defaultSettings.get("ramCacheNURL")));
env.setConfig("ramCacheEURL", Long.parseLong((String) defaultSettings.get("ramCacheEURL")));
env.setConfig("ramCacheDHT", Long.parseLong((String) defaultSettings.get("ramCacheDHT")));
env.setConfig("ramCacheMessage", Long.parseLong((String) defaultSettings.get("ramCacheMessage")));
env.setConfig("ramCacheWiki", Long.parseLong((String) defaultSettings.get("ramCacheWiki")));
env.setConfig("ramCacheNews", Long.parseLong((String) defaultSettings.get("ramCacheNews")));
}
if (post.containsKey("setGood")) set = "setGood";
if (post.containsKey("setBest")) set = "setBest";
if (post.containsKey("gc")) {
Runtime.getRuntime().gc();
prop.put("gc", 1);
}
} }
long memoryFreeNow = Runtime.getRuntime().freeMemory(); long memoryFreeNow = Runtime.getRuntime().freeMemory();
long memoryFreeAfterInitBGC = Long.parseLong(sb.getConfig("memoryFreeAfterInitBGC", "0")); long memoryFreeAfterInitBGC = Long.parseLong(env.getConfig("memoryFreeAfterInitBGC", "0"));
long memoryFreeAfterInitAGC = Long.parseLong(sb.getConfig("memoryFreeAfterInitAGC", "0")); long memoryFreeAfterInitAGC = Long.parseLong(env.getConfig("memoryFreeAfterInitAGC", "0"));
long memoryFreeAfterStartup = Long.parseLong(sb.getConfig("memoryFreeAfterStartup", "0")); long memoryFreeAfterStartup = Long.parseLong(env.getConfig("memoryFreeAfterStartup", "0"));
long memoryTotalNow = Runtime.getRuntime().totalMemory(); long memoryTotalNow = Runtime.getRuntime().totalMemory();
long memoryTotalAfterInitBGC = Long.parseLong(sb.getConfig("memoryTotalAfterInitBGC", "0")); long memoryTotalAfterInitBGC = Long.parseLong(env.getConfig("memoryTotalAfterInitBGC", "0"));
long memoryTotalAfterInitAGC = Long.parseLong(sb.getConfig("memoryTotalAfterInitAGC", "0")); long memoryTotalAfterInitAGC = Long.parseLong(env.getConfig("memoryTotalAfterInitAGC", "0"));
long memoryTotalAfterStartup = Long.parseLong(sb.getConfig("memoryTotalAfterStartup", "0")); long memoryTotalAfterStartup = Long.parseLong(env.getConfig("memoryTotalAfterStartup", "0"));
long memoryMax = Runtime.getRuntime().maxMemory(); long memoryMax = Runtime.getRuntime().maxMemory();
prop.put("memoryUsedAfterStartup", (memoryTotalAfterStartup - memoryFreeAfterStartup) / KB); prop.put("memoryMax", memoryMax / MB);
prop.put("memoryUsedAfterInitBGC", (memoryTotalAfterInitBGC - memoryFreeAfterInitBGC) / KB); prop.put("memoryAvailAfterStartup", (memoryMax - memoryTotalAfterStartup + memoryFreeAfterStartup) / KB);
prop.put("memoryUsedAfterInitAGC", (memoryTotalAfterInitAGC - memoryFreeAfterInitAGC) / KB); prop.put("memoryAvailAfterInitBGC", (memoryMax - memoryTotalAfterInitBGC + memoryFreeAfterInitBGC) / KB);
prop.put("memoryUsedNow", (memoryTotalNow - memoryFreeNow) / MB); prop.put("memoryAvailAfterInitAGC", (memoryMax - memoryTotalAfterInitAGC + memoryFreeAfterInitAGC) / KB);
prop.put("memoryFreeAfterStartup", memoryFreeAfterStartup / KB); prop.put("memoryAvailNow", (memoryMax - memoryTotalNow + memoryFreeNow) / MB);
prop.put("memoryFreeAfterInitBGC", memoryFreeAfterInitBGC / KB);
prop.put("memoryFreeAfterInitAGC", memoryFreeAfterInitAGC / KB);
prop.put("memoryFreeNow", memoryFreeNow / MB);
prop.put("memoryTotalAfterStartup", memoryTotalAfterStartup / KB); prop.put("memoryTotalAfterStartup", memoryTotalAfterStartup / KB);
prop.put("memoryTotalAfterInitBGC", memoryTotalAfterInitBGC / KB); prop.put("memoryTotalAfterInitBGC", memoryTotalAfterInitBGC / KB);
prop.put("memoryTotalAfterInitAGC", memoryTotalAfterInitAGC / KB); prop.put("memoryTotalAfterInitAGC", memoryTotalAfterInitAGC / KB);
prop.put("memoryTotalNow", memoryTotalNow / MB); prop.put("memoryTotalNow", memoryTotalNow / MB);
prop.put("memoryMax", memoryMax / MB); prop.put("memoryFreeAfterStartup", memoryFreeAfterStartup / KB);
prop.put("memoryFreeAfterInitBGC", memoryFreeAfterInitBGC / KB);
prop.put("memoryFreeAfterInitAGC", memoryFreeAfterInitAGC / KB);
prop.put("memoryFreeNow", memoryFreeNow / MB);
prop.put("memoryUsedAfterStartup", (memoryTotalAfterStartup - memoryFreeAfterStartup) / KB);
prop.put("memoryUsedAfterInitBGC", (memoryTotalAfterInitBGC - memoryFreeAfterInitBGC) / KB);
prop.put("memoryUsedAfterInitAGC", (memoryTotalAfterInitAGC - memoryFreeAfterInitAGC) / KB);
prop.put("memoryUsedNow", (memoryTotalNow - memoryFreeNow) / MB);
req = switchboard.wordIndex.size(); usedTotal = 0;
chk = switchboard.wordIndex.assortmentsCacheChunkSizeAvg(); currTotal = 0;
slt = switchboard.wordIndex.assortmentsCacheFillStatusCml(); dfltTotal = 0;
calc(); putprop(prop, "RWI"); goodTotal = 0;
prop.put("ramCacheRWI", Long.parseLong(sb.getConfig("ramCacheRWI", "0")) / KB); bestTotal = 0;
req = switchboard.cacheManager.dbSize(); req = sb.wordIndex.size();
chk = switchboard.cacheManager.dbCacheChunkSize(); chk = sb.wordIndex.assortmentsCacheChunkSizeAvg();
slt = switchboard.cacheManager.dbCacheFillStatus(); slt = sb.wordIndex.assortmentsCacheFillStatusCml();
calc(); putprop(prop, "HTTP"); putprop(prop, env, "RWI", set);
prop.put("ramCacheHTTP", Long.parseLong(sb.getConfig("ramCacheHTTP", "0")) / KB);
req = sb.cacheManager.dbSize();
req = switchboard.urlPool.loadedURL.urlHashCache.size(); chk = sb.cacheManager.dbCacheChunkSize();
chk = switchboard.urlPool.loadedURL.urlHashCache.cacheChunkSize(); slt = sb.cacheManager.dbCacheFillStatus();
slt = switchboard.urlPool.loadedURL.urlHashCache.cacheFillStatus(); putprop(prop, env, "HTTP", set);
calc(); putprop(prop, "LURL");
prop.put("ramCacheLURL", Long.parseLong(sb.getConfig("ramCacheLURL", "0")) / KB); req = sb.urlPool.loadedURL.urlHashCache.size();
chk = sb.urlPool.loadedURL.urlHashCache.cacheChunkSize();
req = switchboard.urlPool.noticeURL.urlHashCache.size(); slt = sb.urlPool.loadedURL.urlHashCache.cacheFillStatus();
chk = switchboard.urlPool.noticeURL.urlHashCache.cacheChunkSize(); putprop(prop, env, "LURL", set);
slt = switchboard.urlPool.noticeURL.urlHashCache.cacheFillStatus();
calc(); putprop(prop, "NURL"); req = sb.urlPool.noticeURL.urlHashCache.size();
prop.put("ramCacheNURL", Long.parseLong(sb.getConfig("ramCacheNURL", "0")) / KB); chk = sb.urlPool.noticeURL.urlHashCache.cacheChunkSize();
slt = sb.urlPool.noticeURL.urlHashCache.cacheFillStatus();
req = switchboard.urlPool.errorURL.urlHashCache.size(); putprop(prop, env, "NURL", set);
chk = switchboard.urlPool.errorURL.urlHashCache.cacheChunkSize();
slt = switchboard.urlPool.errorURL.urlHashCache.cacheFillStatus(); req = sb.urlPool.errorURL.urlHashCache.size();
calc(); putprop(prop, "EURL"); chk = sb.urlPool.errorURL.urlHashCache.cacheChunkSize();
prop.put("ramCacheEURL", Long.parseLong(sb.getConfig("ramCacheEURL", "0")) / KB); slt = sb.urlPool.errorURL.urlHashCache.cacheFillStatus();
putprop(prop, env, "EURL", set);
req = yacyCore.seedDB.sizeConnected() + yacyCore.seedDB.sizeDisconnected() + yacyCore.seedDB.sizePotential(); req = yacyCore.seedDB.sizeConnected() + yacyCore.seedDB.sizeDisconnected() + yacyCore.seedDB.sizePotential();
chk = yacyCore.seedDB.dbCacheChunkSize(); chk = yacyCore.seedDB.dbCacheChunkSize();
slt = yacyCore.seedDB.dbCacheFillStatus(); slt = yacyCore.seedDB.dbCacheFillStatus();
calc(); putprop(prop, "DHT"); putprop(prop, env, "DHT", set);
prop.put("ramCacheDHT", Long.parseLong(sb.getConfig("ramCacheDHT", "0")) / KB);
req = switchboard.messageDB.size(); req = sb.messageDB.size();
chk = switchboard.messageDB.dbCacheChunkSize(); chk = sb.messageDB.dbCacheChunkSize();
slt = switchboard.messageDB.dbCacheFillStatus(); slt = sb.messageDB.dbCacheFillStatus();
calc(); putprop(prop, "Message"); putprop(prop, env, "Message", set);
prop.put("ramCacheMessage", Long.parseLong(sb.getConfig("ramCacheMessage", "0")) / KB);
req = switchboard.wikiDB.sizeOfTwo(); req = sb.wikiDB.sizeOfTwo();
chk = switchboard.wikiDB.dbCacheChunkSize(); chk = sb.wikiDB.dbCacheChunkSize();
slt = switchboard.wikiDB.dbCacheFillStatus(); slt = sb.wikiDB.dbCacheFillStatus();
calc(); putprop(prop, "Wiki"); putprop(prop, env, "Wiki", set);
prop.put("ramCacheWiki", Long.parseLong(sb.getConfig("ramCacheWiki", "0")) / KB);
req = yacyCore.newsPool.dbSize(); req = yacyCore.newsPool.dbSize();
chk = yacyCore.newsPool.dbCacheChunkSize(); chk = yacyCore.newsPool.dbCacheChunkSize();
slt = yacyCore.newsPool.dbCacheFillStatus(); slt = yacyCore.newsPool.dbCacheFillStatus();
calc(); putprop(prop, "News"); putprop(prop, env, "News", set);
prop.put("ramCacheNews", Long.parseLong(sb.getConfig("ramCacheNews", "0")) / KB);
prop.put("usedTotal", usedTotal / MB);
prop.put("currTotal", currTotal / MB);
prop.put("dfltTotal", dfltTotal / MB);
prop.put("goodTotal", goodTotal / MB);
prop.put("bestTotal", bestTotal / MB);
// return rewrite values for templates // return rewrite values for templates
return prop; return prop;
} }
private static void calc() { private static void putprop(serverObjects prop, serverSwitch env, String db, String set) {
usd = chk * (slt[1]+slt[2]+slt[3]); usd = chk * (slt[1]+slt[2]+slt[3]);
bst = (((chk * req) >> 10) + 1) << 10; bst = (((chk * req) >> 10) + 1) << 10;
god = (((bst / (1+slt[1]+slt[2]+slt[3]) * slt[1]) >> 10) + 1) << 10; god = (((bst / (1+slt[1]+slt[2]+slt[3]) * slt[1]) >> 10) + 1) << 10;
} if (set.equals("setGood")) env.setConfig("ramCache" + db, god);
if (set.equals("setBest")) env.setConfig("ramCache" + db, bst);
private static void putprop(serverObjects prop, String db) {
prop.put("chunk" + db, chk); prop.put("chunk" + db, chk);
prop.put("slreq" + db, req); prop.put("slreq" + db, req);
prop.put("slemp" + db, slt[0]); prop.put("slemp" + db, slt[0]);
@ -182,5 +211,12 @@ public class PerformanceMemory_p {
prop.put("used" + db, usd / KB); prop.put("used" + db, usd / KB);
prop.put("good" + db, god / KB); prop.put("good" + db, god / KB);
prop.put("best" + db, bst / KB); prop.put("best" + db, bst / KB);
prop.put("dflt" + db, Long.parseLong((String) defaultSettings.get("ramCache" + db)) / KB);
prop.put("ramCache" + db, Long.parseLong(env.getConfig("ramCache" + db, "0")) / KB);
usedTotal += usd;
currTotal += Long.parseLong(env.getConfig("ramCache" + db, "0"));
dfltTotal += Long.parseLong((String) defaultSettings.get("ramCache" + db));
goodTotal += god;
bestTotal += bst;
} }
} }

@ -248,13 +248,13 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
} }
// read memory amount // read memory amount
int ramLURL = Integer.parseInt(getConfig("ramCacheLURL", "1024")) / 1024; int ramLURL = (int) getConfigLong("ramCacheLURL", 1024) / 1024;
int ramNURL = Integer.parseInt(getConfig("ramCacheNURL", "1024")) / 1024; int ramNURL = (int) getConfigLong("ramCacheNURL", 1024) / 1024;
int ramEURL = Integer.parseInt(getConfig("ramCacheEURL", "1024")) / 1024; int ramEURL = (int) getConfigLong("ramCacheEURL", 1024) / 1024;
int ramRWI = Integer.parseInt(getConfig("ramCacheRWI", "1024")) / 1024; int ramRWI = (int) getConfigLong("ramCacheRWI", 1024) / 1024;
int ramHTTP = Integer.parseInt(getConfig("ramCacheHTTP", "1024")) / 1024; int ramHTTP = (int) getConfigLong("ramCacheHTTP", 1024) / 1024;
int ramMessage = Integer.parseInt(getConfig("ramCacheMessage", "1024")) / 1024; int ramMessage = (int) getConfigLong("ramCacheMessage", 1024) / 1024;
int ramWiki = Integer.parseInt(getConfig("ramCacheWiki", "1024")) / 1024; int ramWiki = (int) getConfigLong("ramCacheWiki", 1024) / 1024;
this.log.logConfig("LURL Cache memory = " + ppRamString(ramLURL)); this.log.logConfig("LURL Cache memory = " + ppRamString(ramLURL));
this.log.logConfig("NURL Cache memory = " + ppRamString(ramNURL)); this.log.logConfig("NURL Cache memory = " + ppRamString(ramNURL));
this.log.logConfig("EURL Cache memory = " + ppRamString(ramEURL)); this.log.logConfig("EURL Cache memory = " + ppRamString(ramEURL));

@ -189,6 +189,14 @@ public abstract class serverAbstractSwitch implements serverSwitch {
if (s == null) return dflt; else return (String)s; if (s == null) return dflt; else return (String)s;
} }
public long getConfigLong(String key, long dflt) {
try {
return Long.parseLong(getConfig(key, Long.toString(dflt)));
} catch (NumberFormatException e) {
return dflt;
}
}
public Iterator configKeys() { public Iterator configKeys() {
return configProps.keySet().iterator(); return configProps.keySet().iterator();
} }

@ -91,6 +91,7 @@ public interface serverSwitch {
public void setConfig(String key, long value); public void setConfig(String key, long value);
public void setConfig(String key, String value); public void setConfig(String key, String value);
public String getConfig(String key, String dflt); public String getConfig(String key, String dflt);
public long getConfigLong(String key, long dflt);
public Iterator configKeys(); public Iterator configKeys();
// the switchboard also shall maintain a job list // the switchboard also shall maintain a job list

Loading…
Cancel
Save