On May 2, 2008, at 9:59 AM, [EMAIL PROTECTED] wrote:
Author: j16sdiz
Date: 2008-05-02 14:59:50 +0000 (Fri, 02 May 2008)
New Revision: 19683
Modified:
trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java
Log:
oomhook: lower database cache size
Modified: trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java
===================================================================
--- trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java
2008-05-02 14:59:29 UTC (rev 19682)
+++ trunk/freenet/src/freenet/store/BerkeleyDBFreenetStore.java
2008-05-02 14:59:50 UTC (rev 19683)
@@ -25,6 +25,7 @@
import com.sleepycat.je.DatabaseNotFoundException;
import com.sleepycat.je.Environment;
import com.sleepycat.je.EnvironmentConfig;
+import com.sleepycat.je.EnvironmentMutableConfig;
import com.sleepycat.je.LockMode;
import com.sleepycat.je.OperationStatus;
import com.sleepycat.je.RunRecoveryException;
@@ -2247,6 +2248,11 @@
keysFC.force(true);
if (lruFC != null)
lruFC.force(true);
+
+ EnvironmentMutableConfig dbmc = environment.getMutableConfig();
+ long cacheSize = (long) (dbmc.getCacheSize() * .9); // we have 6
databases, 0.9^6 = 0.53
+ dbmc.setCacheSize(cacheSize);
+ Logger.normal(this, "low memory, set db cache = " + cacheSize);
}
What is the significance of 0.9^6=0.53? It seems to me if you are
trying to half the memory usage, all the caches would have to be
reduced by 0.5; otherwise the comment could be made a bit more clear.
--
Robert Hailey
_______________________________________________
Devl mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl