jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1350325 - in /jackrabbit/oak/trunk: ./ oak-bench/ oak-bench/base/ oak-bench/base/src/ oak-bench/base/src/main/ oak-bench/base/src/main/java/ oak-bench/base/src/main/java/org/ oak-bench/base/src/main/java/org/apache/ oak-bench/base/src/main...
Date Thu, 14 Jun 2012 16:41:08 GMT
Author: mduerig
Date: Thu Jun 14 16:41:06 2012
New Revision: 1350325

URL: http://svn.apache.org/viewvc?rev=1350325&view=rev
Log:
OAK-122: Performance test suite
Thanks to Michael Marth for the patch

Added:
    jackrabbit/oak/trunk/oak-bench/README.txt
    jackrabbit/oak/trunk/oak-bench/base/
    jackrabbit/oak/trunk/oak-bench/base/pom.xml
    jackrabbit/oak/trunk/oak-bench/base/src/
    jackrabbit/oak/trunk/oak-bench/base/src/main/
    jackrabbit/oak/trunk/oak-bench/base/src/main/java/
    jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/
    jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/
    jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/
    jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/
    jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/
    jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/AbstractPerformanceTest.java
    jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/AbstractTest.java
    jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/ConcurrentReadTest.java
    jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/ConcurrentReadWriteTest.java
    jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/CreateManyChildNodesTest.java
    jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/DescendantSearchTest.java
    jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/LoginLogoutTest.java
    jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/LoginTest.java
    jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/ReadPropertyTest.java
    jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/SQL2DescendantSearchTest.java
    jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/SQL2SearchTest.java
    jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/SetPropertyTest.java
    jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/SimpleSearchTest.java
    jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/SmallFileReadTest.java
    jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/SmallFileWriteTest.java
    jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/TestInputStream.java
    jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/TransientManyChildNodesTest.java
    jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/UpdateManyChildNodesTest.java
    jackrabbit/oak/trunk/oak-bench/oak03/
    jackrabbit/oak/trunk/oak-bench/oak03/pom.xml
    jackrabbit/oak/trunk/oak-bench/oak03/src/
    jackrabbit/oak/trunk/oak-bench/oak03/src/test/
    jackrabbit/oak/trunk/oak-bench/oak03/src/test/java/
    jackrabbit/oak/trunk/oak-bench/oak03/src/test/java/org/
    jackrabbit/oak/trunk/oak-bench/oak03/src/test/java/org/apache/
    jackrabbit/oak/trunk/oak-bench/oak03/src/test/java/org/apache/jackrabbit/
    jackrabbit/oak/trunk/oak-bench/oak03/src/test/java/org/apache/jackrabbit/oak/
    jackrabbit/oak/trunk/oak-bench/oak03/src/test/java/org/apache/jackrabbit/oak/performance/
    jackrabbit/oak/trunk/oak-bench/oak03/src/test/java/org/apache/jackrabbit/oak/performance/PerformanceTest.java
    jackrabbit/oak/trunk/oak-bench/parent/
    jackrabbit/oak/trunk/oak-bench/parent/pom.xml
    jackrabbit/oak/trunk/oak-bench/plot.sh
Modified:
    jackrabbit/oak/trunk/oak-bench/pom.xml
    jackrabbit/oak/trunk/pom.xml

Added: jackrabbit/oak/trunk/oak-bench/README.txt
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-bench/README.txt?rev=1350325&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-bench/README.txt (added)
+++ jackrabbit/oak/trunk/oak-bench/README.txt Thu Jun 14 16:41:06 2012
@@ -0,0 +1,85 @@
+---------------------------------
+Oak Performance Test Suite
+---------------------------------
+
+This directory contains a simple performance test suite that can be
+extended for ongoing Oak versions and micro kernels. Use the following
+command to run this test suite:
+
+    mvn clean install
+
+Note that the test suite will take more than an hour to complete, and to
+avoid distorting the results you should avoid putting any extra load on
+the computer while the test suite is running.
+
+The results are stored as oak*/target/*.txt report files and can
+be combined into an HTML report by running the following command on a
+(Unix) system where gnuplot is installed.
+
+    sh plot.sh
+
+Mac OS X note : if you want to execute the above script, you will need
+to install gnuplot and imagemagick2-svg from the Fink project. For
+more information : http://finkproject.org 
+
+Selecting which tests to run
+----------------------------
+
+The -Donly command line parameter allows you to specify a regexp for
+selecting which performance test cases to run. To run a single test
+case, use a command like this:
+
+    mvn clean install -Donly=ConcurrentReadTest
+
+To run all concurrency tests, use:
+
+    mvn clean install -Donly=Concurrent.*Test
+
+Selecting which micro kernel to test
+----------------------------------------------------------
+
+The -Dmk command line parameter allows you to specify a regexp for
+selecting the micro kernel and configurations against which the
+performance tests are run. The default setting selects only the default
+micro kernel:
+
+    mvn clean install -Dmk=\d\.\d
+
+To run the tests against all included configurations, use:
+
+    mvn clean install -Dmk=.*
+
+Using a profiler
+----------------
+
+To enable a profiler, use the -Dagentlib= command line pameter:
+
+    mvn clean install -Dagentlib=hprof=cpu=samples,depth=10
+
+Adding a new performance test
+-----------------------------
+
+The tests run by this performance test suite are listed in the
+testPerformance() method of the AbstractPerformanceTest class in
+the org.apache.jackrabbit.oak.performance package of the oak-perf-base
+component that you can find in the ./base directory.
+
+Each test is a subclass of the AbstractTest class in that same package,
+and you need to implement at least the abstract runTest() method when
+creating a new test. The runTest() method should contain the code whose
+performance you want to measure. For best measurement results the method
+should normally take something between 0.1 to 10 seconds to execute, so
+you may need to add a constant-size loop around your code like is done
+for example in the LoginTest class. The test suite compares relative
+performance between different Oak versions, so the absolute time
+taken by the test method is irrelevant.
+
+Many performance tests need some setup and teardown code for things like
+building the content tree against which the test is being run. Such work
+should not be included in the runTest() method to prevent affecting the
+performance measurements. Instead you can override the before/afterTest()
+and before/afterSuite() methods that get called respectively before and
+after each individual test iteration and the entire test suite. See for
+example the SetPropertyTest class for an example of how these methods
+are best used.
+

Added: jackrabbit/oak/trunk/oak-bench/base/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-bench/base/pom.xml?rev=1350325&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-bench/base/pom.xml (added)
+++ jackrabbit/oak/trunk/oak-bench/base/pom.xml Thu Jun 14 16:41:06 2012
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd ">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.jackrabbit.oak</groupId>
+    <artifactId>oak-perf-parent</artifactId>
+    <version>0.3-SNAPSHOT</version>
+    <relativePath>../parent/pom.xml</relativePath>
+  </parent>
+
+  <artifactId>oak-perf-base</artifactId>
+  <name>Oak Performance Test Utilities</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>javax.jcr</groupId>
+      <artifactId>jcr</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-math</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>oak-jcr</artifactId>
+      <version>0.3-SNAPSHOT</version>
+      <scope>provided</scope>
+    </dependency>
+    <!--  dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-core</artifactId>
+      <version>1.6.2</version --> <!-- overridden by downstream projects -->
+      <!-- scope>provided</scope>
+    </dependency -->
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+      <version>1.4</version>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <version>1.5.8</version>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-nop</artifactId>
+      <version>1.5.8</version>
+    </dependency>
+    <dependency>
+      <groupId>org.testng</groupId>
+      <artifactId>testng</artifactId>
+      <classifier>jdk15</classifier>
+      <version>5.8</version>
+    </dependency>
+  </dependencies>
+
+</project>
+

Added: jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/AbstractPerformanceTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/AbstractPerformanceTest.java?rev=1350325&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/AbstractPerformanceTest.java (added)
+++ jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/AbstractPerformanceTest.java Thu Jun 14 16:41:06 2012
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.performance;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.regex.Pattern;
+
+import javax.jcr.Credentials;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.SimpleCredentials;
+
+import org.apache.commons.io.output.FileWriterWithEncoding;
+import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
+import org.apache.jackrabbit.oak.jcr.RepositoryImpl;
+
+public abstract class AbstractPerformanceTest {
+
+	private final int warmup = 1;
+
+	private final int runtime = 10;
+
+	private final Credentials credentials = new SimpleCredentials("admin",
+			"admin".toCharArray());
+
+	private final Pattern microKernelPattern = Pattern.compile(System
+			.getProperty("mk", ".*"));
+	private final Pattern testPattern = Pattern.compile(System.getProperty(
+			"only", ".*"));
+
+	protected void testPerformance(String name, String microKernel)
+			throws Exception {
+
+		runTest(new LoginTest(), name, microKernel);
+		runTest(new LoginLogoutTest(), name, microKernel);
+		runTest(new ReadPropertyTest(), name, microKernel);
+		runTest(new SetPropertyTest(), name, microKernel);
+		runTest(new SmallFileReadTest(), name, microKernel);
+		runTest(new SmallFileWriteTest(), name, microKernel);
+		runTest(new ConcurrentReadTest(), name, microKernel);
+        runTest(new ConcurrentReadWriteTest(), name, microKernel);
+		runTest(new SimpleSearchTest(), name, microKernel);
+		runTest(new SQL2SearchTest(), name, microKernel);
+		runTest(new DescendantSearchTest(), name, microKernel);
+		runTest(new SQL2DescendantSearchTest(), name, microKernel);
+		runTest(new CreateManyChildNodesTest(), name, microKernel);
+		runTest(new UpdateManyChildNodesTest(), name, microKernel);
+		runTest(new TransientManyChildNodesTest(), name, microKernel);
+
+	}
+
+	private void runTest(AbstractTest test, String name, String microKernel) {
+		if (microKernelPattern.matcher(microKernel).matches()
+				&& testPattern.matcher(test.toString()).matches()) {
+
+			RepositoryImpl repository;
+			try {
+				repository = createRepository(microKernel);
+
+				// Run the test
+				DescriptiveStatistics statistics = runTest(test, repository);
+				if (statistics.getN() > 0) {
+					writeReport(test.toString(), name, microKernel, statistics);
+				}
+			} catch (RepositoryException re) {
+				re.printStackTrace();
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		}
+	}
+
+	private DescriptiveStatistics runTest(AbstractTest test,
+			Repository repository) throws Exception {
+		DescriptiveStatistics statistics = new DescriptiveStatistics();
+
+		test.setUp(repository, credentials);
+		try {
+			// Run a few iterations to warm up the system
+			long warmupEnd = System.currentTimeMillis() + warmup * 1000;
+			while (System.currentTimeMillis() < warmupEnd) {
+				test.execute();
+			}
+
+			// Run test iterations, and capture the execution times
+			long runtimeEnd = System.currentTimeMillis() + runtime * 1000;
+			while (System.currentTimeMillis() < runtimeEnd) {
+				statistics.addValue(test.execute());
+			}
+		} finally {
+			test.tearDown();
+		}
+
+		return statistics;
+	}
+
+	private static void writeReport(String test, String name, String microKernel,
+            DescriptiveStatistics statistics) throws IOException {
+		File report = new File("target", test + "-" + microKernel + ".txt");
+
+		boolean needsPrefix = !report.exists();
+		PrintWriter writer = new PrintWriter(new FileWriterWithEncoding(report,
+				"UTF-8", true));
+		try {
+			if (needsPrefix) {
+				writer.format(
+						"# %-34.34s     min     10%%     50%%     90%%     max%n",
+						test);
+			}
+
+			writer.format("%-36.36s  %6.0f  %6.0f  %6.0f  %6.0f  %6.0f%n",
+					name, statistics.getMin(), statistics.getPercentile(10.0),
+					statistics.getPercentile(50.0),
+					statistics.getPercentile(90.0), statistics.getMax());
+		} finally {
+			writer.close();
+		}
+	}
+
+	protected RepositoryImpl createRepository(String microKernel)
+			throws RepositoryException {
+
+		// TODO: depending on the microKernel string a particular repository
+		// with that MK must be returned
+
+		return new RepositoryImpl();
+	}
+
+}

Added: jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/AbstractTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/AbstractTest.java?rev=1350325&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/AbstractTest.java (added)
+++ jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/AbstractTest.java Thu Jun 14 16:41:06 2012
@@ -0,0 +1,213 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.performance;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.jcr.Credentials;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+/**
+ * Abstract base class for individual performance benchmarks.
+ */
+public abstract class AbstractTest {
+
+    private Repository repository;
+
+    private Credentials credentials;
+
+    private List<Session> sessions;
+
+    private List<Thread> threads;
+
+    private volatile boolean running;
+
+    protected static int getScale(int def) {
+        int scale = Integer.getInteger("scale", 0);
+        if (scale == 0) {
+            scale = def;
+        }
+        return scale;
+    }
+
+    /**
+     * Prepares this performance benchmark.
+     *
+     * @param repository the repository to use
+     * @param credentials credentials of a user with write access
+     * @throws Exception if the benchmark can not be prepared
+     */
+    public void setUp(Repository repository, Credentials credentials)
+            throws Exception {
+        this.repository = repository;
+        this.credentials = credentials;
+        this.sessions = new LinkedList<Session>();
+        this.threads = new LinkedList<Thread>();
+
+        this.running = true;
+
+        beforeSuite();
+    }
+
+    /**
+     * Executes a single iteration of this test.
+     *
+     * @return number of milliseconds spent in this iteration
+     * @throws Exception if an error occurs
+     */
+    public long execute() throws Exception {
+        beforeTest();
+        try {
+            long start = System.currentTimeMillis();
+            runTest();
+            return System.currentTimeMillis() - start;
+        } finally {
+            afterTest();
+        }
+    }
+    /**
+     * Cleans up after this performance benchmark.
+     *
+     * @throws Exception if the benchmark can not be cleaned up
+     */
+    public void tearDown() throws Exception {
+        this.running = false;
+        for (Thread thread : threads) {
+            thread.join();
+        }
+
+        afterSuite();
+
+        for (Session session : sessions) {
+            if (session.isLive()) {
+                session.logout();
+            }
+        }
+
+        this.threads = null;
+        this.sessions = null;
+        this.credentials = null;
+        this.repository = null;
+    }
+
+    /**
+     * Run before any iterations of this test get executed. Subclasses can
+     * override this method to set up static test content.
+     *
+     * @throws Exception if an error occurs
+     */
+    protected void beforeSuite() throws Exception {
+    }
+
+    protected void beforeTest() throws Exception {
+    }
+
+    protected abstract void runTest() throws Exception;
+
+    protected void afterTest() throws Exception {
+    }
+
+    /**
+     * Run after all iterations of this test have been executed. Subclasses can
+     * override this method to clean up static test content.
+     *
+     * @throws Exception if an error occurs
+     */
+    protected void afterSuite() throws Exception {
+    }
+
+    protected void failOnRepositoryVersions(String... versions)
+            throws RepositoryException {
+        String repositoryVersion =
+                repository.getDescriptor(Repository.REP_VERSION_DESC);
+        for (String version : versions) {
+            if (repositoryVersion.startsWith(version)) {
+                throw new RepositoryException(
+                        "Unable to run " + getClass().getName()
+                        + " on repository version " + version);
+            }
+        }
+    }
+
+    protected Repository getRepository() {
+        return repository;
+    }
+
+    protected Credentials getCredentials() {
+        return credentials;
+    }
+
+    /**
+     * Returns a new reader session that will be automatically closed once
+     * all the iterations of this test have been executed.
+     *
+     * @return reader session
+     */
+    protected Session loginReader() {
+        try {
+            Session session = repository.login();
+            sessions.add(session);
+            return session;
+        } catch (RepositoryException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * Returns a new writer session that will be automatically closed once
+     * all the iterations of this test have been executed.
+     *
+     * @return writer session
+     */
+    protected Session loginWriter() {
+        try {
+            Session session = repository.login(credentials);
+            sessions.add(session);
+            return session;
+        } catch (RepositoryException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * Adds a background thread that repeatedly executes the given job
+     * until all the iterations of this test have been executed.
+     *
+     * @param job background job
+     */
+    protected void addBackgroundJob(final Runnable job) {
+        Thread thread = new Thread() {
+            @Override
+            public void run() {
+                while (running) {
+                    job.run();
+                }
+            }
+        };
+        thread.start();
+        threads.add(thread);
+    }
+
+    public String toString() {
+        String name = getClass().getName();
+        return name.substring(name.lastIndexOf('.') + 1);
+    }
+
+}

Added: jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/ConcurrentReadTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/ConcurrentReadTest.java?rev=1350325&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/ConcurrentReadTest.java (added)
+++ jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/ConcurrentReadTest.java Thu Jun 14 16:41:06 2012
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.performance;
+
+import java.util.Random;
+
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+
+/**
+ * Test case that traverses 10k unstructured nodes (100x100) while 50 concurrent
+ * readers randomly access nodes from within this tree.
+ */
+public class ConcurrentReadTest extends AbstractTest {
+
+	protected static final int NODE_COUNT = 100;
+
+	private static final int READER_COUNT = getScale(20);
+
+	private Session session;
+
+	protected Node root;
+
+	@Override
+    public void beforeSuite() throws Exception {
+		session = getRepository().login(
+				new SimpleCredentials("admin", "admin".toCharArray()));
+		root = session.getRootNode().addNode("testroot", "nt:unstructured");
+		for (int i = 0; i < NODE_COUNT; i++) {
+			Node node = root.addNode("node" + i, "nt:unstructured");
+			for (int j = 0; j < NODE_COUNT; j++) {
+				node.addNode("node" + j, "nt:unstructured");
+			}
+			session.save();
+		}
+
+		for (int i = 0; i < READER_COUNT; i++) {
+			addBackgroundJob(new Reader());
+		}
+	}
+
+	private class Reader implements Runnable {
+
+		private Session session;
+
+		private final Random random = new Random();
+
+		public void run() {
+
+			try {
+				session = getRepository().login(
+						new SimpleCredentials("admin", "admin".toCharArray()));
+				int i = random.nextInt(NODE_COUNT);
+				int j = random.nextInt(NODE_COUNT);
+				session.getRootNode()
+						.getNode("testroot/node" + i + "/node" + j);
+			} catch (RepositoryException e) {
+				throw new RuntimeException(e);
+			}
+		}
+
+	}
+
+	@Override
+    public void runTest() throws Exception {
+		Reader reader = new Reader();
+		for (int i = 0; i < 1000; i++) {
+			reader.run();
+		}
+	}
+
+	@Override
+    public void afterSuite() throws Exception {
+		for (int i = 0; i < NODE_COUNT; i++) {
+			root.getNode("node" + i).remove();
+			session.save();
+		}
+
+		root.remove();
+		session.save();
+	}
+
+}

Added: jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/ConcurrentReadWriteTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/ConcurrentReadWriteTest.java?rev=1350325&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/ConcurrentReadWriteTest.java (added)
+++ jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/ConcurrentReadWriteTest.java Thu Jun 14 16:41:06 2012
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.performance;
+
+import java.util.Random;
+
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+
+/**
+ * A {@link ConcurrentReadTest} with a single writer thread that continuously
+ * updates the nodes being accessed by the readers.
+ */
+public class ConcurrentReadWriteTest extends ConcurrentReadTest {
+
+    @Override
+    public void beforeSuite() throws Exception {
+        super.beforeSuite();
+
+        addBackgroundJob(new Writer());
+    }
+
+    private class Writer implements Runnable {
+
+        private Session session;
+
+        private final Random random = new Random();
+
+        private long count;
+
+        public void run() {
+            try {
+            	session = getRepository().login(
+        				new SimpleCredentials("admin", "admin".toCharArray()));
+                int i = random.nextInt(NODE_COUNT);
+                int j = random.nextInt(NODE_COUNT);
+                Node node = session.getRootNode().getNode(
+                        "testroot/node" + i + "/node" + j);
+                node.setProperty("count", count++);
+                session.save();
+            } catch (RepositoryException e) {
+                throw new RuntimeException(e);
+            }
+        }
+
+    }
+
+}

Added: jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/CreateManyChildNodesTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/CreateManyChildNodesTest.java?rev=1350325&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/CreateManyChildNodesTest.java (added)
+++ jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/CreateManyChildNodesTest.java Thu Jun 14 16:41:06 2012
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.performance;
+
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+/**
+ * Test for measuring the performance of creating a node with
+ * {@value #CHILD_COUNT} child nodes.
+ */
+public class CreateManyChildNodesTest extends AbstractTest {
+
+    private static final int CHILD_COUNT = 10 * 1000;
+
+    private Session session;
+
+    @Override
+    public void beforeSuite() throws RepositoryException {
+        session = loginWriter();
+    }
+
+    @Override
+    public void beforeTest() throws RepositoryException {
+    }
+
+    @Override
+    public void runTest() throws Exception {
+        Node node = session.getRootNode().addNode("testnode", "nt:unstructured");
+        for (int i = 0; i < CHILD_COUNT; i++) {
+            node.addNode("node" + i, "nt:unstructured");
+        }
+        session.save();
+    }
+
+    @Override
+    public void afterTest() throws RepositoryException {
+        session.getRootNode().getNode("testnode").remove();
+        session.save();
+    }
+
+}

Added: jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/DescendantSearchTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/DescendantSearchTest.java?rev=1350325&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/DescendantSearchTest.java (added)
+++ jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/DescendantSearchTest.java Thu Jun 14 16:41:06 2012
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.performance;
+
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.query.Query;
+import javax.jcr.query.QueryManager;
+
+/**
+ * Performance test to check performance of queries on sub-trees.
+ */
+public class DescendantSearchTest extends AbstractTest {
+
+    private static final int NODE_COUNT = 100;
+
+    private Session session;
+
+    private Node root;
+
+    protected Query createQuery(QueryManager manager, int i)
+            throws RepositoryException {
+        return manager.createQuery("/jcr:root/testroot//element(*,nt:base)[@testcount=" + i + "]", Query.XPATH);
+    }
+
+    @Override
+    public void beforeSuite() throws RepositoryException {
+        session = getRepository().login(getCredentials());
+
+        root = session.getRootNode().addNode("testroot", "nt:unstructured");
+        for (int i = 0; i < NODE_COUNT; i++) {
+            Node node = root.addNode("node" + i, "nt:unstructured");
+            for (int j = 0; j < NODE_COUNT; j++) {
+                Node child = node.addNode("node" + j, "nt:unstructured");
+                child.setProperty("testcount", j);
+            }
+            session.save();
+        }
+    }
+
+    @Override
+    public void runTest() throws Exception {
+        QueryManager manager = session.getWorkspace().getQueryManager();
+        for (int i = 0; i < NODE_COUNT; i++) {
+            Query query = createQuery(manager, i);
+            NodeIterator iterator = query.execute().getNodes();
+            while (iterator.hasNext()) {
+                Node node = iterator.nextNode();
+                if (node.getProperty("testcount").getLong() != i) {
+                    throw new Exception("Invalid test result: " + node.getPath());
+                }
+            }
+        }
+    }
+
+    @Override
+    public void afterSuite() throws RepositoryException {
+        for (int i = 0; i < NODE_COUNT; i++) {
+            root.getNode("node" + i).remove();
+            session.save();
+        }
+
+        root.remove();
+        session.save();
+        session.logout();
+    }
+
+}

Added: jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/LoginLogoutTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/LoginLogoutTest.java?rev=1350325&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/LoginLogoutTest.java (added)
+++ jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/LoginLogoutTest.java Thu Jun 14 16:41:06 2012
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.performance;
+
+import javax.jcr.Credentials;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+
+public class LoginLogoutTest extends AbstractTest {
+
+	@Override
+	public void setUp(Repository repository, Credentials credentials)
+			throws Exception {
+		super.setUp(repository,
+				new SimpleCredentials("admin", "admin".toCharArray()));
+	}
+	
+    @Override
+    public void runTest() throws RepositoryException {
+        Repository repository = getRepository();
+        for (int i = 0; i < 1000; i++) {
+            Session session = repository.login(getCredentials());
+            try {
+                session.getRootNode();
+            } finally {
+                session.logout();
+            }
+        }
+    }
+
+}

Added: jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/LoginTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/LoginTest.java?rev=1350325&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/LoginTest.java (added)
+++ jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/LoginTest.java Thu Jun 14 16:41:06 2012
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.performance;
+
+import javax.jcr.Credentials;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+
+public class LoginTest extends AbstractTest {
+
+	private final Session[] sessions = new Session[1000];
+
+	@Override
+	public void setUp(Repository repository, Credentials credentials)
+			throws Exception {
+		super.setUp(repository,
+				new SimpleCredentials("admin", "admin".toCharArray()));
+	}
+
+	@Override
+    public void runTest() throws RepositoryException {
+		for (int i = 0; i < sessions.length; i++) {
+			sessions[i] = getRepository().login(getCredentials(), "default");
+		}
+
+	}
+
+	@Override
+    public void afterTest() throws RepositoryException {
+        for (Session session : sessions) {
+            session.logout();
+        }
+	}
+
+}

Added: jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/ReadPropertyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/ReadPropertyTest.java?rev=1350325&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/ReadPropertyTest.java (added)
+++ jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/ReadPropertyTest.java Thu Jun 14 16:41:06 2012
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.performance;
+
+import javax.jcr.Node;
+import javax.jcr.Session;
+
+/**
+ * {@code ReadPropertyTest} implements a performance test, which reads
+ * three properties: one with a jcr prefix, one with the empty prefix and a
+ * third one, which does not exist.
+ */
+public class ReadPropertyTest extends AbstractTest {
+
+    private Session session;
+
+    private Node root;
+
+    @Override
+    protected void beforeSuite() throws Exception {
+        session = getRepository().login(getCredentials());
+        root = session.getRootNode().addNode(
+                getClass().getSimpleName(), "nt:unstructured");
+        root.setProperty("property", "value");
+        session.save();
+    }
+
+    @Override
+    protected void runTest() throws Exception {
+        for (int i = 0; i < 10000; i++) {
+            root.getProperty("jcr:primaryType");
+            root.getProperty("property");
+            root.hasProperty("does-not-exist");
+        }
+    }
+
+    @Override
+    protected void afterSuite() throws Exception {
+        root.remove();
+        session.save();
+        session.logout();
+    }
+}

Added: jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/SQL2DescendantSearchTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/SQL2DescendantSearchTest.java?rev=1350325&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/SQL2DescendantSearchTest.java (added)
+++ jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/SQL2DescendantSearchTest.java Thu Jun 14 16:41:06 2012
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.performance;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.query.Query;
+import javax.jcr.query.QueryManager;
+
+/**
+ * SQL-2 version of the sub-tree performance test.
+ */
+public class SQL2DescendantSearchTest extends DescendantSearchTest {
+
+    @Override
+    protected Query createQuery(QueryManager manager, int i)
+            throws RepositoryException {
+        return manager.createQuery(
+                "SELECT * FROM [nt:base] AS n WHERE ISDESCENDANTNODE(n, '/testroot') AND testcount=" + i,
+                "JCR-SQL2");
+    }
+
+}

Added: jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/SQL2SearchTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/SQL2SearchTest.java?rev=1350325&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/SQL2SearchTest.java (added)
+++ jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/SQL2SearchTest.java Thu Jun 14 16:41:06 2012
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.performance;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.query.Query;
+import javax.jcr.query.QueryManager;
+
+public class SQL2SearchTest extends SimpleSearchTest {
+
+    @Override
+    protected Query createQuery(QueryManager manager, int i)
+            throws RepositoryException {
+        return manager.createQuery(
+                "SELECT * FROM [nt:base] WHERE testcount=" + i,
+                "JCR-SQL2");
+    }
+
+}

Added: jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/SetPropertyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/SetPropertyTest.java?rev=1350325&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/SetPropertyTest.java (added)
+++ jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/SetPropertyTest.java Thu Jun 14 16:41:06 2012
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.performance;
+
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+/**
+ * Test for measuring the performance of setting a single property and
+ * saving the change.
+ */
+public class SetPropertyTest extends AbstractTest {
+
+    private Session session;
+
+    private Node node;
+
+    @Override
+    public void beforeSuite() throws RepositoryException {
+        session = getRepository().login(getCredentials());
+        node = session.getRootNode().addNode("testnode", "nt:unstructured");
+        session.save();
+    }
+
+    @Override
+    public void beforeTest() throws RepositoryException {
+        node.setProperty("count", -1);
+        session.save();
+    }
+
+    @Override
+    public void runTest() throws Exception {
+        for (int i = 0; i < 1000; i++) {
+            node.setProperty("count", i);
+            session.save();
+        }
+    }
+
+    @Override
+    public void afterTest() throws RepositoryException {
+    }
+
+    @Override
+    public void afterSuite() throws RepositoryException {
+        session.getRootNode().getNode("testnode").remove();
+        session.save();
+        session.logout();
+    }
+
+}

Added: jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/SimpleSearchTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/SimpleSearchTest.java?rev=1350325&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/SimpleSearchTest.java (added)
+++ jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/SimpleSearchTest.java Thu Jun 14 16:41:06 2012
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.performance;
+
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.query.Query;
+import javax.jcr.query.QueryManager;
+
+public class SimpleSearchTest extends AbstractTest {
+
+    private static final int NODE_COUNT = 100;
+
+    private Session session;
+
+    private Node root;
+
+    protected Query createQuery(QueryManager manager, int i)
+            throws RepositoryException {
+        return manager.createQuery("//*[@testcount=" + i + "]", Query.XPATH);
+    }
+
+    @Override
+    public void beforeSuite() throws RepositoryException {
+        session = getRepository().login(getCredentials());
+
+        root = session.getRootNode().addNode("testroot", "nt:unstructured");
+        for (int i = 0; i < NODE_COUNT; i++) {
+            Node node = root.addNode("node" + i, "nt:unstructured");
+            for (int j = 0; j < NODE_COUNT; j++) {
+                Node child = node.addNode("node" + j, "nt:unstructured");
+                child.setProperty("testcount", j);
+            }
+            session.save();
+        }
+    }
+
+    @Override
+    public void runTest() throws Exception {
+        QueryManager manager = session.getWorkspace().getQueryManager();
+        for (int i = 0; i < NODE_COUNT; i++) {
+            Query query = createQuery(manager, i);
+            NodeIterator iterator = query.execute().getNodes();
+            while (iterator.hasNext()) {
+                Node node = iterator.nextNode();
+                if (node.getProperty("testcount").getLong() != i) {
+                    throw new Exception("Invalid test result: " + node.getPath());
+                }
+            }
+        }
+    }
+
+    @Override
+    public void afterSuite() throws RepositoryException {
+        for (int i = 0; i < NODE_COUNT; i++) {
+            root.getNode("node" + i).remove();
+            session.save();
+        }
+
+        root.remove();
+        session.save();
+        session.logout();
+    }
+
+}

Added: jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/SmallFileReadTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/SmallFileReadTest.java?rev=1350325&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/SmallFileReadTest.java (added)
+++ jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/SmallFileReadTest.java Thu Jun 14 16:41:06 2012
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.performance;
+
+import java.io.InputStream;
+import java.util.Calendar;
+
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.io.output.NullOutputStream;
+
+public class SmallFileReadTest extends AbstractTest {
+
+    private static final int FILE_COUNT = 1000;
+
+    private static final int FILE_SIZE = 10;
+
+    private Session session;
+
+    private Node root;
+
+    @Override
+    public void beforeSuite() throws RepositoryException {
+        session = getRepository().login(getCredentials());
+
+        root = session.getRootNode().addNode(
+                "SmallFileReadTest", "nt:folder");
+        for (int i = 0; i < FILE_COUNT; i++) {
+            Node file = root.addNode("file" + i, "nt:file");
+            Node content = file.addNode("jcr:content", "nt:resource");
+            content.setProperty("jcr:mimeType", "application/octet-stream");
+            content.setProperty("jcr:lastModified", Calendar.getInstance());
+            content.setProperty(
+                    "jcr:data", new TestInputStream(FILE_SIZE * 1024));
+        }
+        session.save();
+    }
+
+    @Override
+    public void runTest() throws Exception {
+        for (int i = 0; i < FILE_COUNT; i++) {
+            Node file = root.getNode("file" + i);
+            Node content = file.getNode("jcr:content");
+            InputStream stream = content.getProperty("jcr:data").getStream();
+            try {
+                IOUtils.copy(stream, new NullOutputStream());
+            } finally {
+                stream.close();
+            }
+        }
+    }
+
+    @Override
+    public void afterSuite() throws RepositoryException {
+        root.remove();
+        session.save();
+        session.logout();
+    }
+
+}

Added: jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/SmallFileWriteTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/SmallFileWriteTest.java?rev=1350325&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/SmallFileWriteTest.java (added)
+++ jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/SmallFileWriteTest.java Thu Jun 14 16:41:06 2012
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.performance;
+
+import java.util.Calendar;
+
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+public class SmallFileWriteTest extends AbstractTest {
+
+    private static final int FILE_COUNT = 100;
+
+    private static final int FILE_SIZE = 10;
+
+    private Session session;
+
+    private Node root;
+
+    @Override
+    public void beforeSuite() throws RepositoryException {
+        session = loginWriter();
+    }
+
+    @Override
+    public void beforeTest() throws RepositoryException {
+        root = session.getRootNode().addNode("SmallFileWriteTest", "nt:folder");
+        session.save();
+    }
+
+    @Override
+    public void runTest() throws Exception {
+        for (int i = 0; i < FILE_COUNT; i++) {
+            Node file = root.addNode("file" + i, "nt:file");
+            Node content = file.addNode("jcr:content", "nt:resource");
+            content.setProperty("jcr:mimeType", "application/octet-stream");
+            content.setProperty("jcr:lastModified", Calendar.getInstance());
+            content.setProperty(
+                    "jcr:data", new TestInputStream(FILE_SIZE * 1024));
+        }
+        session.save();
+    }
+
+    @Override
+    public void afterTest() throws RepositoryException {
+        root.remove();
+        session.save();
+    }
+
+}

Added: jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/TestInputStream.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/TestInputStream.java?rev=1350325&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/TestInputStream.java (added)
+++ jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/TestInputStream.java Thu Jun 14 16:41:06 2012
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.performance;
+
+import java.io.InputStream;
+import java.util.Random;
+
+/**
+ * An input stream that returns a given number of dummy data. The returned
+ * data is designed to be non-compressible to prevent possible compression
+ * mechanisms from affecting performance measurements.
+ */
+class TestInputStream extends InputStream {
+
+    private final int n;
+
+    private int i;
+
+    /**
+     * Source of the random stream of bytes. No fixed seed is used to
+     * prevent a solution like the Jackrabbit data store from using just
+     * a single storage location for multiple streams.
+     */
+    private final Random random = new Random();
+
+    public TestInputStream(int length) {
+        n = length;
+        i = 0;
+    }
+
+    @Override
+    public int read() {
+        if (i < n) {
+            i++;
+            byte[] b = new byte[1];
+            random.nextBytes(b);
+            return b[0];
+        } else {
+            return -1;
+        }
+    }
+
+    @Override
+    public int read(byte[] b, int off, int len) {
+        if (i < n) {
+            byte[] data = new byte[Math.min(len, n - i)];
+            random.nextBytes(data);
+            System.arraycopy(data, 0, b, off, data.length);
+            i += data.length;
+            return data.length;
+        } else {
+            return -1;
+        }
+    }
+
+
+}

Added: jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/TransientManyChildNodesTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/TransientManyChildNodesTest.java?rev=1350325&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/TransientManyChildNodesTest.java (added)
+++ jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/TransientManyChildNodesTest.java Thu Jun 14 16:41:06 2012
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.performance;
+
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+/**
+ * Test for measuring the performance of {@value #ITERATIONS} iterations of
+ * transiently adding and removing a child node to a node that already has
+ * {@value #CHILD_COUNT} existing child nodes.
+ */
+public class TransientManyChildNodesTest extends AbstractTest {
+
+    private static final int CHILD_COUNT = 10 * 1000;
+
+    private static final int ITERATIONS = 1000;
+
+    private Session session;
+
+    private Node node;
+
+    @Override
+    public void beforeSuite() throws RepositoryException {
+        session = getRepository().login(getCredentials());
+        node = session.getRootNode().addNode("testnode", "nt:unstructured");
+        for (int i = 0; i < CHILD_COUNT; i++) {
+            node.addNode("node" + i, "nt:unstructured");
+        }
+    }
+
+    @Override
+    public void beforeTest() throws RepositoryException {
+    }
+
+    @Override
+    public void runTest() throws Exception {
+        for (int i = 0; i < ITERATIONS; i++) {
+            node.addNode("onemore", "nt:unstructured").remove();
+        }
+    }
+
+    @Override
+    public void afterTest() throws RepositoryException {
+    }
+
+    @Override
+    public void afterSuite() throws RepositoryException {
+        session.getRootNode().getNode("testnode").remove();
+        session.save();
+        session.logout();
+    }
+
+}

Added: jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/UpdateManyChildNodesTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/UpdateManyChildNodesTest.java?rev=1350325&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/UpdateManyChildNodesTest.java (added)
+++ jackrabbit/oak/trunk/oak-bench/base/src/main/java/org/apache/jackrabbit/oak/performance/UpdateManyChildNodesTest.java Thu Jun 14 16:41:06 2012
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.performance;
+
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+/**
+ * Test for measuring the performance of adding one extra child node to 
+ * node with {@value #CHILD_COUNT} existing child nodes.
+ */
+public class UpdateManyChildNodesTest extends AbstractTest {
+
+    private static final int CHILD_COUNT = 10 * 1000;
+
+    private Session session;
+
+    private Node node;
+
+    @Override
+    public void beforeSuite() throws RepositoryException {
+        session = getRepository().login(getCredentials());
+        node = session.getRootNode().addNode("testnode", "nt:unstructured");
+        for (int i = 0; i < CHILD_COUNT; i++) {
+            node.addNode("node" + i, "nt:unstructured");
+        }
+    }
+
+    @Override
+    public void beforeTest() throws RepositoryException {
+    }
+
+    @Override
+    public void runTest() throws Exception {
+        node.addNode("onemore", "nt:unstructured");
+        session.save();
+    }
+
+    @Override
+    public void afterTest() throws RepositoryException {
+        node.getNode("onemore").remove();
+        session.save();
+    }
+
+    @Override
+    public void afterSuite() throws RepositoryException {
+        session.getRootNode().getNode("testnode").remove();
+        session.save();
+        session.logout();
+    }
+
+}

Added: jackrabbit/oak/trunk/oak-bench/oak03/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-bench/oak03/pom.xml?rev=1350325&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-bench/oak03/pom.xml (added)
+++ jackrabbit/oak/trunk/oak-bench/oak03/pom.xml Thu Jun 14 16:41:06 2012
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd ">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.jackrabbit.oak</groupId>
+    <artifactId>oak-perf-parent</artifactId>
+    <version>0.3-SNAPSHOT</version>
+    <relativePath>../parent/pom.xml</relativePath>
+  </parent>
+
+  <artifactId>oak-perf-oak03</artifactId>
+  <name>Oak 0.3 Performance Test</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.jackrabbit.oak</groupId>
+      <artifactId>oak-perf-base</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>javax.jcr</groupId>
+      <artifactId>jcr</artifactId>
+      <version>2.0</version>
+      <scope>test</scope>
+    </dependency>
+	<dependency>
+		<groupId>org.apache.jackrabbit</groupId>
+		<artifactId>oak-jcr</artifactId>
+		<version>0.3-SNAPSHOT</version>
+		<scope>provided</scope>
+		</dependency>
+    <!-- dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-core</artifactId>
+      <version>2.4-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency  -->
+  </dependencies>
+
+</project>
+

Added: jackrabbit/oak/trunk/oak-bench/oak03/src/test/java/org/apache/jackrabbit/oak/performance/PerformanceTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-bench/oak03/src/test/java/org/apache/jackrabbit/oak/performance/PerformanceTest.java?rev=1350325&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-bench/oak03/src/test/java/org/apache/jackrabbit/oak/performance/PerformanceTest.java (added)
+++ jackrabbit/oak/trunk/oak-bench/oak03/src/test/java/org/apache/jackrabbit/oak/performance/PerformanceTest.java Thu Jun 14 16:41:06 2012
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.performance;
+
+import org.testng.annotations.Test;
+
+public class PerformanceTest extends AbstractPerformanceTest {
+
+    @Test
+    public void testPerformance() throws Exception {
+        testPerformance("0.3", "default");
+        testPerformance("0.3", "other_mk");
+    }
+}

Added: jackrabbit/oak/trunk/oak-bench/parent/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-bench/parent/pom.xml?rev=1350325&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-bench/parent/pom.xml (added)
+++ jackrabbit/oak/trunk/oak-bench/parent/pom.xml Thu Jun 14 16:41:06 2012
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd ">
+  <modelVersion>4.0.0</modelVersion>
+
+  <!-- =================================================================== -->
+  <!-- P R O J E C T  D E S C R I P T I O N                                -->
+  <!-- =================================================================== -->
+
+  <parent>
+    <groupId>org.apache</groupId>
+    <artifactId>apache</artifactId>
+    <version>10</version>
+    <relativePath />
+  </parent>
+
+  <groupId>org.apache.jackrabbit.oak</groupId>
+  <artifactId>oak-perf-parent</artifactId>
+  <name>Oak Performance Test Parent</name>
+  <version>0.3-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <properties>
+    <repo>\d\.\d</repo>
+    <only>.*</only>
+    <scale>0</scale>
+  </properties>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <artifactId>maven-compiler-plugin</artifactId>
+          <configuration>
+            <source>1.5</source>
+            <target>1.5</target>
+          </configuration>
+        </plugin>
+        <plugin>
+          <artifactId>maven-surefire-plugin</artifactId>
+          <configuration>
+			<argLine>-Xms256m -Xmx512m</argLine>
+            <enableAssertions>false</enableAssertions>
+            <systemProperties>
+              <property>
+                <name>derby.stream.error.file</name>
+                <value>target/derby.log</value>
+              </property>
+              <property>
+                <name>repo</name>
+                <value>${repo}</value>
+              </property>
+              <property>
+                <name>only</name>
+                <value>${only}</value>
+              </property>
+              <property>
+                <name>scale</name>
+                <value>${scale}</value>
+              </property>
+            </systemProperties>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+
+  <profiles>
+    <profile>
+      <id>profiler</id>
+      <activation>
+        <property>
+          <name>agentlib</name>
+        </property>
+      </activation>
+      <build>
+        <pluginManagement>
+          <plugins>
+            <plugin>
+              <artifactId>maven-surefire-plugin</artifactId>
+              <configuration>
+				<argLine>-Xmx512m -XX:MaxPermSize=512m -agentlib:${agentlib}</argLine>
+              </configuration>
+            </plugin>
+          </plugins>
+        </pluginManagement>
+      </build>
+    </profile>
+  </profiles>
+
+</project>

Added: jackrabbit/oak/trunk/oak-bench/plot.sh
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-bench/plot.sh?rev=1350325&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-bench/plot.sh (added)
+++ jackrabbit/oak/trunk/oak-bench/plot.sh Thu Jun 14 16:41:06 2012
@@ -0,0 +1,61 @@
+#!/bin/sh
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# This is an example Gnuplot script for plotting the performance results
+# produced by the Jackrabbit performance test suite. Before you run this
+# script you need to preprocess the individual performance reports.
+
+cat <<HTML >target/report.html
+<html>
+  <head>
+    <title>Jackrabbit performance</title>
+  </head>
+  <body>
+    <h1>Jackrabbit performance</h1>
+    <p>
+HTML
+
+for dat in */target/*.txt; do
+    cat "$dat" >>target/`basename "$dat"`
+done
+
+for dat in target/*.txt; do
+    name=`basename "$dat" .txt`
+    rows=`grep -v "#" "$dat" | wc -l`
+    gnuplot <<PLOT
+set term svg
+set xlabel "Jackrabbit version"
+set xrange [-1:$rows]
+set ylabel "Time (ms)"
+set yrange [0:]
+set output "target/$name.svg"
+set title "$name"
+plot "$dat" using 0:4:3:5:xtic(1) with yerrorlines notitle
+PLOT
+    convert "target/$name.svg" "target/$name.png"
+    cat <<HTML >>target/report.html
+      <img src="$name.png" alt="$name">
+HTML
+done
+
+cat <<HTML >>target/report.html
+    </p>
+  </body>
+</html>
+HTML
+
+echo file://`pwd`/target/report.html
+

Modified: jackrabbit/oak/trunk/oak-bench/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-bench/pom.xml?rev=1350325&r1=1350324&r2=1350325&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-bench/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-bench/pom.xml Thu Jun 14 16:41:06 2012
@@ -17,21 +17,31 @@
    limitations under the License.
   -->
 
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd ">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd ">
   <modelVersion>4.0.0</modelVersion>
 
+  <!-- =================================================================== -->
+  <!-- P R O J E C T  D E S C R I P T I O N                                -->
+  <!-- =================================================================== -->
+
   <parent>
-    <groupId>org.apache.jackrabbit</groupId>
-    <artifactId>oak-parent</artifactId>
+    <groupId>org.apache.jackrabbit.oak</groupId>
+    <artifactId>oak-perf-parent</artifactId>
     <version>0.3-SNAPSHOT</version>
-    <relativePath>../oak-parent/pom.xml</relativePath>
+    <relativePath>parent/pom.xml</relativePath>
   </parent>
 
-  <artifactId>oak-bench</artifactId>
-  <name>Oak Benchmark</name>
+  <artifactId>oak-perf</artifactId>
+  <name>Oak Performance Tests</name>
+  <packaging>pom</packaging>
 
-  <properties>
-    <skip.deployment>true</skip.deployment>
-  </properties>
+  <modules>
+    <module>parent</module>
+    <module>base</module>
+    <module>oak03</module>
+  </modules>
 
 </project>

Modified: jackrabbit/oak/trunk/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/pom.xml?rev=1350325&r1=1350324&r2=1350325&view=diff
==============================================================================
--- jackrabbit/oak/trunk/pom.xml (original)
+++ jackrabbit/oak/trunk/pom.xml Thu Jun 14 16:41:06 2012
@@ -44,7 +44,7 @@
     <module>oak-sling</module>
     <module>oak-run</module>
     <module>oak-it</module>
-    <module>oak-bench</module>
+    <!--<module>oak-bench</module>-->
   </modules>
 
   <scm>



Mime
View raw message