Skip to content

refactor: update load test implementation to use DatabaseWrapper and enhance parameters#2329

Merged
robfrank merged 1 commit intomainfrom
test/long-runs
Jul 3, 2025
Merged

refactor: update load test implementation to use DatabaseWrapper and enhance parameters#2329
robfrank merged 1 commit intomainfrom
test/long-runs

Conversation

@robfrank
Copy link
Collaborator

@robfrank robfrank commented Jul 3, 2025

What does this PR do?

Enanche Perfs tests

Checklist

  • I have run the build using mvn clean package command
  • My unit tests cover both failure and success scenarios

@robfrank robfrank merged commit d534282 into main Jul 3, 2025
5 of 8 checks passed
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @robfrank, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors and expands the existing performance test suite for ArcadeDB. It generalizes the database interaction layer, introduces new test scenarios for 'likes' relationships, and enhances the robustness of data insertion and transaction management. The changes aim to provide more flexible, comprehensive, and insightful performance measurements for the ArcadeDB system.

Highlights

  • Refactored Database Interaction: The DatabaseWrapper has been refactored to accept host and port directly instead of a GenericContainer, making it more flexible for connecting to various database instances (local or containerized). The LocalhostDatabaseWrapper has been updated to use this new generic DatabaseWrapper.
  • Enhanced Load Test Scenarios: The SingleLocalhostServerSimpleLoadTestIT and SingleServerLoadTestIT now include new parameters (numOfFriendship, numOfLike) and logic to create 'Likes' relationships, expanding the scope of performance testing beyond just users and photos. The SingleServerSimpleLoadTestIT has been simplified to focus solely on users and photos.
  • Improved Transaction Handling in DatabaseWrapper: Database operations for adding users, photos, and friendships within DatabaseWrapper now utilize sqlscript with explicit BEGIN; LOCK TYPE; COMMIT RETRY; commands. This provides more robust and atomic transaction management, replacing the previous db.transaction and db.acquireLock approach.
  • Comprehensive Bucket Locking: The LocalTransactionExplicitLock in the core engine has been enhanced to include all polymorphic buckets when locking by type. This ensures more thorough pessimistic locking, especially in scenarios involving inheritance or complex schema structures, improving transaction reliability.
  • New Generic ID Supplier: A new TypeIdSupplier class has been introduced to generalize the process of fetching IDs for any given type (e.g., 'User', 'Photo') in batches. This replaces the previous UserIdSupplier, promoting code reusability and maintainability.
  • Enhanced Performance Test Metrics and Logging: Load tests now include detailed logging for test start/finish times, total duration, and expose Micrometer metrics. This provides better observability and insights into the performance characteristics of the database operations during testing.
  • Adjusted Container Memory Allocation: The default memory allocation for ArcadeDB containers in performance tests has been reduced from 16GB to 8GB (-Xms8G -Xmx8G), potentially optimizing resource consumption during test execution.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the performance tests by introducing a more generic DatabaseWrapper, enhancing test parameters, and adding new entities like 'likes' to the load tests. The changes improve the flexibility and realism of the performance testing suite. My review has identified a bug that could cause a division-by-zero error, as well as issues related to code clarity. Addressing these points will further improve the quality of the code.

}
addFriendship(userId1, userId2);
count++;
if (count % pauseEvery == 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

high

There is a potential for a division-by-zero error here. pauseEvery is calculated as numOfFriendships / 10. If numOfFriendships is greater than 0 but less than 10, pauseEvery will be 0. The modulo operation count % pauseEvery will then throw an ArithmeticException. You should add a check to ensure pauseEvery is greater than zero before the modulo operation.

Suggested change
if (count % pauseEvery == 0) {
if (pauseEvery > 0 && count % pauseEvery == 0) {

}
addLike(userId, photoId);
count++;
if (count % pauseEvery == 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Similar to the createFriendships method, there is a potential for a division-by-zero error here. pauseEvery is calculated as numOfLikes / 10. If numOfLikes is between 1 and 9, pauseEvery will be 0, causing an ArithmeticException from the modulo operator. Please add a guard to prevent this.

Suggested change
if (count % pauseEvery == 0) {
if (pauseEvery > 0 && count % pauseEvery == 0) {

// Each thread will create friendships
executor.submit(() -> {
DatabaseWrapper db1 = new DatabaseWrapper(host, port, idSupplier);
;
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

There is a stray semicolon here, which constitutes an empty statement. It should be removed to improve code clarity.

// Each thread will create friendships
executor.submit(() -> {
DatabaseWrapper db1 = new DatabaseWrapper(host, port, idSupplier);
;
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This is a stray semicolon which forms an empty statement. It should be removed for better code readability.

@codacy-production
Copy link

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.02% 100.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (15bb630) 70573 45337 64.24%
Head commit (78e1380) 70576 (+3) 45352 (+15) 64.26% (+0.02%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#2329) 3 3 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

robfrank added a commit that referenced this pull request Jul 3, 2025
@robfrank robfrank deleted the test/long-runs branch January 14, 2026 16:05
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.

1 participant