jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1504108 - in /jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark: AbstractDeepTreeTest.java BenchmarkRunner.java ConcurrentReadAccessControlledTreeTest.java ConcurrentReadDeepTreeTest.java ReadDeepTreeTest.java
Date Wed, 17 Jul 2013 12:52:49 GMT
Author: angela
Date: Wed Jul 17 12:52:49 2013
New Revision: 1504108

URL: http://svn.apache.org/r1504108
Log:
OAK-908 : Performance measurement

Modified:
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/AbstractDeepTreeTest.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/benchmark/ConcurrentReadAccessControlledTreeTest.java
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ConcurrentReadDeepTreeTest.java
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ReadDeepTreeTest.java

Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/AbstractDeepTreeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/AbstractDeepTreeTest.java?rev=1504108&r1=1504107&r2=1504108&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/AbstractDeepTreeTest.java
(original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/AbstractDeepTreeTest.java
Wed Jul 17 12:52:49 2013
@@ -30,11 +30,17 @@ import javax.jcr.util.TraversingItemVisi
 
 public abstract class AbstractDeepTreeTest extends AbstractTest {
 
+    private final boolean runAsAdmin;
+
     protected Session adminSession;
     protected Node testRoot;
 
     protected List<String> allPaths;
 
+    public AbstractDeepTreeTest(boolean runAsAdmin) {
+        this.runAsAdmin = runAsAdmin;
+    }
+
     @Override
     protected void beforeSuite() throws Exception {
         adminSession = getRepository().login(getCredentials());
@@ -108,4 +114,12 @@ public abstract class AbstractDeepTreeTe
             System.out.println("Session " + testSession.getUserID() + " reading " + (cnt-noAccess)
+ " (Nodes: "+ nodeCnt +"; Properties: "+propertyCnt+") completed in " + (end - start));
         }
     }
+
+    protected Session getTestSession() {
+        if (runAsAdmin) {
+            return loginWriter();
+        } else {
+            return loginAnonymous();
+        }
+    }
 }
\ No newline at end of file

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=1504108&r1=1504107&r2=1504108&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 Jul 17 12:52:49 2013
@@ -50,6 +50,8 @@ public class BenchmarkRunner {
         OptionSpec<File> wikipedia =
                 parser.accepts("wikipedia", "Wikipedia dump")
                 .withRequiredArg().ofType(File.class);
+        OptionSpec<Boolean> runAsAdmin = parser.accepts("runAsAdmin", "Run test using
admin session")
+                .withRequiredArg().ofType(Boolean.class).defaultsTo(Boolean.FALSE);
 
         OptionSet options = parser.parse(args);
         int cacheSize = cache.value(options);
@@ -87,9 +89,9 @@ public class BenchmarkRunner {
             new ObservationTest(),
             new XmlImportTest(),
             new FlatTreeWithAceForSamePrincipalTest(),
-            new ReadDeepTreeTest(),
-            new ConcurrentReadAccessControlledTreeTest(),
-            new ConcurrentReadDeepTreeTest(),
+            new ReadDeepTreeTest(runAsAdmin.value(options)),
+            new ConcurrentReadAccessControlledTreeTest(runAsAdmin.value(options)),
+            new ConcurrentReadDeepTreeTest(runAsAdmin.value(options)),
             ReadManyTest.linear("LinearReadEmpty", 1, ReadManyTest.EMPTY),
             ReadManyTest.linear("LinearReadFiles", 1, ReadManyTest.FILES),
             ReadManyTest.linear("LinearReadNodes", 1, ReadManyTest.NODES),

Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ConcurrentReadAccessControlledTreeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ConcurrentReadAccessControlledTreeTest.java?rev=1504108&r1=1504107&r2=1504108&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ConcurrentReadAccessControlledTreeTest.java
(original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ConcurrentReadAccessControlledTreeTest.java
Wed Jul 17 12:52:49 2013
@@ -38,6 +38,10 @@ public class ConcurrentReadAccessControl
     private int bgReaders = 20;
     private int cnt = 10000;
 
+    public ConcurrentReadAccessControlledTreeTest(boolean runAsAdmin) {
+        super(runAsAdmin);
+    }
+
     @Override
     protected void beforeSuite() throws Exception {
         super.beforeSuite();
@@ -77,13 +81,13 @@ public class ConcurrentReadAccessControl
         visitor.visit(testRoot);
 
         for (int i = 0; i < bgReaders; i++) {
-            addBackgroundJob(new RandomRead(loginAnonymous(), false));
+            addBackgroundJob(new RandomRead(getTestSession(), false));
         }
     }
 
     @Override
     protected void runTest() throws Exception {
-        Session testSession = loginAnonymous();
+        Session testSession = getTestSession();
         RandomRead randomRead = new RandomRead(testSession, true);
         randomRead.run();
         testSession.logout();

Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ConcurrentReadDeepTreeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ConcurrentReadDeepTreeTest.java?rev=1504108&r1=1504107&r2=1504108&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ConcurrentReadDeepTreeTest.java
(original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ConcurrentReadDeepTreeTest.java
Wed Jul 17 12:52:49 2013
@@ -27,18 +27,22 @@ public class ConcurrentReadDeepTreeTest 
     private int bgReaders = 50;
     private int cnt = 10000;
 
+    public ConcurrentReadDeepTreeTest(boolean runAsAdmin) {
+        super(runAsAdmin);
+    }
+
     @Override
     protected void beforeSuite() throws Exception {
         super.beforeSuite();
 
         for (int i = 0; i < bgReaders; i++) {
-            addBackgroundJob(new RandomRead(loginAnonymous()));
+            addBackgroundJob(new RandomRead(getTestSession()));
         }
     }
 
     @Override
     protected void runTest() throws Exception {
-        Session testSession = loginAnonymous();
+        Session testSession = getTestSession();
         RandomRead randomRead = new RandomRead(testSession);
         randomRead.run();
         testSession.logout();

Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ReadDeepTreeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ReadDeepTreeTest.java?rev=1504108&r1=1504107&r2=1504108&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ReadDeepTreeTest.java
(original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ReadDeepTreeTest.java
Wed Jul 17 12:52:49 2013
@@ -16,30 +16,23 @@
  */
 package org.apache.jackrabbit.oak.benchmark;
 
-import javax.jcr.Session;
-
 /**
  * Randomly read 100000 items from the deep tree.
  */
 public class ReadDeepTreeTest extends AbstractDeepTreeTest {
 
-    private Session testSession;
     private int cnt = 100000;
 
+    public ReadDeepTreeTest(boolean runAsAdmin) {
+        super(runAsAdmin);
+    }
     @Override
     protected void beforeSuite() throws Exception {
         super.beforeSuite();
-
-        testSession = loginAnonymous();
     }
 
     @Override
     protected void runTest() throws Exception {
-        randomRead(testSession, allPaths, cnt, true);
-    }
-
-    @Override
-    protected void afterSuite() throws Exception {
-        testSession.logout();
+        randomRead(getTestSession(), allPaths, cnt, true);
     }
 }
\ No newline at end of file



Mime
View raw message