Return-Path: X-Original-To: apmail-tinkerpop-commits-archive@minotaur.apache.org Delivered-To: apmail-tinkerpop-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 676AD18233 for ; Thu, 31 Dec 2015 16:16:03 +0000 (UTC) Received: (qmail 55781 invoked by uid 500); 31 Dec 2015 16:16:03 -0000 Delivered-To: apmail-tinkerpop-commits-archive@tinkerpop.apache.org Received: (qmail 55755 invoked by uid 500); 31 Dec 2015 16:16:03 -0000 Mailing-List: contact commits-help@tinkerpop.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tinkerpop.incubator.apache.org Delivered-To: mailing list commits@tinkerpop.incubator.apache.org Received: (qmail 55745 invoked by uid 99); 31 Dec 2015 16:16:03 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Dec 2015 16:16:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 9CA511804C7 for ; Thu, 31 Dec 2015 16:16:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.247 X-Spam-Level: * X-Spam-Status: No, score=1.247 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-0.554, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id IvdsxgSKgWgp for ; Thu, 31 Dec 2015 16:15:51 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with SMTP id D517821157 for ; Thu, 31 Dec 2015 16:15:49 +0000 (UTC) Received: (qmail 55703 invoked by uid 99); 31 Dec 2015 16:15:49 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Dec 2015 16:15:49 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E4316E00A7; Thu, 31 Dec 2015 16:15:48 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: twilmes@apache.org To: commits@tinkerpop.incubator.apache.org Date: Thu, 31 Dec 2015 16:15:49 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [2/2] incubator-tinkerpop git commit: New gremlin-benchmark module added with microbenchmark base class inspired by the Netty projects use of JMH. Simple addV/addVertex benchmarks added to test insert performance. New gremlin-benchmark module added with microbenchmark base class inspired by the Netty projects use of JMH. Simple addV/addVertex benchmarks added to test insert performance. Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/70640684 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/70640684 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/70640684 Branch: refs/heads/TINKERPOP-1016 Commit: 70640684f75139ee65b3deb58c91c139f58f14c8 Parents: b89e860 Author: Ted Wilmes Authored: Thu Dec 31 10:15:27 2015 -0600 Committer: Ted Wilmes Committed: Thu Dec 31 10:15:27 2015 -0600 ---------------------------------------------------------------------- gremlin-benchmark/pom.xml | 115 ++++++++++++ .../benchmark/util/AbstractMicrobenchmark.java | 79 ++++++++ .../process/GraphTraversalBenchmark.java | 54 ++++++ gremlin-performance/pom.xml | 182 ------------------- .../process/GraphTraversalPerformance.java | 81 --------- 5 files changed, 248 insertions(+), 263 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/70640684/gremlin-benchmark/pom.xml ---------------------------------------------------------------------- diff --git a/gremlin-benchmark/pom.xml b/gremlin-benchmark/pom.xml new file mode 100644 index 0000000..c7cafc0 --- /dev/null +++ b/gremlin-benchmark/pom.xml @@ -0,0 +1,115 @@ + + + + + tinkerpop + org.apache.tinkerpop + 3.1.1-SNAPSHOT + + 4.0.0 + gremlin-benchmark + jar + Apache TinkerPop :: Gremlin Benchmark + + + + junit + junit + ${junit.version} + test + + + org.apache.tinkerpop + gremlin-core + 3.1.1-SNAPSHOT + + + org.apache.tinkerpop + tinkergraph-gremlin + 3.1.1-SNAPSHOT + + + org.apache.tinkerpop + gremlin-shaded + 3.1.1-SNAPSHOT + + + org.openjdk.jmh + jmh-core + ${jmh.version} + + + org.openjdk.jmh + jmh-generator-annprocess + ${jmh.version} + provided + + + + + UTF-8 + 1.11.2 + 1.6 + true + + + + + + maven-deploy-plugin + + true + + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*Benchmark*.java + + + **/Abstract* + **/AbstractMicrobenchmark.java + **/*$*.class + **/*_jmhType* + + + ${project.build.directory}/reports/performance/ + + + + + + + http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/70640684/gremlin-benchmark/src/test/java/org/apache/tinkerpop/benchmark/util/AbstractMicrobenchmark.java ---------------------------------------------------------------------- diff --git a/gremlin-benchmark/src/test/java/org/apache/tinkerpop/benchmark/util/AbstractMicrobenchmark.java b/gremlin-benchmark/src/test/java/org/apache/tinkerpop/benchmark/util/AbstractMicrobenchmark.java new file mode 100644 index 0000000..9e6a781 --- /dev/null +++ b/gremlin-benchmark/src/test/java/org/apache/tinkerpop/benchmark/util/AbstractMicrobenchmark.java @@ -0,0 +1,79 @@ +/* + * 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.tinkerpop.benchmark.util; + +import org.junit.Test; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Warmup; +import org.openjdk.jmh.runner.Runner; +import org.openjdk.jmh.runner.options.ChainedOptionsBuilder; +import org.openjdk.jmh.runner.options.OptionsBuilder; + +/** + * Base class for all JMH benchmarks. Based upon Netty's AbstractMicrobenchmark. + */ +@Warmup(iterations = AbstractMicrobenchmark.DEFAULT_WARMUP_ITERATIONS) +@Measurement(iterations = AbstractMicrobenchmark.DEFAULT_MEASURE_ITERATIONS) +@Fork(AbstractMicrobenchmark.DEFAULT_FORKS) +public abstract class AbstractMicrobenchmark { + + protected static final int DEFAULT_WARMUP_ITERATIONS = 10; + protected static final int DEFAULT_MEASURE_ITERATIONS = 10; + protected static final int DEFAULT_FORKS = 2; + + protected static final String[] JVM_ARGS = { + "-server", "-Xms512m", "-Xmx512m" + }; + + @Test + public void run() throws Exception { + String className = getClass().getSimpleName(); + + ChainedOptionsBuilder runnerOptions = new OptionsBuilder() + .include(".*" + className + ".*") + .jvmArgs(JVM_ARGS); + + if (getWarmupIterations() > 0) { + runnerOptions.warmupIterations(getWarmupIterations()); + } + + if (getMeasureIterations() > 0) { + runnerOptions.measurementIterations(getMeasureIterations()); + } + + if (getForks() > 0) { + runnerOptions.forks(getForks()); + } + + new Runner(runnerOptions.build()).run(); + } + + protected int getWarmupIterations() { + return DEFAULT_WARMUP_ITERATIONS; + } + + protected int getMeasureIterations() { + return DEFAULT_MEASURE_ITERATIONS; + } + + protected int getForks() { + return DEFAULT_FORKS; + } +} http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/70640684/gremlin-benchmark/src/test/java/org/apache/tinkerpop/gremlin/process/GraphTraversalBenchmark.java ---------------------------------------------------------------------- diff --git a/gremlin-benchmark/src/test/java/org/apache/tinkerpop/gremlin/process/GraphTraversalBenchmark.java b/gremlin-benchmark/src/test/java/org/apache/tinkerpop/gremlin/process/GraphTraversalBenchmark.java new file mode 100644 index 0000000..ea81b61 --- /dev/null +++ b/gremlin-benchmark/src/test/java/org/apache/tinkerpop/gremlin/process/GraphTraversalBenchmark.java @@ -0,0 +1,54 @@ +/* + * 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.tinkerpop.gremlin.process; + +import org.apache.tinkerpop.benchmark.util.AbstractMicrobenchmark; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.apache.tinkerpop.gremlin.structure.Graph; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph; +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.State; + +/** + * @author Ted Wilmes + */ +public class GraphTraversalBenchmark extends AbstractMicrobenchmark { + + @State(Scope.Thread) + public static class GraphState { + volatile Graph graph = TinkerGraph.open(); + } + + @State(Scope.Thread) + public static class TraversalState { + volatile GraphTraversalSource g = TinkerGraph.open().traversal(); + } + + @Benchmark + public Vertex testAddVertex(GraphState state) { return state.graph.addVertex("foo"); } + + @Benchmark + public Vertex testAddV(TraversalState state) { + return state.g.addV("foo").next(); + } + +} http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/70640684/gremlin-performance/pom.xml ---------------------------------------------------------------------- diff --git a/gremlin-performance/pom.xml b/gremlin-performance/pom.xml deleted file mode 100644 index da2a835..0000000 --- a/gremlin-performance/pom.xml +++ /dev/null @@ -1,182 +0,0 @@ - - - - - tinkerpop - org.apache.tinkerpop - 3.1.1-SNAPSHOT - - 4.0.0 - - gremlin-performance - jar - - JMH benchmark sample: Java - - - - - 3.0 - - - - - org.apache.tinkerpop - gremlin-core - 3.1.1-SNAPSHOT - - - org.apache.tinkerpop - tinkergraph-gremlin - 3.1.1-SNAPSHOT - - - org.apache.tinkerpop - gremlin-shaded - 3.1.1-SNAPSHOT - - - org.openjdk.jmh - jmh-core - ${jmh.version} - - - org.openjdk.jmh - jmh-generator-annprocess - ${jmh.version} - provided - - - - - UTF-8 - 1.11.2 - 1.6 - benchmarks - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.1 - - ${javac.target} - ${javac.target} - ${javac.target} - - - - org.apache.maven.plugins - maven-shade-plugin - 2.2 - - - package - - shade - - - ${uberjar.name} - - - org.openjdk.jmh.Main - - - - - - *:* - - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - - - - - - - - - maven-clean-plugin - 2.5 - - - maven-deploy-plugin - 2.8.1 - - - maven-install-plugin - 2.5.1 - - - maven-jar-plugin - 2.4 - - - maven-javadoc-plugin - 2.9.1 - - - maven-resources-plugin - 2.6 - - - maven-site-plugin - 3.3 - - - maven-source-plugin - 2.2.1 - - - maven-surefire-plugin - 2.17 - - - - - - http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/70640684/gremlin-performance/src/main/java/org/apache/tinkerpop/gremlin/process/GraphTraversalPerformance.java ---------------------------------------------------------------------- diff --git a/gremlin-performance/src/main/java/org/apache/tinkerpop/gremlin/process/GraphTraversalPerformance.java b/gremlin-performance/src/main/java/org/apache/tinkerpop/gremlin/process/GraphTraversalPerformance.java deleted file mode 100644 index fcb36bd..0000000 --- a/gremlin-performance/src/main/java/org/apache/tinkerpop/gremlin/process/GraphTraversalPerformance.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.tinkerpop.gremlin.process; - -import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; -import org.apache.tinkerpop.gremlin.structure.Graph; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph; -import org.openjdk.jmh.annotations.Benchmark; -import org.openjdk.jmh.annotations.BenchmarkMode; -import org.openjdk.jmh.annotations.Mode; -import org.openjdk.jmh.annotations.OutputTimeUnit; -import org.openjdk.jmh.annotations.Scope; -import org.openjdk.jmh.annotations.State; -import org.openjdk.jmh.profile.StackProfiler; -import org.openjdk.jmh.runner.Runner; -import org.openjdk.jmh.runner.RunnerException; -import org.openjdk.jmh.runner.options.Options; -import org.openjdk.jmh.runner.options.OptionsBuilder; - -import java.util.concurrent.TimeUnit; - -/** - * Created by twilmes on 12/24/15. - */ -public class GraphTraversalPerformance { - - @State(Scope.Thread) - public static class GraphState { - volatile Graph graph = TinkerGraph.open(); - } - - @State(Scope.Thread) - public static class TraversalState { - volatile GraphTraversalSource g = TinkerGraph.open().traversal(); - } - - @Benchmark -// @BenchmarkMode(Mode.AverageTime) -// @OutputTimeUnit(TimeUnit.MICROSECONDS) - public Vertex testAddVertex(GraphState state) { - return state.graph.addVertex("foo"); - } - - @Benchmark -// @BenchmarkMode(Mode.AverageTime) -// @OutputTimeUnit(TimeUnit.MICROSECONDS) - public Vertex testAddV(TraversalState state) { - return state.g.addV("foo").next(); - } - - - public static void main(String[] args) throws RunnerException { - Options opt = new OptionsBuilder() - .include(GraphTraversalPerformance.class.getSimpleName()) - .warmupIterations(5) - .measurementIterations(10) - .addProfiler(StackProfiler.class) - .forks(1) - .build(); - - new Runner(opt).run(); - } -}