From 837b1f4f9e173b11ce830cfdf0561542bc050bac Mon Sep 17 00:00:00 2001 From: Jose Corella Date: Tue, 13 Jan 2026 12:39:08 -0800 Subject: [PATCH 1/9] chore: upload performance benchmarks to cloudwatch --- .github/workflows/ci_test_java.yml | 1 + .../workflows/performance-benchmarks-go.yml | 144 ++++++++++++++++++ .github/workflows/performance-benchmarks.yml | 32 ++++ 3 files changed, 177 insertions(+) create mode 100644 .github/workflows/performance-benchmarks-go.yml create mode 100644 .github/workflows/performance-benchmarks.yml diff --git a/.github/workflows/ci_test_java.yml b/.github/workflows/ci_test_java.yml index e48506bdc..ba04cba39 100644 --- a/.github/workflows/ci_test_java.yml +++ b/.github/workflows/ci_test_java.yml @@ -45,6 +45,7 @@ jobs: - uses: actions/checkout@v5 with: + ref: benchmark submodules: recursive - name: Setup Dafny diff --git a/.github/workflows/performance-benchmarks-go.yml b/.github/workflows/performance-benchmarks-go.yml new file mode 100644 index 000000000..8920f26cd --- /dev/null +++ b/.github/workflows/performance-benchmarks-go.yml @@ -0,0 +1,144 @@ +# This workflow performs benchmark testing in Go. +name: Performance Benchmarks Go + +on: + workflow_call: + inputs: + dafny: + description: "The Dafny version to run" + required: true + 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: + testGo: + strategy: + fail-fast: false + matrix: + library: [DynamoDbEncryption] + os: [ubuntu-22.04, macos-15-intel] + go-version: ["1.23", "1.24", "1.25"] + 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-Go + + - name: Support longpaths + run: | + git config --global core.longpaths true + + - uses: actions/checkout@v5 + with: + submodules: recursive + + - name: Create temporary global.json + run: echo '{"sdk":{"rollForward":"latestFeature","version":"6.0.0"}}' > ./global.json + + - name: Setup Java 17 for codegen + uses: actions/setup-java@v5 + with: + distribution: "corretto" + java-version: "17" + + - 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 Go + uses: actions/setup-go@v6 + with: + go-version: ${{ matrix.go-version }} + + - uses: actions/checkout@v5 + - name: Init Submodules + shell: bash + run: | + git submodule update --init --recursive submodules/smithy-dafny + git submodule update --init --recursive submodules/MaterialProviders + + - name: Install Smithy-Dafny codegen dependencies + uses: ./.github/actions/install_smithy_dafny_codegen_dependencies + + - 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 transpile_go CORES=$CORES + + - name: Run Performance Benchmarks - Quick Mode + shell: bash + working-directory: ./db-esdk-performance-testing/benchmarks/go + run: | + go run . --config ../../config/test-scenarios.yaml --quick + + - name: Parse and Format Logs + working-directory: ./db-esdk-performance-testing/benchmarks/results/raw-data/ + run: | + LOG_FILE="go_results.json" + UPLOAD_FILE="go_filtered_logs.json" + TIMESTAMP=$(date +%s%3N) + jq -Rs --arg ts "$TIMESTAMP" ' + [ + split("\n") | .[] | + select(startswith("TestEncrypts")) | + split(" ") | map(select(. != "")) as $parts | + { + timestamp: ($ts | tonumber), + message: ({ + testName: $parts[0], + os: $parts[1], + language: $parts[2], + clockTime: ($parts[3] | tonumber), + cpuTime: ($parts[4] | tonumber) + } | tostring) + } + ] + ' $LOG_FILE > $UPLOAD_FILE + + - name: Upload logs to CloudWatch + working-directory: ./db-esdk-performance-testing/benchmarks/results/raw-data/ + run: | + LOG_FILE="go_filtered_logs.json" + LOG_GROUP="aws-dbesdk-performance-benchmarks" + LOG_STREAM="go/quick_benchmarks/${{ github.workflow }}/${{ github.run_id }}" + + # 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 \ No newline at end of file diff --git a/.github/workflows/performance-benchmarks.yml b/.github/workflows/performance-benchmarks.yml new file mode 100644 index 000000000..157ad1d9e --- /dev/null +++ b/.github/workflows/performance-benchmarks.yml @@ -0,0 +1,32 @@ +# This workflow runs every day 09:00 UTC (1AM PST) +name: Performance Benchmarks + +on: + pull_request: + paths: + - ".github/workflows/performance-benchmarks.yml" + schedule: + - cron: "00 09 * * *" + +jobs: + getVersion: + # Don't run the cron builds on forks + if: github.event_name != 'schedule' || github.repository_owner == 'aws' + uses: ./.github/workflows/dafny_version.yml + performance-benchmarks-go: + needs: getVersion + uses: ./.github/workflows/performance-benchmarks-go.yml + with: + dafny: ${{needs.getVersion.outputs.version}} + notify: + needs: + [ + getVersion, + performance-benchmarks-go + ] + if: ${{ failure() }} + uses: aws/aws-cryptographic-material-providers-library/.github/workflows/slack-notification.yml@main + with: + message: "Performance Benchmarks failed on `${{ github.repository }}`. View run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + secrets: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_CI }} From 65440198756dd82f325383899ac79728ce2268f1 Mon Sep 17 00:00:00 2001 From: Jose Corella Date: Tue, 13 Jan 2026 12:48:15 -0800 Subject: [PATCH 2/9] update --- .../workflows/performance-benchmarks-go.yml | 22 +++---------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/.github/workflows/performance-benchmarks-go.yml b/.github/workflows/performance-benchmarks-go.yml index 8920f26cd..d1d706b37 100644 --- a/.github/workflows/performance-benchmarks-go.yml +++ b/.github/workflows/performance-benchmarks-go.yml @@ -106,30 +106,14 @@ jobs: working-directory: ./db-esdk-performance-testing/benchmarks/results/raw-data/ run: | LOG_FILE="go_results.json" - UPLOAD_FILE="go_filtered_logs.json" + UPLOAD_FILE="cloudwatch_logs.json" TIMESTAMP=$(date +%s%3N) - jq -Rs --arg ts "$TIMESTAMP" ' - [ - split("\n") | .[] | - select(startswith("TestEncrypts")) | - split(" ") | map(select(. != "")) as $parts | - { - timestamp: ($ts | tonumber), - message: ({ - testName: $parts[0], - os: $parts[1], - language: $parts[2], - clockTime: ($parts[3] | tonumber), - cpuTime: ($parts[4] | tonumber) - } | 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)}' $LOG_FILE > $UPLOAD_FILE - name: Upload logs to CloudWatch working-directory: ./db-esdk-performance-testing/benchmarks/results/raw-data/ run: | - LOG_FILE="go_filtered_logs.json" + LOG_FILE="cloudwatch_logs.json" LOG_GROUP="aws-dbesdk-performance-benchmarks" LOG_STREAM="go/quick_benchmarks/${{ github.workflow }}/${{ github.run_id }}" From 1cfd716de943d7f2ae6c124853de8d36d2e93869 Mon Sep 17 00:00:00 2001 From: Jose Corella Date: Tue, 13 Jan 2026 13:04:32 -0800 Subject: [PATCH 3/9] kinda need to setup dafny --- .github/workflows/performance-benchmarks-go.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/performance-benchmarks-go.yml b/.github/workflows/performance-benchmarks-go.yml index d1d706b37..aad1058df 100644 --- a/.github/workflows/performance-benchmarks-go.yml +++ b/.github/workflows/performance-benchmarks-go.yml @@ -77,6 +77,11 @@ jobs: uses: actions/setup-go@v6 with: go-version: ${{ matrix.go-version }} + + - name: Setup Dafny + uses: dafny-lang/setup-dafny-action@v1.8.0 + with: + dafny-version: ${{ inputs.dafny }} - uses: actions/checkout@v5 - name: Init Submodules From 012471635e0493634c6d77e753c7c26c66e5e50d Mon Sep 17 00:00:00 2001 From: Jose Corella Date: Tue, 13 Jan 2026 13:16:06 -0800 Subject: [PATCH 4/9] chekckout the right branch --- .github/workflows/performance-benchmarks-go.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/performance-benchmarks-go.yml b/.github/workflows/performance-benchmarks-go.yml index aad1058df..1cba89da9 100644 --- a/.github/workflows/performance-benchmarks-go.yml +++ b/.github/workflows/performance-benchmarks-go.yml @@ -48,6 +48,7 @@ jobs: - uses: actions/checkout@v5 with: + ref: benchmark submodules: recursive - name: Create temporary global.json @@ -77,7 +78,7 @@ jobs: uses: actions/setup-go@v6 with: go-version: ${{ matrix.go-version }} - + - name: Setup Dafny uses: dafny-lang/setup-dafny-action@v1.8.0 with: From 4d291f9eed14a430165e003c180a7d6b1517e679 Mon Sep 17 00:00:00 2001 From: Jose Corella Date: Tue, 13 Jan 2026 13:49:36 -0800 Subject: [PATCH 5/9] update --- .github/workflows/performance-benchmarks-go.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/performance-benchmarks-go.yml b/.github/workflows/performance-benchmarks-go.yml index 1cba89da9..3af8c1d4d 100644 --- a/.github/workflows/performance-benchmarks-go.yml +++ b/.github/workflows/performance-benchmarks-go.yml @@ -28,6 +28,7 @@ jobs: fail-fast: false matrix: library: [DynamoDbEncryption] + benchmark-dir: [db-esdk-performance-testing/benchmarks] os: [ubuntu-22.04, macos-15-intel] go-version: ["1.23", "1.24", "1.25"] runs-on: ${{ matrix.os }} @@ -84,7 +85,6 @@ jobs: with: dafny-version: ${{ inputs.dafny }} - - uses: actions/checkout@v5 - name: Init Submodules shell: bash run: | @@ -104,12 +104,12 @@ jobs: - name: Run Performance Benchmarks - Quick Mode shell: bash - working-directory: ./db-esdk-performance-testing/benchmarks/go + working-directory: ./${{matrix.benchmark-dir}}/go run: | go run . --config ../../config/test-scenarios.yaml --quick - name: Parse and Format Logs - working-directory: ./db-esdk-performance-testing/benchmarks/results/raw-data/ + working-directory: ./${{matrix.benchmark-dir}}/results/raw-data/ run: | LOG_FILE="go_results.json" UPLOAD_FILE="cloudwatch_logs.json" @@ -117,7 +117,7 @@ jobs: 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 - name: Upload logs to CloudWatch - working-directory: ./db-esdk-performance-testing/benchmarks/results/raw-data/ + working-directory: ./${{matrix.benchmark-dir}}/results/raw-data/ run: | LOG_FILE="cloudwatch_logs.json" LOG_GROUP="aws-dbesdk-performance-benchmarks" From dffb0fee3268d0fead0b6217797d262a5dde4ea8 Mon Sep 17 00:00:00 2001 From: Jose Corella Date: Tue, 13 Jan 2026 13:58:13 -0800 Subject: [PATCH 6/9] m --- .github/workflows/performance-benchmarks-go.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/performance-benchmarks-go.yml b/.github/workflows/performance-benchmarks-go.yml index 3af8c1d4d..32b520342 100644 --- a/.github/workflows/performance-benchmarks-go.yml +++ b/.github/workflows/performance-benchmarks-go.yml @@ -85,6 +85,9 @@ jobs: with: dafny-version: ${{ inputs.dafny }} + - uses: actions/checkout@v5 + with: + ref: benchmark - name: Init Submodules shell: bash run: | From 5cca04fb01d7a65dbcc3c329c92b0143d4fa7efd Mon Sep 17 00:00:00 2001 From: Jose Corella Date: Tue, 13 Jan 2026 14:18:15 -0800 Subject: [PATCH 7/9] maybe? --- .github/workflows/performance-benchmarks-go.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/performance-benchmarks-go.yml b/.github/workflows/performance-benchmarks-go.yml index 32b520342..f797011c3 100644 --- a/.github/workflows/performance-benchmarks-go.yml +++ b/.github/workflows/performance-benchmarks-go.yml @@ -86,8 +86,6 @@ jobs: dafny-version: ${{ inputs.dafny }} - uses: actions/checkout@v5 - with: - ref: benchmark - name: Init Submodules shell: bash run: | From 430953292ca2a8d7d4a1d2d4823ee3100651425a Mon Sep 17 00:00:00 2001 From: Jose Corella Date: Tue, 13 Jan 2026 14:33:24 -0800 Subject: [PATCH 8/9] m --- .github/workflows/performance-benchmarks-go.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/performance-benchmarks-go.yml b/.github/workflows/performance-benchmarks-go.yml index f797011c3..b3aa9cb50 100644 --- a/.github/workflows/performance-benchmarks-go.yml +++ b/.github/workflows/performance-benchmarks-go.yml @@ -103,6 +103,12 @@ jobs: CORES=$(node -e 'console.log(os.cpus().length)') make transpile_go CORES=$CORES + - name: Build ${{ matrix.library }} implementation + shell: bash + working-directory: ./ + run: | + ls + - name: Run Performance Benchmarks - Quick Mode shell: bash working-directory: ./${{matrix.benchmark-dir}}/go From eb2005528110d89e2fd82918f0b550d70c45cf52 Mon Sep 17 00:00:00 2001 From: Jose Corella Date: Tue, 13 Jan 2026 14:41:32 -0800 Subject: [PATCH 9/9] ? --- .../workflows/performance-benchmarks-go.yml | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/.github/workflows/performance-benchmarks-go.yml b/.github/workflows/performance-benchmarks-go.yml index b3aa9cb50..d56f7e8a5 100644 --- a/.github/workflows/performance-benchmarks-go.yml +++ b/.github/workflows/performance-benchmarks-go.yml @@ -51,6 +51,11 @@ jobs: with: ref: benchmark submodules: recursive + - name: Init Submodules + shell: bash + run: | + git submodule update --init --recursive submodules/smithy-dafny + git submodule update --init --recursive submodules/MaterialProviders - name: Create temporary global.json run: echo '{"sdk":{"rollForward":"latestFeature","version":"6.0.0"}}' > ./global.json @@ -85,16 +90,15 @@ jobs: with: dafny-version: ${{ inputs.dafny }} - - uses: actions/checkout@v5 - - name: Init Submodules - shell: bash - run: | - git submodule update --init --recursive submodules/smithy-dafny - git submodule update --init --recursive submodules/MaterialProviders - - name: Install Smithy-Dafny codegen dependencies uses: ./.github/actions/install_smithy_dafny_codegen_dependencies + - name: Build ${{ matrix.library }} implementation + shell: bash + working-directory: ./ + run: | + ls + - name: Build ${{ matrix.library }} implementation shell: bash working-directory: ./${{ matrix.library }} @@ -102,13 +106,7 @@ jobs: # This works because `node` is installed by default on GHA runners CORES=$(node -e 'console.log(os.cpus().length)') make transpile_go CORES=$CORES - - - name: Build ${{ matrix.library }} implementation - shell: bash - working-directory: ./ - run: | - ls - + - name: Run Performance Benchmarks - Quick Mode shell: bash working-directory: ./${{matrix.benchmark-dir}}/go