Skip to content

ARROW-10069: [Java] Support running Java benchmarks from command line#8245

Closed
liyafan82 wants to merge 2 commits intoapache:masterfrom
liyafan82:fly_0923_pf
Closed

ARROW-10069: [Java] Support running Java benchmarks from command line#8245
liyafan82 wants to merge 2 commits intoapache:masterfrom
liyafan82:fly_0923_pf

Conversation

@liyafan82
Copy link
Copy Markdown
Contributor

@liyafan82
Copy link
Copy Markdown
Contributor Author

The straightforward way of running a Java benchmark is through the following command:

java  -jar ./performance/target/benchmarks.jar 

However, it is like to fail with the following message:

ERROR: Unable to find the resource: /META-INF/BenchmarkList

The fundamental reason for this error is missing some jars in the class path, and it is considered a bug of maven compilation plugin (https://issues.apache.org/jira/browse/MCOMPILER-369)

Since there are many jars required (directly or indirected referenced), we recommend running the benchmarks through maven.

To run all benchmarks, please go to the arrow-performance directory, and invoke the command:

mvn clean install -Dskip.perf.benchmarks=false

We also support filtering specific benchmarks, for example:

mvn clean install -Dskip.perf.benchmarks=false -Dbenchmark.filter=.*IntBenchmarks.setIntDirectly

In addtion, we also support configuring other benchmark parameters, for example:

mvn clean install -Dskip.perf.benchmarks=false -Dbenchmark.filter=.*IntBenchmarks.setIntDirectly -Dbenchmark.forks=1 -Dbenchmark.warmups=5 -Dbenchmark.runs=5

@github-actions
Copy link
Copy Markdown

Copy link
Copy Markdown
Member

@lidavidm lidavidm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Two questions:

  • Should we include this in the developer docs in Sphinx, or in the README in the Java subproject?
  • How do I run the benchmarks without cleaning and re-building the project? (This seems to do it: mvn install --also-make -Dskip.perf.benchmarks=false -Dbenchmark.filter=.\*IntBenchmarks.setIntDirectly -pl :arrow-performance)

@kiszk
Copy link
Copy Markdown
Member

kiszk commented Sep 24, 2020

Thank you. Looks good.

In my environment, while benchmark.forks works, benchmark.warmups and benchmark.runs do not work. In other words, the following command executes the benchmark twice with 5 warmups and 5 runs.

mvn clean install  -Dskip.perf.benchmarks=false -Dbenchmark.filter=.*IntBenchmarks.setIntDirectly  -Dbenchmark.forks=2 -Dbenchmark.warmups=6 -Dbenchmark.runs=7

@liyafan82
Copy link
Copy Markdown
Contributor Author

@lidavidm Thanks for your feedback. Please see my reply in line.

LGTM. Two questions:

  • Should we include this in the developer docs in Sphinx, or in the README in the Java subproject?

Thanks for the good suggestion. It seems we do not have a development guide for Java. Maybe we should add one in a separate issue.

  • How do I run the benchmarks without cleaning and re-building the project? (This seems to do it: mvn install --also-make -Dskip.perf.benchmarks=false -Dbenchmark.filter=.\*IntBenchmarks.setIntDirectly -pl :arrow-performance)

Good question. We can run

mvn exec:exec -Dskip.perf.benchmarks=false ...

However, it is fast to rebuild the code, as there are only a few classes in the performance module. Rebuilding is helpful for making the generated benchmark code up to date.

@liyafan82
Copy link
Copy Markdown
Contributor Author

Thank you. Looks good.

In my environment, while benchmark.forks works, benchmark.warmups and benchmark.runs do not work. In other words, the following command executes the benchmark twice with 5 warmups and 5 runs.

mvn clean install  -Dskip.perf.benchmarks=false -Dbenchmark.filter=.*IntBenchmarks.setIntDirectly  -Dbenchmark.forks=2 -Dbenchmark.warmups=6 -Dbenchmark.runs=7

@kiszk Thanks for your feedback.
The problem was caused by incorrect parameter names. I have fixed it now, please check.

@kiszk
Copy link
Copy Markdown
Member

kiszk commented Sep 27, 2020

Thank you. Now, these three parameters work correctly as we expect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants