You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by mm...@apache.org on 2021/04/07 21:24:52 UTC

[bookkeeper] branch master updated: ISSUE-2640: BP-43 Build microbenchmark with gradle and run microbenchmark (#2673)

This is an automated email from the ASF dual-hosted git repository.

mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new a7506e3  ISSUE-2640: BP-43 Build microbenchmark with gradle and run microbenchmark (#2673)
a7506e3 is described below

commit a7506e38a46532c1e6ba2ac43b209ddbdd4727de
Author: Prashant Kumar <65...@users.noreply.github.com>
AuthorDate: Wed Apr 7 14:24:41 2021 -0700

    ISSUE-2640: BP-43 Build microbenchmark with gradle and run microbenchmark (#2673)
    
    Co-authored-by: Prashant <pr...@splunk.com>
---
 dependencies.gradle                |  5 +++-
 microbenchmarks/build.gradle       | 52 ++++++++++++++++++++++++++++++++++++++
 microbenchmarks/run_with_gradle.sh | 19 ++++++++++++++
 settings.gradle                    |  1 +
 4 files changed, 76 insertions(+), 1 deletion(-)

diff --git a/dependencies.gradle b/dependencies.gradle
index 706af84..9b1c98e 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -51,6 +51,7 @@ depVersions = [
     jcommander: "1.78",
     jctools: "2.1.2",
     jetty: "9.4.31.v20200723",
+    jmh: "1.19",
     jmock: "2.8.2",
     jna: "3.2.7",
     jsr305: "3.0.2",
@@ -61,7 +62,6 @@ depVersions = [
     lombok: "1.18.10",
     lz4: "1.3.0",
     mockito: "3.0.0",
-    metrics_core: "4.1.13",
     netty: "4.1.32.Final",
     nettyTcnativeBoringSsl: "2.0.20.Final",
     powermock: "2.0.2",
@@ -117,6 +117,8 @@ depLibs = [
     jctools: "org.jctools:jctools-core:${depVersions.jctools}",
     jettyServlet: "org.eclipse.jetty:jetty-servlet:${depVersions.jetty}",
     jmock: "org.jmock:jmock:${depVersions.jmock}",
+    jmhCore: "org.openjdk.jmh:jmh-core:${depVersions.jmh}",
+    jmhGeneratorAnnprocess: "org.openjdk.jmh:jmh-generator-annprocess:${depVersions.jmh}",
     jna: "net.java.dev.jna:jna:${depVersions.jna}",
     jsr305: "com.google.code.findbugs:jsr305:${depVersions.jsr305}",
     junit: "junit:junit:${depVersions.junit}",
@@ -133,6 +135,7 @@ depLibs = [
     nettyCommon: "io.netty:netty-common:${depVersions.netty}",
     nettyHandler: "io.netty:netty-handler:${depVersions.netty}",
     nettyTcnativeBoringSsl: "io.netty:netty-tcnative-boringssl-static:${depVersions.nettyTcnativeBoringSsl}",
+    nettyTransport: "io.netty:netty-transport:${depVersions.netty}",
     nettyTransportNativeEpoll: "io.netty:netty-transport-native-epoll:${depVersions.netty}",
     powermockJunit: "org.powermock:powermock-module-junit4:${depVersions.powermock}",
     powermockMockito: "org.powermock:powermock-api-mockito2:${depVersions.powermock}",
diff --git a/microbenchmarks/build.gradle b/microbenchmarks/build.gradle
new file mode 100644
index 0000000..cbb2107
--- /dev/null
+++ b/microbenchmarks/build.gradle
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+plugins {
+    id 'java'
+}
+
+dependencies {
+    compileOnly project(":bookkeeper-common")
+    compileOnly project(":bookkeeper-server")
+    compileOnly project(":bookkeeper-stats-providers:codahale-metrics-provider")
+    compileOnly project(":bookkeeper-stats-providers:prometheus-metrics-provider")
+    compileOnly project(":bookkeeper-stats")
+    compileOnly project(":bookkeeper-proto")
+    compileOnly depLibs.metricsCore
+    compileOnly depLibs.protobuf
+    compileOnly depLibs.nettyBuffer
+    compileOnly depLibs.nettyTransport
+    compileOnly depLibs.jmhCore
+    compileOnly depLibs.guava
+    compileOnly depLibs.slf4j
+    annotationProcessor depLibs.jmhGeneratorAnnprocess
+}
+
+jar {
+    manifest {
+        attributes 'Main-Class': 'org.openjdk.jmh.Main'
+    }
+    println configurations.runtime.collect().size()
+    from {
+        configurations.compileOnly.collect {it.isDirectory() ? it : zipTree(it) }
+    }
+    exclude 'META-INF/*.RSA'
+    exclude 'META-INF/*.SF'
+    exclude 'META-INF/*.DSA'
+    archiveBaseName = 'microbenchmarks'
+}
\ No newline at end of file
diff --git a/microbenchmarks/run_with_gradle.sh b/microbenchmarks/run_with_gradle.sh
new file mode 100755
index 0000000..f136de7
--- /dev/null
+++ b/microbenchmarks/run_with_gradle.sh
@@ -0,0 +1,19 @@
+#!/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.
+
+java -Xms1G -Xmx1G -Djdk.nio.maxCachedBufferSize=0 -Djava.net.preferIPv4Stack=true -Duser.timezone=UTC -XX:-MaxFDLimit -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:+ResizeTLAB -XX:-ResizePLAB -XX:MetaspaceSize=128m -XX:MinMetaspaceFreeRatio=50 -XX:MaxMetaspaceFreeRatio=80 -XX:+ParallelRefProcEnabled -XX:StackShadowPages=20 -XX:+UseCompressedOops -XX:+DisableExplicitGC -XX:StringTableSize=1000003 -XX:InitiatingHeapOccupancyPercent=40 -jar ./microbenchmarks/build/libs/microbenchmarks.jar $@ - [...]
+
diff --git a/settings.gradle b/settings.gradle
index 4ef3374..d8fb2a1 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -49,6 +49,7 @@ include(':bookkeeper-benchmark',
         'circe-checksum:src:main:circe',
         'cpu-affinity',
         'cpu-affinity:src:main:affinity',
+        'microbenchmarks',
         'stats:utils',
         'stream:api',
         'stream:clients:java:all',