jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1450713 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/ oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ oak-run/src/main/java/org/apache/jackrabbit/oak/fixture/
Date Wed, 27 Feb 2013 10:28:54 GMT
Author: jukka
Date: Wed Feb 27 10:28:54 2013
New Revision: 1450713

URL: http://svn.apache.org/r1450713
Log:
OAK-641: Improved benchmark tooling

Allow the segment cache size to be explicitly specified

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/MongoStore.java
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/BenchmarkRunner.java
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/fixture/OakRepositoryFixture.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/MongoStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/MongoStore.java?rev=1450713&r1=1450712&r2=1450713&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/MongoStore.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/MongoStore.java
Wed Feb 27 10:28:54 2013
@@ -53,13 +53,13 @@ public class MongoStore implements Segme
         }
     }
 
-    public MongoStore(DB db) {
-        this(db, new SegmentCache());
+    public MongoStore(DB db, long cacheSize) {
+        this(db, new SegmentCache(cacheSize));
     }
 
 
-    public MongoStore(Mongo mongo) {
-        this(mongo.getDB("Oak"));
+    public MongoStore(Mongo mongo, long cacheSize) {
+        this(mongo.getDB("Oak"), cacheSize);
     }
 
     @Override

Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/BenchmarkRunner.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/BenchmarkRunner.java?rev=1450713&r1=1450712&r2=1450713&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/BenchmarkRunner.java
(original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/BenchmarkRunner.java
Wed Feb 27 10:28:54 2013
@@ -34,12 +34,16 @@ import com.google.common.collect.Sets;
 
 public class BenchmarkRunner {
 
+    private static final long MB = 1024 * 1024;
+
     public static void main(String[] args) throws Exception {
         OptionParser parser = new OptionParser();
         OptionSpec<String> host = parser.accepts("host", "MongoDB host")
                 .withRequiredArg().defaultsTo("localhost");
         OptionSpec<Integer> port = parser.accepts("port", "MongoDB port")
                 .withRequiredArg().ofType(Integer.class).defaultsTo(27017);
+        OptionSpec<Integer> cache = parser.accepts("cache", "cache size (MB)")
+                .withRequiredArg().ofType(Integer.class).defaultsTo(100);
         OptionSpec<File> wikipedia =
                 parser.accepts("wikipedia", "Wikipedia dump")
                 .withRequiredArg().ofType(File.class);
@@ -50,7 +54,9 @@ public class BenchmarkRunner {
                 OakRepositoryFixture.getMemory(),
                 OakRepositoryFixture.getDefault(),
                 OakRepositoryFixture.getMongo(host.value(options), port.value(options)),
-                OakRepositoryFixture.getSegment(host.value(options), port.value(options))
+                OakRepositoryFixture.getSegment(
+                        host.value(options), port.value(options),
+                        cache.value(options) * MB)
         };
         Benchmark[] allBenchmarks = new Benchmark[] {
             new LoginTest(),

Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/fixture/OakRepositoryFixture.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/fixture/OakRepositoryFixture.java?rev=1450713&r1=1450712&r2=1450713&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/fixture/OakRepositoryFixture.java
(original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/fixture/OakRepositoryFixture.java
Wed Feb 27 10:28:54 2013
@@ -105,7 +105,8 @@ public abstract class OakRepositoryFixtu
         };
     }
 
-    public static RepositoryFixture getSegment(final String host, final int port) {
+    public static RepositoryFixture getSegment(
+            final String host, final int port, final long cacheSize) {
         return new OakRepositoryFixture("Oak-Segment") {
             private Mongo mongo;
             @Override
@@ -113,7 +114,8 @@ public abstract class OakRepositoryFixtu
                 Repository[] cluster = new Repository[n];
                 mongo = new Mongo(host, port);
                 for (int i = 0; i < cluster.length; i++) {
-                    SegmentStore store = new MongoStore(mongo.getDB(unique));
+                    SegmentStore store =
+                            new MongoStore(mongo.getDB(unique), cacheSize);
                     Oak oak = new Oak(new SegmentNodeStore(store));
                     cluster[i] = new Jcr(oak).createRepository();
                 }



Mime
View raw message