jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r1433886 - /jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoNodeStore.java
Date Wed, 16 Jan 2013 10:33:50 GMT
Author: mreutegg
Date: Wed Jan 16 10:33:49 2013
New Revision: 1433886

URL: http://svn.apache.org/viewvc?rev=1433886&view=rev
Log:
OAK-557: Configurable caches in MongoNodeStore

Modified:
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoNodeStore.java

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoNodeStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoNodeStore.java?rev=1433886&r1=1433885&r2=1433886&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoNodeStore.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoNodeStore.java
Wed Jan 16 10:33:49 2013
@@ -63,13 +63,35 @@ public class MongoNodeStore implements N
     public static final String COLLECTION_NODES = "nodes";
     public static final String COLLECTION_SYNC = "sync";
 
+    private static final int COMMIT_CACHE_SIZE;
+    private static final int NODE_CACHE_SIZE;
+
+    static {
+        int commitCacheSize = 1000;
+        try {
+            commitCacheSize = Integer.parseInt(
+                    System.getProperty("mongomk.commitCacheSize", "" + commitCacheSize));
+        } catch (NumberFormatException e) {
+            // use default
+        }
+        COMMIT_CACHE_SIZE = commitCacheSize;
+        int nodeCacheSize = 10000;
+        try {
+            nodeCacheSize = Integer.parseInt(
+                    System.getProperty("mongomk.nodeCacheSize", "" + nodeCacheSize));
+        } catch (NumberFormatException e) {
+            // use default
+        }
+        NODE_CACHE_SIZE = nodeCacheSize;
+    }
+
     private static final Logger LOG = LoggerFactory.getLogger(MongoNodeStore.class);
 
     private final CommandExecutor commandExecutor;
     private final DB db;
 
-    private Map<Long, MongoCommit> commitCache = Collections.synchronizedMap(SimpleLRUCache.<Long,
MongoCommit> newInstance(1000));
-    private Map<String, MongoNode> nodeCache = Collections.synchronizedMap(SimpleLRUCache.<String,
MongoNode> newInstance(10000));
+    private Map<Long, MongoCommit> commitCache = Collections.synchronizedMap(SimpleLRUCache.<Long,
MongoCommit> newInstance(COMMIT_CACHE_SIZE));
+    private Map<String, MongoNode> nodeCache = Collections.synchronizedMap(SimpleLRUCache.<String,
MongoNode> newInstance(NODE_CACHE_SIZE));
 
     /**
      * Constructs a new {@code NodeStoreMongo}.



Mime
View raw message