Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/performance-benchmarks-go.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This workflow runs every day 09:00 UTC (1AM PST)
# This workflow runs every day 16:00 UTC (8PM PST)
name: Performance Benchmarks

on:
Expand Down
135 changes: 135 additions & 0 deletions .github/workflows/performance-benchmarks-rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# This workflow runs every day 16:00 UTC (8PM 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:
testRust:
strategy:
fail-fast: false
matrix:
library: [DynamoDbEncryption]
benchmark-dir: [db-esdk-performance-testing]
# removed windows-latest because somehow it can't build aws-lc in CI
os: [ubuntu-22.04, macos-15-intel]
runs-on: ${{ matrix.os }}
permissions:
id-token: write
contents: read
env:
RUST_MIN_STACK: 838860800
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-Dafny-Rust-Tests

- name: Setup Docker
if: matrix.os == 'macos-15-intel' && matrix.library == 'TestVectors'
uses: douglascamata/setup-docker-macos-action@v1.0.2

- name: Support longpaths on Git checkout
run: |
git config --global core.longpaths true
- 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: Setup Rust Toolchain for GitHub CI
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt

- name: Setup Dafny
uses: ./submodules/MaterialProviders/.github/actions/setup_dafny/
with:
dafny-version: 4.10.0

- 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: Setup Java 17 for codegen
uses: actions/setup-java@v5
with:
distribution: "corretto"
java-version: "17"

- name: Install Smithy-Dafny codegen dependencies
uses: ./.github/actions/install_smithy_dafny_codegen_dependencies

- name: Run make polymorph_rust
shell: bash
working-directory: ./${{ matrix.library }}
run: |
make polymorph_rust

- name: Compile ${{ 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_rust TRANSPILE_TESTS_IN_RUST=1 CORES=$CORES

- name: Run Performance Benchmarks - Quick Mode
shell: bash
working-directory: ./${{matrix.benchmark-dir}}/benchmarks/rust
run: |
cargo run --release -- --quick

- name: Parse and Format Logs
working-directory: ./${{matrix.benchmark-dir}}/benchmarks/results/raw-data/
run: |
LOG_FILE="rust_results.json"
UPLOAD_FILE="cloudwatch_logs.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

- name: Upload logs to CloudWatch
working-directory: ./${{matrix.benchmark-dir}}/benchmarks/results/raw-data/
run: |
LOG_FILE="cloudwatch_logs.json"
LOG_GROUP="aws-dbesdk-performance-benchmarks"
LOG_STREAM="rust/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
9 changes: 7 additions & 2 deletions .github/workflows/performance-benchmarks.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This workflow runs every day 09:00 UTC (1AM PST)
# This workflow runs every day 16:00 UTC (8PM PST)
name: Performance Benchmarks

permissions:
Expand All @@ -21,8 +21,13 @@ jobs:
uses: ./.github/workflows/performance-benchmarks-go.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]
needs: [getVersion, performance-benchmarks-go, performance-benchmarks-rust]
if: ${{ failure() }}
uses: aws/aws-cryptographic-material-providers-library/.github/workflows/slack-notification.yml@main
with:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"metadata": {
"language": "rust",
"timestamp": "2026-01-22 21:23:51",
"rust_version": "unknown",
"cpu_count": 14,
"total_memory_gb": 48.0,
"total_tests": 3
},
"results": [
{
"test_name": "throughput",
"language": "rust",
"data_size": 102400,
"concurrency": 1,
"encrypt_latency_ms": 2.0424586666666666,
"decrypt_latency_ms": 1.1346386666666666,
"end_to_end_latency_ms": 3.1774306666666665,
"ops_per_second": 313.69134089559503,
"bytes_per_second": 32121993.307708934,
"peak_memory_mb": 0.0,
"memory_efficiency_ratio": 0.0,
"p50_latency": 3.1489589999999996,
"p95_latency": 3.2460456000000004,
"p99_latency": 3.2546755200000006,
"timestamp": "2026-01-22 21:23:51",
"rust_version": "unknown",
"cpu_count": 14,
"total_memory_gb": 48.0,
"alloc": {
"count_k": 45,
"total_m": 8,
"max_bytes_m": 0,
"net_count": 8,
"net_total": 0
}
},
{
"test_name": "memory",
"language": "rust",
"data_size": 102400,
"concurrency": 1,
"encrypt_latency_ms": 0.0,
"decrypt_latency_ms": 0.0,
"end_to_end_latency_ms": 0.0,
"ops_per_second": 0.0,
"bytes_per_second": 0.0,
"peak_memory_mb": 0.4375,
"memory_efficiency_ratio": 0.22321428571428573,
"p50_latency": 0.0,
"p95_latency": 0.0,
"p99_latency": 0.0,
"timestamp": "2026-01-22 21:23:51",
"rust_version": "unknown",
"cpu_count": 14,
"total_memory_gb": 48.0,
"alloc": {
"count_k": 75,
"total_m": 14,
"max_bytes_m": 0,
"net_count": 6,
"net_total": 0
}
},
{
"test_name": "concurrent",
"language": "rust",
"data_size": 102400,
"concurrency": 2,
"encrypt_latency_ms": 0.0,
"decrypt_latency_ms": 0.0,
"end_to_end_latency_ms": 3.4039084,
"ops_per_second": 575.1588876427113,
"bytes_per_second": 58896270.09461364,
"peak_memory_mb": 0.0,
"memory_efficiency_ratio": 0.0,
"p50_latency": 3.3777085,
"p95_latency": 3.7358293500000004,
"p99_latency": 3.7699994700000006,
"timestamp": "2026-01-22 21:23:51",
"rust_version": "unknown",
"cpu_count": 14,
"total_memory_gb": 48.0,
"alloc": {
"count_k": 150,
"total_m": 29,
"max_bytes_m": 1,
"net_count": 5,
"net_total": 0
}
}
]
}
2 changes: 2 additions & 0 deletions db-esdk-performance-testing/benchmarks/rust/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Cargo.lock
target
61 changes: 61 additions & 0 deletions db-esdk-performance-testing/benchmarks/rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[package]
name = "dbesdk-benchmark"
version = "0.1.0"
edition = "2021"

[[bin]]
name = "dbesdk-benchmark"
path = "src/main.rs"

[dependencies]
# AWS SDK and DynamoDB Encryption SDK
aws-db-esdk = { path = "../../../DynamoDbEncryption/runtimes/rust" }

# Async runtime
tokio = { version = "1.47", features = ["full"] }

# Serialization
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_yaml = "0.9"

# CLI and progress
clap = { version = "4.5", features = ["derive"] }
indicatif = "0.18"

# Statistics and benchmarking
hdrhistogram = "7.5"
rand = "0.9"

# System info
sysinfo = "0.37"

# Error handling
anyhow = "1.0"
thiserror = "2.0"

# Logging
log = "0.4"
env_logger = "0.11"

# Time
chrono = { version = "0.4", features = ["serde"] }

# Memory profiling
memory-stats = "1.2"
stats_alloc = "0.1"

# Async utilities
futures = "0.3"

aws-config = "1.8.6"
aws-sdk-dynamodb = "1.92.0"
aws-sdk-kms = "1.86.0"
aws-sdk-sso = "1.83.0"
aws-sdk-ssooidc = "1.84.0"
aws-sdk-sts = "1.85.0"
aws-smithy-types = "1.3"
cpu-time = "1.0.0"

[dev-dependencies]
criterion = { version = "0.7", features = ["html_reports"] }
71 changes: 71 additions & 0 deletions db-esdk-performance-testing/benchmarks/rust/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# AWS Database Encryption SDK for DynamoDB - Rust Performance Benchmarks

This directory contains comprehensive performance benchmarks for the AWS Database Encryption SDK for DynamoDB Rust implementation. The benchmarks measure throughput, memory usage, and concurrency performance across various data sizes and system configurations.

## Features

- **Throughput Benchmarks**: Measure encryption/decryption operations per second
- **Memory Benchmarks**: Track peak memory usage and efficiency ratios
- **Concurrency Benchmarks**: Test performance under different thread counts
- **Raw AES Keyring**: Local 256-bit AES keys (no KMS dependency)

## Prerequisites

- Rust 1.70+ (recommended: latest stable)
- Access to the AWS Database Encryption SDK for DynamoDB Rust runtime

## Quick Start

```bash
# If necessary, build the ESDK and return here
cd ../../../DynamoDbEncryption/
make polymorph_rust transpile_rust
cd ../db-esdk-performance-testing/benchmarks/rust/

# Build and run
cargo run --release -- --config ../../config/test-scenarios.yaml

# Quick test (requires quick_config in YAML)
cargo run --release -- --quick
```

## Configuration

### Command Line

- `--config`: Path to YAML config file (required)
- `--output`: Results output path (default: `../../results/raw-data/rust_results.json`)
- `--quick`: Quick test mode (requires `quick_config` section in YAML)

## Logging

Default: info level. Override with `RUST_LOG`:

```bash
RUST_LOG=debug ./target/release/db_esdk_benchmark --config config.yaml
```

## Development

```bash
# Format and lint
cargo fmt
cargo clippy -- -D warnings

# Test
cargo test

# Debug build
cargo build
RUST_LOG=debug ./target/debug/esdk_benchmark --config config.yaml
```

## Troubleshooting

- **Build issues**: `rustup update && cargo clean && cargo build --release`
- **Config issues**: Validate YAML syntax and check file permissions
- **Memory issues**: Monitor with `htop` or Activity Monitor

## License

Apache License 2.0
Loading
Loading