You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/12/10 06:44:30 UTC

[GitHub] [kafka] chia7712 commented on a change in pull request #9129: MINOR: Update jmh to 1.27 for async profiler support

chia7712 commented on a change in pull request #9129:
URL: https://github.com/apache/kafka/pull/9129#discussion_r539901142



##########
File path: jmh-benchmarks/README.md
##########
@@ -1,10 +1,69 @@
-### JMH-Benchmark module
+### JMH-Benchmarks module
 
 This module contains benchmarks written using [JMH](https://openjdk.java.net/projects/code-tools/jmh/) from OpenJDK.
 Writing correct micro-benchmarks in Java (or another JVM language) is difficult and there are many non-obvious pitfalls (many
 due to compiler optimizations). JMH is a framework for running and analyzing benchmarks (micro or macro) written in Java (or
 another JVM language).
 
+### Running benchmarks
+
+If you want to set specific JMH flags or only run certain benchmarks, passing arguments via
+gradle tasks is cumbersome. These are simplified by the provided `jmh.sh` script.
+
+The default behavior is to run all benchmarks:
+
+    ./jmh-benchmarks/jmh.sh
+    
+Pass a pattern or name after the command to select the benchmarks:
+
+    ./jmh-benchmarks/jmh.sh LRUCacheBenchmark
+
+Check which benchmarks that match the provided pattern:
+
+    ./jmh-benchmarks/jmh.sh -l LRUCacheBenchmark
+
+Run a specific test and override the number of forks, iterations and warm-up iteration to `2`:
+
+    ./jmh-benchmarks/jmh.sh -f 2 -i 2 -wi 2 LRUCacheBenchmark
+
+Run a specific test with async and GC profilers on Linux and flame graph output:
+
+    ./jmh-benchmarks/jmh.sh -prof gc -prof 'async:libPath=/path/to/async-profiler.so;output=flamegraph' LRUCacheBenchmark
+
+The following sections cover async profiler and GC profilers in more detail.
+
+### Using JMH with async profiler
+
+It's good practice to check profiler output for microbenchmarks in order to verify that they are valid.
+JMH includes [async-profiler](https://github.com/jvm-profiling-tools/async-profiler) integration that makes this easy:
+
+    ./jmh-benchmarks/jmh.sh -prof async:libPath=/path/to/async-profiler.so

Review comment:
       The file name of async-profiler is ```libasyncProfiler.so```. Should we follow the naming in this example?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org