You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by ju...@apache.org on 2013/02/28 14:52:57 UTC
svn commit: r1451196 - in
/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark:
BenchmarkRunner.java ManyNodes.java
Author: jukka
Date: Thu Feb 28 13:52:57 2013
New Revision: 1451196
URL: http://svn.apache.org/r1451196
Log:
OAK-641: Improved benchmark tooling
Add a benchmark for importing a large hierarchy of nodes
Added:
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ManyNodes.java
Modified:
jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/BenchmarkRunner.java
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=1451196&r1=1451195&r2=1451196&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 Thu Feb 28 13:52:57 2013
@@ -74,7 +74,8 @@ public class BenchmarkRunner {
new CreateManyChildNodesTest(),
new UpdateManyChildNodesTest(),
new TransientManyChildNodesTest(),
- new WikipediaImport(wikipedia.value(options))
+ new WikipediaImport(wikipedia.value(options)),
+ new ManyNodes()
};
Set<String> argset = Sets.newHashSet(options.nonOptionArguments());
Added: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ManyNodes.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ManyNodes.java?rev=1451196&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ManyNodes.java (added)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ManyNodes.java Thu Feb 28 13:52:57 2013
@@ -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.benchmark;
+
+import javax.jcr.Node;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+
+import org.apache.jackrabbit.oak.fixture.RepositoryFixture;
+
+public class ManyNodes extends Benchmark {
+
+ @Override
+ public void run(Iterable<RepositoryFixture> fixtures) {
+ for (RepositoryFixture fixture : fixtures) {
+ System.out.println("ManyNodes test: " + fixture);
+ if (fixture.isAvailable(1)) {
+ try {
+ Repository[] cluster = fixture.setUpCluster(1);
+ try {
+ Session session = cluster[0].login(new SimpleCredentials(
+ "admin", "admin".toCharArray()));
+ try {
+ addManyNodes(session);
+ } finally {
+ session.logout();
+ }
+ } finally {
+ fixture.tearDownCluster();
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ } else {
+ System.out.println("- not available, skipping");
+ }
+ }
+ }
+
+
+ private void addManyNodes(Session session) throws RepositoryException {
+ Node root = session.getRootNode().addNode("testRoot");
+ session.save();
+ int total = 0;
+ long time = System.currentTimeMillis();
+ for (int k = 0; k < 1000; k++) {
+ Node nk = root.addNode("test" + k, "nt:folder");
+ for (int j = 0; j < 100; j++) {
+ Node nj = nk.addNode("test" + j, "nt:folder");
+ for (int i = 0; i < 100; i++) {
+ nj.addNode("child" + i, "nt:folder");
+ total++;
+ }
+ session.save();
+ if (total % 10000 == 0) {
+ long now = System.currentTimeMillis();
+ System.out.println(total + " nodes in "
+ + (now - time) + " ms");
+ time = now;
+ }
+ }
+ }
+ }
+
+}