-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Publish results of JMH benchmark runs (Java SDK) to InfluxDB (#22238). #23041
Conversation
R: @lukecwik |
Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control |
Codecov Report
@@ Coverage Diff @@
## master #23041 +/- ##
==========================================
- Coverage 73.68% 73.63% -0.05%
==========================================
Files 714 716 +2
Lines 95220 95301 +81
==========================================
+ Hits 70161 70174 +13
- Misses 23762 23830 +68
Partials 1297 1297
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
sdks/java/testing/test-utils/src/main/java/org/apache/beam/sdk/testutils/jmh/Main.java
Outdated
Show resolved
Hide resolved
sdks/java/testing/test-utils/src/main/java/org/apache/beam/sdk/testutils/jmh/Main.java
Show resolved
Hide resolved
buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy
Outdated
Show resolved
Hide resolved
Run Java PreCommit |
We would need to tag a Jenkins machine to be only used for benchmark runs and configure it to run at most one job at a time. I would reach out on the dev@ mailing list to see if there are any volunteers to help set that up. |
@@ -1449,7 +1454,8 @@ class BeamModulePlugin implements Plugin<Project> { | |||
// Note that these tests will fail on JVMs that JMH doesn't support. | |||
def jmhTest = project.tasks.register("jmhTest", JavaExec) { | |||
dependsOn project.classes | |||
mainClass = "org.openjdk.jmh.Main" | |||
// Note: this will delegate to the default JMH runner |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Note: this will delegate to the default JMH runner | |
// Note: this will wrap the default JMH runner publishing results to InfluxDB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For jmhTest
the code just delegates to the default JMH runner, we don't want to publish single shot times. I'll updated to comment accordingly
@@ -37,6 +37,7 @@ dependencies { | |||
implementation library.java.http_client | |||
implementation library.java.http_core | |||
implementation library.java.slf4j_api | |||
provided library.java.jmh_core |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the motivation to use provided
over implementation
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Motivation was to not include jmh-core
on every classpath that depends on test-utils
. Happy to change to implementation
if you prefer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good.
sdks/java/testing/test-utils/src/main/java/org/apache/beam/sdk/testutils/jmh/Main.java
Outdated
Show resolved
Hide resolved
sdks/java/testing/test-utils/src/main/java/org/apache/beam/sdk/testutils/jmh/Main.java
Outdated
Show resolved
Hide resolved
sdks/java/testing/test-utils/src/main/java/org/apache/beam/sdk/testutils/jmh/Main.java
Outdated
Show resolved
Hide resolved
sdks/java/testing/test-utils/src/main/java/org/apache/beam/sdk/testutils/jmh/Main.java
Show resolved
Hide resolved
if (host != null) { | ||
builder.withHost(host); // default to localhost otherwise | ||
} | ||
return builder.withDatabase(database).withMeasurement(measurement).get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of specifying the measurement here (since since each datapoint does it)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx for catching, fixed 👍
Co-authored-by: Lukasz Cwik <[email protected]>
Adds a custom main wrapper around the JMH runner that supports publishing JMH benchmark results to InfluxDB.
Schema
The wrapper writes an aggregated InfluxDB datapoint for each benchmark to measurement
{INFLUXDB_BASE_MEASUREMENT}_{mode}
. Typically this isjava_jmh_thrpt
.The timestamp of the datapoint corresponds to the start time of the respective benchmark.
Individual timeseries are discriminated using the following tags including tags corresponding to additional benchmark parameters in case of parameterized benchmarks:
benchmark
(string): Fully qualified name of the benchmarkscoreUnit
(string): JMH score unitThe following fields are captured for each benchmark:
score
(float): JMH scorescoreMean
(float): Mean score of all iterationsscoreMedian
(float): Median score of all iterationsscoreError
(float): Mean error of the scoresampleCount
(integer): Number of score samplesdurationMs
(integer): Total benchmark duration (including warmups)Configuration
If settings can be inferred from the environment, benchmark results will be published to InfluxDB. Otherwise this will just delegate to the default JMH Main class.Use the following environment variables to configure the publisher:
INFLUXDB_HOST
: InfluxDB hostINFLUXDB_DATABASE
: InfluxDB databaseINFLUXDB_USER
: InfluxDB userINFLUXDB_USER_PASSWORD
: InfluxDB user passwordINFLUXDB_BASE_MEASUREMENT
: Prefix for measurement name, the benchmark mode will be appended to thisThank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
R: @username
).addresses #123
), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, commentfixes #<ISSUE NUMBER>
instead.CHANGES.md
with noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.
To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md
GitHub Actions Tests Status (on master branch)
See CI.md for more information about GitHub Actions CI.