jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1499676 - in /jackrabbit/oak/trunk/oak-run: README.md src/main/java/org/apache/jackrabbit/oak/benchmark/AbstractTest.java src/main/java/org/apache/jackrabbit/oak/benchmark/SmallFileWriteTest.java
Date Thu, 04 Jul 2013 08:36:22 GMT
Author: jukka
Date: Thu Jul  4 08:36:22 2013
New Revision: 1499676

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

Allow customization of the warmup period and benchmark runtime through system properties.
Avoid the MongoMK split document edge case in SmallFileWriteTest

Modified:
    jackrabbit/oak/trunk/oak-run/README.md
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/AbstractTest.java
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/SmallFileWriteTest.java

Modified: jackrabbit/oak/trunk/oak-run/README.md
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/README.md?rev=1499676&r1=1499675&r2=1499676&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/README.md (original)
+++ jackrabbit/oak/trunk/oak-run/README.md Thu Jul  4 08:36:22 2013
@@ -33,6 +33,11 @@ java.hprof.txt` to produce a somewhat ea
 bottom-up summaries of how the execution time is distributed across
 the benchmarked codebase.
 
+Some system properties are also used to control the benchmarks. For example:
+
+    -Dwarmup=5         - number of warmup iterations
+    -Druntime=60       - how long a single benchmark should run (in seconds)
+
 The test case names like `ReadPropertyTest`, `SmallFileReadTest` and
 `SmallFileWriteTest` indicate the specific test case being run. You can
 specify one or more test cases in the benchmark command line, and

Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/AbstractTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/AbstractTest.java?rev=1499676&r1=1499675&r2=1499676&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/AbstractTest.java
(original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/AbstractTest.java
Thu Jul  4 08:36:22 2013
@@ -34,6 +34,11 @@ import org.apache.jackrabbit.oak.fixture
  */
 abstract class AbstractTest extends Benchmark {
 
+    private static final int WARMUP = Integer.getInteger("warmup", 5);
+
+    private static final long RUNTIME =
+            TimeUnit.SECONDS.toMillis(Long.getLong("runtime", 60));
+
     private Repository repository;
 
     private Credentials credentials;
@@ -111,15 +116,13 @@ abstract class AbstractTest extends Benc
         setUp(repository, CREDENTIALS);
         try {
             // Run a few iterations to warm up the system
-            for (int i = 0; i < 5; i++) {
+            for (int i = 0; i < WARMUP; i++) {
                 execute();
             }
 
             // Run test iterations, and capture the execution times
             int iterations = 0;
-            long runtimeEnd =
-                    System.currentTimeMillis()
-                    + TimeUnit.MILLISECONDS.convert(1, TimeUnit.MINUTES);
+            long runtimeEnd = System.currentTimeMillis() + RUNTIME;
             while (iterations++ < 10
                     || System.currentTimeMillis() < runtimeEnd) {
                 statistics.addValue(execute());

Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/SmallFileWriteTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/SmallFileWriteTest.java?rev=1499676&r1=1499675&r2=1499676&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/SmallFileWriteTest.java
(original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/SmallFileWriteTest.java
Thu Jul  4 08:36:22 2013
@@ -32,6 +32,11 @@ public class SmallFileWriteTest extends 
 
     private Node root;
 
+    /**
+     * Iteration counter used to avoid the slit document edge case in MongoMK.
+     */
+    private int iteration = 0;
+
     @Override
     public void beforeSuite() throws RepositoryException {
         session = loginWriter();
@@ -39,11 +44,12 @@ public class SmallFileWriteTest extends 
 
     @Override
     public void beforeTest() throws RepositoryException {
-        root = session.getRootNode().addNode("SmallFileWriteTest", "nt:folder");
+        root = session.getRootNode().addNode(
+                "SmallFileWriteTest" + iteration++, "nt:folder");
         session.save();
     }
 
-    @Override
+    @Override @SuppressWarnings("deprecation")
     public void runTest() throws Exception {
         for (int i = 0; i < FILE_COUNT; i++) {
             Node file = root.addNode("file" + i, "nt:file");



Mime
View raw message