Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 142 additions & 0 deletions .github/workflows/performance-benchmarks-java.yml
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
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.

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"
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


- 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
7 changes: 6 additions & 1 deletion .github/workflows/performance-benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,18 @@ jobs:
uses: ./.github/workflows/performance-benchmarks-go.yml
with:
dafny: ${{needs.getVersion.outputs.version}}
performance-benchmarks-java:
needs: getVersion
uses: ./.github/workflows/performance-benchmarks-java.yml
with:
dafny: ${{needs.getVersion.outputs.version}}
performance-benchmarks-rust:
needs: getVersion
uses: ./.github/workflows/performance-benchmarks-rust.yml
with:
dafny: ${{needs.getVersion.outputs.version}}
notify:
needs: [getVersion, performance-benchmarks-go, performance-benchmarks-rust]
needs: [getVersion, performance-benchmarks-go, performance-benchmarks-rust, performance-benchmarks-java]
if: ${{ failure() }}
uses: aws/aws-cryptographic-material-providers-library/.github/workflows/slack-notification.yml@main
with:
Expand Down
123 changes: 121 additions & 2 deletions cfn/CW-Filters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,125 @@ Resources:
- Key: Language
Value: "$.result.language"

# Filter 1: Memory Efficiency Ratio - JavaDDBEC
JavaDDBECMemoryEfficiencyRatioFilter:
Type: AWS::Logs::MetricFilter
Properties:
LogGroupName: !Ref LogGroupName
FilterPattern: '{ $.result.language = "java-ddbec-native" && $.result.test_name = "memory" }'
MetricTransformations:
- MetricName: MemoryEfficiencyRatio
MetricNamespace: JavaDDBECPerformanceBenchmarks
MetricValue: "$.result.memory_efficiency_ratio"
Dimensions:
- Key: Language
Value: "$.result.language"

# Filter 2: Memory Usage 50MB - JavaDDBEC
JavaDDBECMemoryUsage50MBFilter:
Type: AWS::Logs::MetricFilter
Properties:
LogGroupName: !Ref LogGroupName
FilterPattern: '{ $.result.language = "java-ddbec-native" && $.result.test_name = "memory" }'
MetricTransformations:
- MetricName: PeakMemoryMB
MetricNamespace: JavaDDBECPerformanceBenchmarks
MetricValue: "$.result.peak_memory_mb"
Unit: Megabytes
Dimensions:
- Key: Language
Value: "$.result.language"

# Filter 3: DataSize 52MB P50 Latency - JavaDDBEC
JavaDDBECDataSize52MBP50LatencyFilter:
Type: AWS::Logs::MetricFilter
Properties:
LogGroupName: !Ref LogGroupName
FilterPattern: '{ $.metadata.language = "java-ddbec-native" && $.result.test_name = "throughput" }'
MetricTransformations:
- MetricName: P50Latency
MetricNamespace: JavaDDBECPerformanceBenchmarks
MetricValue: "$.result.p50_latency"
Unit: Milliseconds
Dimensions:
- Key: Language
Value: "$.result.language"

# Filter 4: DataSize 52MB P95 Latency - JavaDDBEC
JavaDDBECDataSize52MBP95LatencyFilter:
Type: AWS::Logs::MetricFilter
Properties:
LogGroupName: !Ref LogGroupName
FilterPattern: '{ $.metadata.language = "java-ddbec-native" && $.result.test_name = "throughput" }'
MetricTransformations:
- MetricName: P95Latency
MetricNamespace: JavaDDBECPerformanceBenchmarks
MetricValue: "$.result.p95_latency"
Unit: Milliseconds
Dimensions:
- Key: Language
Value: "$.result.language"

# Filter 5: DataSize 52MB P99 Latency - JavaDDBEC
JavaDDBECDataSize52MBP99LatencyFilter:
Type: AWS::Logs::MetricFilter
Properties:
LogGroupName: !Ref LogGroupName
FilterPattern: '{ $.metadata.language = "java-ddbec-native" && $.result.test_name = "throughput" }'
MetricTransformations:
- MetricName: P99Latency
MetricNamespace: JavaDDBECPerformanceBenchmarks
MetricValue: "$.result.p99_latency"
Unit: Milliseconds
Dimensions:
- Key: Language
Value: "$.result.language"

# Filter 6: Concurrency P50 - JavaDDBEC
JavaDDBECConcurrencyP50Filter:
Type: AWS::Logs::MetricFilter
Properties:
LogGroupName: !Ref LogGroupName
FilterPattern: '{ $.result.language = "java-ddbec-native" && $.result.test_name = "concurrent" }'
MetricTransformations:
- MetricName: ConcurrencyP50Latency
MetricNamespace: JavaDDBECPerformanceBenchmarks
MetricValue: "$.result.p50_latency"
Unit: Milliseconds
Dimensions:
- Key: Language
Value: "$.result.language"

# Filter 7: Concurrency P95 - JavaDDBEC
JavaDDBECConcurrencyP95Filter:
Type: AWS::Logs::MetricFilter
Properties:
LogGroupName: !Ref LogGroupName
FilterPattern: '{ $.result.language = "java-ddbec-native" && $.result.test_name = "concurrent" }'
MetricTransformations:
- MetricName: ConcurrencyP95Latency
MetricNamespace: JavaDDBECPerformanceBenchmarks
MetricValue: "$.result.p95_latency"
Unit: Milliseconds
Dimensions:
- Key: Language
Value: "$.result.language"

# Filter 8: Concurrency P99 - JavaDDBEC
JavaDDBECConcurrencyP99Filter:
Type: AWS::Logs::MetricFilter
Properties:
LogGroupName: !Ref LogGroupName
FilterPattern: '{ $.result.language = "java-ddbec-native" && $.result.test_name = "concurrent" }'
MetricTransformations:
- MetricName: ConcurrencyP99Latency
MetricNamespace: JavaDDBECPerformanceBenchmarks
MetricValue: "$.result.p99_latency"
Unit: Milliseconds
Dimensions:
- Key: Language
Value: "$.result.language"

Outputs:
LogGroupName:
Description: "CloudWatch Log Group Name"
Expand All @@ -612,8 +731,8 @@ Outputs:

TotalFiltersCreated:
Description: "Total number of metric filters created"
Value: "40"
Value: "48"

MetricNamespaces:
Description: "CloudWatch Metrics Namespaces by Language"
Value: "JavaDBESDKPerformanceBenchmarks, NetDBESDKPerformanceBenchmarks, PythonDBESDKPerformanceBenchmarks, GoDBESDKPerformanceBenchmarks, RustDBESDKPerformanceBenchmarks"
Value: "JavaDBESDKPerformanceBenchmarks, NetDBESDKPerformanceBenchmarks, PythonDBESDKPerformanceBenchmarks, GoDBESDKPerformanceBenchmarks, RustDBESDKPerformanceBenchmarks, JavaDDBECPerformanceBenchmarks"
15 changes: 15 additions & 0 deletions db-esdk-performance-testing/benchmarks/java/.gitignore
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
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

Loading
Loading