-
Notifications
You must be signed in to change notification settings - Fork 18
chore: add java benchmark tests #2024
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
base: main
Are you sure you want to change the base?
Changes from 12 commits
62580b1
d76fe17
265f99c
49bf8f2
91ea1fa
59a1d73
2dedf7f
ead4aac
2857795
fd1853e
7a2d2e7
aa3bd48
37042ce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,142 @@ | ||
| # This workflow runs every day 09:00 UTC (1AM PST) | ||
| name: Performance Benchmarks | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| dafny: | ||
| description: "The Dafny version to run" | ||
| required: false | ||
| default: "4.9.0" | ||
| type: string | ||
| regenerate-code: | ||
| description: "Regenerate code using smithy-dafny" | ||
| required: false | ||
| default: false | ||
| type: boolean | ||
| mpl-version: | ||
| description: "MPL version to use" | ||
| required: false | ||
| type: string | ||
| mpl-head: | ||
| description: "Running on MPL HEAD" | ||
| required: false | ||
| default: false | ||
| type: boolean | ||
| jobs: | ||
| testJava: | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| library: [DynamoDbEncryption] | ||
| benchmark-dir: [db-esdk-performance-testing] | ||
| java-version: [8] | ||
| os: [macos-14] | ||
| runs-on: ${{ matrix.os }} | ||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
| steps: | ||
| - name: Configure AWS Credentials | ||
| uses: aws-actions/configure-aws-credentials@v5 | ||
| with: | ||
| aws-region: us-west-2 | ||
| role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-DDBEC-Dafny-Role-us-west-2 | ||
| role-session-name: DDBEC-Performance-Benchmarks-Java | ||
|
|
||
| - uses: actions/checkout@v5 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - name: Setup Dafny | ||
| uses: ./submodules/MaterialProviders/.github/actions/setup_dafny/ | ||
| with: | ||
| dafny-version: ${{ inputs.dafny }} | ||
|
|
||
| - name: Update MPL submodule if using MPL HEAD | ||
| if: ${{ inputs.mpl-head == true }} | ||
| working-directory: submodules/MaterialProviders | ||
| run: | | ||
| git checkout main | ||
| git pull | ||
| git submodule update --init --recursive | ||
| git rev-parse HEAD | ||
|
|
||
| - name: Update project.properties if using MPL HEAD | ||
| if: ${{ inputs.mpl-head == true }} | ||
| run: | | ||
| sed "s/mplDependencyJavaVersion=.*/mplDependencyJavaVersion=${{inputs.mpl-version}}/g" project.properties > project.properties2; mv project.properties2 project.properties | ||
|
|
||
| - name: Install Smithy-Dafny codegen dependencies | ||
| uses: ./.github/actions/install_smithy_dafny_codegen_dependencies | ||
|
|
||
| - name: Regenerate code using smithy-dafny if necessary | ||
| if: ${{ inputs.regenerate-code }} | ||
| uses: ./.github/actions/polymorph_codegen | ||
| with: | ||
| dafny: ${{ env.DAFNY_VERSION }} | ||
| library: ${{ matrix.library }} | ||
| diff-generated-code: false | ||
| update-and-regenerate-mpl: true | ||
|
|
||
| - name: Setup Java 8 | ||
| uses: actions/setup-java@v5 | ||
| with: | ||
| distribution: "corretto" | ||
| java-version: 8 | ||
|
|
||
| - name: Setup Java ${{ matrix.java-version }} | ||
| uses: actions/setup-java@v5 | ||
| with: | ||
| distribution: "corretto" | ||
| java-version: ${{ matrix.java-version }} | ||
|
|
||
| - name: Build ${{ matrix.library }} implementation | ||
| shell: bash | ||
| working-directory: ./${{ matrix.library }} | ||
| run: | | ||
| # This works because `node` is installed by default on GHA runners | ||
| CORES=$(node -e 'console.log(os.cpus().length)') | ||
| make build_java CORES=$CORES | ||
| make mvn_local_deploy | ||
|
|
||
| - name: Run Performance Benchmarks - Quick Mode | ||
| shell: bash | ||
| 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" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Q: What's the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added it so that I could get DDBEC metrics |
||
|
|
||
| - name: Parse and Format Logs | ||
| working-directory: ./${{matrix.benchmark-dir}}/benchmarks/results/raw-data/ | ||
| run: | | ||
| LOG_FILE="java_results.json" | ||
| DDBEC_LOG_FILE="java_ddbec_results.json" | ||
| UPLOAD_FILE="cloudwatch_logs.json" | ||
| DDBEC_UPLOAD_FILE="cloudwatch_ddbec_log.json" | ||
| TIMESTAMP=$(date +%s%3N) | ||
| jq -c --arg ts "$(date +%s)000" '[.results[] as $result | .metadata as $meta | {timestamp: ($ts | tonumber), message: ({metadata: $meta, result: $result} | tostring)}]' $LOG_FILE > $UPLOAD_FILE | ||
| jq -c --arg ts "$(date +%s)000" '[.results[] as $result | .metadata as $meta | {timestamp: ($ts | tonumber), message: ({metadata: $meta, result: $result} | tostring)}]' $DDBEC_LOG_FILE > $DDBEC_UPLOAD_FILE | ||
|
|
||
| - name: Upload logs to CloudWatch | ||
| working-directory: ./${{matrix.benchmark-dir}}/benchmarks/results/raw-data/ | ||
| run: | | ||
| LOG_FILE="cloudwatch_logs.json" | ||
| DDBEC_LOG_FILE="cloudwatch_ddbec_log.json" | ||
| LOG_GROUP="aws-dbesdk-performance-benchmarks" | ||
| LOG_STREAM="java/${{matrix.java-version}}/quick_benchmarks/${{ github.workflow }}" | ||
|
|
||
| # Create log stream (ignore if exists) | ||
| aws logs create-log-stream \ | ||
| --log-group-name "$LOG_GROUP" \ | ||
| --log-stream-name "$LOG_STREAM" 2>/dev/null || true | ||
|
|
||
| aws logs put-log-events \ | ||
| --log-group-name "$LOG_GROUP" \ | ||
| --log-stream-name "$LOG_STREAM" \ | ||
| --log-events file://$LOG_FILE | ||
|
|
||
| aws logs put-log-events \ | ||
| --log-group-name "$LOG_GROUP" \ | ||
| --log-stream-name "$LOG_STREAM" \ | ||
| --log-events file://$DDBEC_LOG_FILE | ||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,15 @@ | ||||||||||||
| # Ignore Gradle project-specific cache directory | ||||||||||||
| .gradle | ||||||||||||
|
|
||||||||||||
| # Ignore Gradle build output directory | ||||||||||||
| build | ||||||||||||
|
|
||||||||||||
| # Ignore bin | ||||||||||||
| bin | ||||||||||||
|
|
||||||||||||
| # JetBrains | ||||||||||||
| .idea/* | ||||||||||||
| *.iml | ||||||||||||
|
|
||||||||||||
| # Mac OS X | ||||||||||||
| .DS_Store | ||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
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.
With step (
Setup Java ${{ matrix.java-version }}) already in the yml file, this step seems redundant.