Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
76aac2c
auto commit
rishav-karanjit Sep 4, 2025
3746e6d
auto commit
rishav-karanjit Sep 4, 2025
16fa9e5
remove put get and add batch put get
rishav-karanjit Sep 4, 2025
f52afbe
auto commit
rishav-karanjit Sep 4, 2025
bb8af55
auto commit
rishav-karanjit Sep 4, 2025
effac2d
auto commit
rishav-karanjit Sep 4, 2025
6450326
auto commit
rishav-karanjit Sep 4, 2025
19f4ea9
auto commit
rishav-karanjit Sep 4, 2025
f386ffc
benchmark
rishav-karanjit Sep 4, 2025
7d125d4
auto commit
rishav-karanjit Sep 4, 2025
cfaa562
auto commit
rishav-karanjit Sep 4, 2025
fb190f5
auto commit
rishav-karanjit Sep 4, 2025
818dfd2
auto commit
rishav-karanjit Sep 4, 2025
238c7b1
auto commit
rishav-karanjit Sep 4, 2025
cb738d7
auto commit
rishav-karanjit Sep 4, 2025
9b4c97a
auto commit
rishav-karanjit Sep 5, 2025
ee4a49d
Merge branch 'main' into benchmark
rishav-karanjit Sep 5, 2025
13e48e6
Calculate Item Size
rishav-karanjit Sep 5, 2025
5ee4e1d
Merge branch 'benchmark' of https://github.com/aws/aws-database-encry…
rishav-karanjit Sep 5, 2025
98959a8
Revert "Calculate Item Size"
rishav-karanjit Sep 5, 2025
99ff591
benchmark
rishav-karanjit Sep 5, 2025
d57edd4
auto commit
rishav-karanjit Sep 5, 2025
52ae369
Item encryptor
rishav-karanjit Sep 6, 2025
c49ffe2
auto commit
rishav-karanjit Sep 6, 2025
f4aaf5e
auto commit
rishav-karanjit Sep 6, 2025
8f802c2
auto commit
rishav-karanjit Sep 6, 2025
aee7ec1
auto commit
rishav-karanjit Sep 8, 2025
e1c7470
comment not needed code
rishav-karanjit Sep 8, 2025
2914132
auto commit
rishav-karanjit Sep 8, 2025
b4bad37
remove redundant files
rishav-karanjit Sep 8, 2025
7ae7bf8
remove batch put and get
rishav-karanjit Sep 8, 2025
b3fb2fc
auto commit
rishav-karanjit Sep 8, 2025
bc43a5e
auto commit
rishav-karanjit Sep 8, 2025
de628a9
auto commit
rishav-karanjit Sep 9, 2025
aa05cd3
auto commit
rishav-karanjit Sep 9, 2025
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# DB-ESDK Performance Test Scenarios Configuration

# Data sizes to test (in bytes)
# Categories are for organization only - code processes all sizes regardless of category
data_sizes:
small:
- 1024 # 1KB
- 5120 # 5KB
- 10240 # 10KB
medium:
- 102400 # 100KB
- 512000 # 500KB
- 1048576 # 1MB
- 10000000
large:
- 10485760 # 10MB
- 52428800 # 50MB
- 104857600
- 100000000 # 100MB

# Quick test configuration (reduced test set for faster execution)
quick_config:
data_sizes:
small:
- 102400 # 100KB - within DynamoDB's 400KB limit
iterations:
warmup: 3 # Reduced warmup iterations
measurement: 3 # Reduced measurement iterations
concurrency_levels:
- 1
- 2
test_types:
- "throughput"
- "memory"
- "concurrency"

# Test iterations for statistical significance
iterations:
warmup: 5 # Warmup iterations (not counted)
measurement: 10 # Measurement iterations

# Concurrency levels to test
concurrency_levels:
# - 1
# - 2
# - 4
# - 8
# - 16

# DynamoDB table name
table_name: "dbesdk-performance-testing"

# Keyring
keyring: "raw-aes"
45 changes: 45 additions & 0 deletions db-esdk-performance-testing/benchmarks/go/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# ESDK Go Benchmark

Performance benchmark suite for the AWS Encryption SDK (ESDK) Go implementation.

## Quick Start

```bash
# Run quick benchmark
go run . --config ../../config/test-scenarios.yaml --quick

# Run full benchmark
go run . --config ../../config/test-scenarios.yaml
```

## Build

```bash
# Build release binary
go build -o esdk-benchmark .

# Run built binary
./esdk-benchmark --quick
```

## Configuration

The benchmark uses YAML configuration files. See `../../config/test-scenarios.yaml` for the full configuration format.

### Quick Mode

Quick mode runs a subset of tests with reduced iterations:

- Only runs test types specified in `quick_config.test_types`
- Uses smaller data sizes from `quick_config.data_sizes.small`
- Fewer iterations: `quick_config.iterations.measurement`

## Test Types

- **throughput**: Measures operations per second and latency
- **memory**: Measures peak memory usage during operations
- **concurrency**: Tests performance under concurrent load

## Output

Results are saved to JSON format in `../../results/raw-data/go_results.json` by default.
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

package benchmark

import (
"context"
"fmt"
"reflect"
"runtime/metrics"
"time"

dbesdkitemencryptortypes "github.com/aws/aws-database-encryption-sdk-dynamodb/releases/go/dynamodb-esdk/awscryptographydbencryptionsdkdynamodbitemencryptorsmithygeneratedtypes"
"github.com/aws/aws-sdk-go-v2/service/dynamodb/types"
)

// === Helper Functions ===

// runItemEncryptorCycle performs a item encryptor encrypt and decrypt cycle with 25 items and measures performance
func (b *DBESDKBenchmark) runItemEncryptorCycle(data []byte) (float64, float64, error) {
item := map[string]types.AttributeValue{
"partition_key": &types.AttributeValueMemberS{Value: "benchmark-test"},
"sort_key": &types.AttributeValueMemberN{Value: "0"},
"attribute1": &types.AttributeValueMemberM{Value: map[string]types.AttributeValue{
"data": &types.AttributeValueMemberB{Value: data},
}},
"attribute2": &types.AttributeValueMemberS{Value: "sign me!"},
":attribute3": &types.AttributeValueMemberS{Value: "ignore me!"},
}

encryptItemInput := &dbesdkitemencryptortypes.EncryptItemInput{
PlaintextItem: item,
}

encryptItemStart := time.Now()
encryptItemOutput, err := b.ItemEncryptorClient.EncryptItem(context.Background(), *encryptItemInput)
if err != nil {
return 0, 0, fmt.Errorf("EncryptItem failed: %w", err)
}
encryptItemDuration := time.Since(encryptItemStart).Seconds() * 1000
// Demonstrate that the item has been encrypted
encryptedItem := encryptItemOutput.EncryptedItem

// Directly decrypt the encrypted item using the DynamoDb Item Encryptor
decryptItemInput := &dbesdkitemencryptortypes.DecryptItemInput{
EncryptedItem: encryptedItem,
}
decryptItemStart := time.Now()
decryptedItem, err := b.ItemEncryptorClient.DecryptItem(context.Background(), *decryptItemInput)
if err != nil {
return 0, 0, fmt.Errorf("EncryptItem failed: %w", err)
}
decryptItemDuration := time.Since(decryptItemStart).Seconds() * 1000

if !reflect.DeepEqual(item, decryptedItem.PlaintextItem) {
panic("Decrypted item does not match original item")
}
return encryptItemDuration, decryptItemDuration, nil
}

// shouldRunTestType checks if a test type should be run based on quick config
func (b *DBESDKBenchmark) shouldRunTestType(testType string) bool {
if b.Config.QuickConfig == nil || len(b.Config.QuickConfig.TestTypes) == 0 {
return true
}

for _, allowedType := range b.Config.QuickConfig.TestTypes {
if allowedType == testType {
return true
}
}
return false
}

// === Memory Test Implementation ===

// sampleMemoryContinuously runs continuous memory sampling during operation
func (b *DBESDKBenchmark) sampleMemoryContinuously(beforeHeap, beforeAllocs uint64, stopChan chan bool) []MemorySample {
var samples []MemorySample
ticker := time.NewTicker(SamplingIntervalMs * time.Millisecond)
defer ticker.Stop()

for {
select {
case <-stopChan:
return samples
case <-ticker.C:
var currentSamples [2]metrics.Sample
currentSamples[0].Name = "/memory/classes/heap/objects:bytes"
currentSamples[1].Name = "/gc/heap/allocs:bytes"
metrics.Read(currentSamples[:])

var heapDelta, allocsDelta uint64
if currentSamples[0].Value.Uint64() > beforeHeap {
heapDelta = currentSamples[0].Value.Uint64() - beforeHeap
}
if currentSamples[1].Value.Uint64() > beforeAllocs {
allocsDelta = currentSamples[1].Value.Uint64() - beforeAllocs
}

sample := MemorySample{
Timestamp: time.Now(),
HeapMB: float64(heapDelta) / (1024 * 1024),
MetricsAllocsMB: float64(allocsDelta) / (1024 * 1024),
MemStatsAllocsMB: 0,
}
samples = append(samples, sample)
}
}
}
67 changes: 67 additions & 0 deletions db-esdk-performance-testing/benchmarks/go/benchmark/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

package benchmark

import (
"fmt"
"os"

"gopkg.in/yaml.v3"
)

type KeyringType string

const (
RawAESKeying KeyringType = "raw-aes"
)

// TestConfig represents the configuration for benchmark tests
type TestConfig struct {
DataSizes struct {
Small []int `yaml:"small"`
Medium []int `yaml:"medium"`
Large []int `yaml:"large"`
} `yaml:"data_sizes"`
Iterations struct {
Warmup int `yaml:"warmup"`
Measurement int `yaml:"measurement"`
} `yaml:"iterations"`
ConcurrencyLevels []int `yaml:"concurrency_levels"`
QuickConfig *QuickConfig `yaml:"quick_config"`
TableName string `yaml:"table_name"`
Keyring KeyringType `yaml:"keyring"`
}

// QuickConfig represents the quick test configuration
type QuickConfig struct {
DataSizes struct {
Small []int `yaml:"small"`
} `yaml:"data_sizes"`
Iterations struct {
Warmup int `yaml:"warmup"`
Measurement int `yaml:"measurement"`
} `yaml:"iterations"`
ConcurrencyLevels []int `yaml:"concurrency_levels"`
TestTypes []string `yaml:"test_types"`
}

// LoadConfig loads the test configuration from YAML file
func LoadConfig(configPath string) (TestConfig, error) {
var config TestConfig

if _, err := os.Stat(configPath); os.IsNotExist(err) {
return config, fmt.Errorf("config file not found: %s", configPath)
}

data, err := os.ReadFile(configPath)
if err != nil {
return config, fmt.Errorf("failed to read config file: %w", err)
}

if err := yaml.Unmarshal(data, &config); err != nil {
return config, fmt.Errorf("failed to parse config file: %w", err)
}

return config, nil
}
Loading
Loading