jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1452741 - in /jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype: MongoDocumentStore.java MongoMK.java
Date Tue, 05 Mar 2013 11:17:56 GMT
Author: thomasm
Date: Tue Mar  5 11:17:56 2013
New Revision: 1452741

URL: http://svn.apache.org/r1452741
Log:
OAK-668 Make cache size / limits configurable

Modified:
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoDocumentStore.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoMK.java

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoDocumentStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoDocumentStore.java?rev=1452741&r1=1452740&r2=1452741&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoDocumentStore.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoDocumentStore.java
Tue Mar  5 11:17:56 2013
@@ -52,7 +52,7 @@ public class MongoDocumentStore implemen
     private long time;
     
     private Cache<String, Map<String, Object>> cache =
-            new Cache<String, Map<String, Object>>(1024 * 20);
+            new Cache<String, Map<String, Object>>(MongoMK.CACHE_DOCUMENTS);
 
     public MongoDocumentStore(DB db) {
         nodesCollection = db.getCollection(Collection.NODES.toString());

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoMK.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoMK.java?rev=1452741&r1=1452740&r2=1452741&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoMK.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoMK.java
Tue Mar  5 11:17:56 2013
@@ -47,6 +47,21 @@ import com.mongodb.DB;
  * A MicroKernel implementation that stores the data in a MongoDB.
  */
 public class MongoMK implements MicroKernel {
+
+    /**
+     * The number of documents to cache.
+     */
+    static final int CACHE_DOCUMENTS = Integer.getInteger("oak.mongoMK.cacheDocs", 20 * 1024);
+    
+    /**
+     * The number of child node list entries to cache.
+     */
+    private static final int CACHE_CHILDREN = Integer.getInteger("oak.mongoMK.cacheChildren",
1024);
+    
+    /**
+     * The number of nodes to cache.
+     */
+    private static final int CACHE_NODES = Integer.getInteger("oak.mongoMK.cacheNodes", 1024);
     
     private static final Logger LOG = LoggerFactory.getLogger(MongoMK.class);
     
@@ -88,13 +103,14 @@ public class MongoMK implements MicroKer
      * Key: path@rev
      * Value: node
      */
-    private final Map<String, Node> nodeCache = new Cache<String, Node>(1024);
+    private final Map<String, Node> nodeCache = 
+            new Cache<String, Node>(CACHE_NODES);
     
     /**
      * Child node cache.
      */
     private Cache<String, Node.Children> nodeChildrenCache =
-            new Cache<String, Node.Children>(1024);
+            new Cache<String, Node.Children>(CACHE_CHILDREN);
 
     /**
      * The unsaved write count increments.



Mime
View raw message