Skip to content

chore: add java benchmark tests#2024

Open
josecorella wants to merge 13 commits intomainfrom
jocorell/java-benchmarks
Open

chore: add java benchmark tests#2024
josecorella wants to merge 13 commits intomainfrom
jocorell/java-benchmarks

Conversation

@josecorella
Copy link
Contributor

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@josecorella josecorella requested a review from a team as a code owner January 21, 2026 21:29
Copy link
Member

@rishav-karanjit rishav-karanjit left a comment

Choose a reason for hiding this comment

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

Overall looks good. All my comments are just nits except two comments/questions in DBESDKBenchmark.java.

diff-generated-code: false
update-and-regenerate-mpl: true

- name: Setup Java 8
Copy link
Member

Choose a reason for hiding this comment

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

With step (Setup Java ${{ matrix.java-version }}) already in the yml file, this step seems redundant.

Copy link
Member

Choose a reason for hiding this comment

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

Question: In Java, do we expect to push the jar file?

// Wait for all workers to complete
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).get();
} finally {
executor.shutdown();
Copy link
Member

Choose a reason for hiding this comment

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

executor.shutdown() tells the pool to stop accepting new tasks and start shutting down. It returns immediately without waiting for threads to actually terminate. Should we wait for all the threads to be terminated?

When next concurrent test starts in the same run, I can see the next test being affected by the previous thread if threads are still running.

Copy link
Contributor

Choose a reason for hiding this comment

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

Line 661 does a get on all which is blocking. And the shutdown happens after all the concurrent threads are done so no new concurrent run happens in the same executor (the service is created at line 623 which is local to the method.

}
Thread.sleep(SAMPLING_INTERVAL_MS);
}
} catch (InterruptedException e) {
Copy link
Member

Choose a reason for hiding this comment

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

This try catch only catches one Exception. If other exception (i.e OutOfMemoryError, NullPointerException, etc) occurs the thread seem to die silently which produces incorrect benchmark.

Copy link
Member

Choose a reason for hiding this comment

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

My understanding is in Java, program crashes only when exception occur in main thread.

*.iml

# Mac OS X
.DS_Store
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
.DS_Store
.DS_Store
# Package Files
*.jar

working-directory: ./${{matrix.benchmark-dir}}/benchmarks/java
run: |
./gradlew run --args="--config ../config/test-scenarios.yaml --quick"
./gradlew run --args="--config ../config/test-scenarios.yaml --quick --legacy-override"
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: What's the --legacy-override?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added it so that I could get DDBEC metrics

private double totalMemoryGb;

// Constructors
public BenchmarkResult() {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we even need this??

this.testName = testName;
}

public String getLanguage() {
Copy link
Contributor

@ShubhamChaturvedi7 ShubhamChaturvedi7 Jan 23, 2026

Choose a reason for hiding this comment

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

I know this is based on ESDK but maybe we can use Lombok or data classes in newer versions of Java?

// Wait for all workers to complete
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).get();
} finally {
executor.shutdown();
Copy link
Contributor

Choose a reason for hiding this comment

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

Line 661 does a get on all which is blocking. And the shutdown happens after all the concurrent threads are done so no new concurrent run happens in the same executor (the service is created at line 623 which is local to the method.

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