|
| 1 | +# DB-ESDK Performance Benchmark - Java |
| 2 | + |
| 3 | +This directory contains the Java implementation of the AWS Database Encryption SDK (DB-ESDK) performance benchmark suite. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The Java benchmark provides comprehensive performance testing for the DB-ESDK Java runtime, measuring: |
| 8 | + |
| 9 | +- **Throughput**: Operations per second and bytes per second using DynamoDB batch operations |
| 10 | +- **Latency**: Put, get, and end-to-end timing for encrypted DynamoDB operations |
| 11 | +- **Memory Usage**: Peak memory consumption and efficiency |
| 12 | +- **Concurrency**: Multi-threaded performance scaling |
| 13 | +- **Statistical Analysis**: P50, P95, P99 latency percentiles |
| 14 | + |
| 15 | +## Prerequisites |
| 16 | + |
| 17 | +- Java 17 or higher |
| 18 | +- Maven 3.6 or higher |
| 19 | +- Local DynamoDB instance running on localhost:8000 |
| 20 | +- Access to AWS Database Encryption SDK for DynamoDB Java libraries |
| 21 | + |
| 22 | +## Local DynamoDB Setup |
| 23 | + |
| 24 | +Start a local DynamoDB instance: |
| 25 | + |
| 26 | +```bash |
| 27 | +# Using Docker |
| 28 | +docker run -p 8000:8000 amazon/dynamodb-local |
| 29 | + |
| 30 | +# Or download and run DynamoDB Local |
| 31 | +java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb -port 8000 |
| 32 | +``` |
| 33 | + |
| 34 | +Create the test table: |
| 35 | + |
| 36 | +```bash |
| 37 | +aws dynamodb create-table \ |
| 38 | + --table-name db-esdk-performance-test \ |
| 39 | + --attribute-definitions \ |
| 40 | + AttributeName=partition_key,AttributeType=S \ |
| 41 | + AttributeName=sort_key,AttributeType=N \ |
| 42 | + --key-schema \ |
| 43 | + AttributeName=partition_key,KeyType=HASH \ |
| 44 | + AttributeName=sort_key,KeyType=RANGE \ |
| 45 | + --billing-mode PAY_PER_REQUEST \ |
| 46 | + --endpoint-url http://localhost:8000 |
| 47 | +``` |
| 48 | + |
| 49 | +## Building |
| 50 | + |
| 51 | +```bash |
| 52 | +# Build the project |
| 53 | +mvn clean compile |
| 54 | + |
| 55 | +# Create executable JAR |
| 56 | +mvn clean package |
| 57 | + |
| 58 | +# Run tests |
| 59 | +mvn test |
| 60 | +``` |
| 61 | + |
| 62 | +## Running Benchmarks |
| 63 | + |
| 64 | +### Quick Test |
| 65 | + |
| 66 | +```bash |
| 67 | +# Using Maven |
| 68 | +mvn exec:java -Dexec.mainClass="com.amazon.esdk.benchmark.Program" -Dexec.args="--quick" |
| 69 | + |
| 70 | +# Using JAR |
| 71 | +java -jar target/esdk-benchmark.jar --quick |
| 72 | +``` |
| 73 | + |
| 74 | +### Full Benchmark Suite |
| 75 | + |
| 76 | +```bash |
| 77 | +# Using Maven |
| 78 | +mvn exec:java -Dexec.mainClass="com.amazon.esdk.benchmark.Program" |
| 79 | + |
| 80 | +# Using JAR |
| 81 | +java -jar target/esdk-benchmark.jar |
| 82 | +``` |
| 83 | + |
| 84 | +### Custom Configuration |
| 85 | + |
| 86 | +```bash |
| 87 | +# Specify custom config and output paths |
| 88 | +java -jar target/esdk-benchmark.jar \ |
| 89 | + --config /path/to/config.yaml \ |
| 90 | + --output /path/to/results.json |
| 91 | +``` |
| 92 | + |
| 93 | +## Command Line Options |
| 94 | + |
| 95 | +- `--config, -c`: Path to test configuration file (default: `../../config/test-scenarios.yaml`) |
| 96 | +- `--output, -o`: Path to output results file (default: `../../results/raw-data/java_results.json`) |
| 97 | +- `--quick, -q`: Run quick test with reduced iterations |
| 98 | +- `--help, -h`: Show help message |
| 99 | + |
| 100 | +## Configuration |
| 101 | + |
| 102 | +The benchmark uses a YAML configuration file to define test parameters: |
| 103 | + |
| 104 | +```yaml |
| 105 | +data_sizes: |
| 106 | + small: [1024, 5120, 10240] |
| 107 | + medium: [102400, 512000, 1048576] |
| 108 | + large: [10485760, 52428800, 104857600] |
| 109 | + |
| 110 | +iterations: |
| 111 | + warmup: 5 |
| 112 | + measurement: 10 |
| 113 | + |
| 114 | +concurrency_levels: [1, 2, 4, 8] |
| 115 | +``` |
| 116 | +
|
| 117 | +## Output Format |
| 118 | +
|
| 119 | +Results are saved in JSON format with the following structure: |
| 120 | +
|
| 121 | +```json |
| 122 | +{ |
| 123 | + "metadata": { |
| 124 | + "language": "java", |
| 125 | + "timestamp": "2025-09-05T15:30:00Z", |
| 126 | + "javaVersion": "17.0.2", |
| 127 | + "cpuCount": 8, |
| 128 | + "totalMemoryGB": 16.0, |
| 129 | + "totalTests": 45 |
| 130 | + }, |
| 131 | + "results": [ |
| 132 | + { |
| 133 | + "test_name": "throughput", |
| 134 | + "language": "java", |
| 135 | + "data_size": 1024, |
| 136 | + "concurrency": 1, |
| 137 | + "put_latency_ms": 0.85, |
| 138 | + "get_latency_ms": 0.72, |
| 139 | + "end_to_end_latency_ms": 1.57, |
| 140 | + "ops_per_second": 636.94, |
| 141 | + "bytes_per_second": 652224.0, |
| 142 | + "peak_memory_mb": 0.0, |
| 143 | + "memory_efficiency_ratio": 0.0, |
| 144 | + "p50_latency": 1.55, |
| 145 | + "p95_latency": 1.89, |
| 146 | + "p99_latency": 2.12, |
| 147 | + "timestamp": "2025-09-05T15:30:15Z", |
| 148 | + "java_version": "17.0.2", |
| 149 | + "cpu_count": 8, |
| 150 | + "total_memory_gb": 16.0 |
| 151 | + } |
| 152 | + ] |
| 153 | +} |
| 154 | +``` |
| 155 | + |
| 156 | +## Key Features |
| 157 | + |
| 158 | +### DB-ESDK Integration |
| 159 | +- Uses AWS Database Encryption SDK for DynamoDB with transparent encryption |
| 160 | +- Configures attribute actions (ENCRYPT_AND_SIGN, SIGN_ONLY, DO_NOTHING) |
| 161 | +- Tests actual DynamoDB operations with client-side encryption |
| 162 | +- Uses Raw AES keyring for consistent performance testing |
| 163 | + |
| 164 | +### Batch Operations |
| 165 | +- Performs BatchWriteItem operations with 25 items per batch |
| 166 | +- Measures BatchGetItem operations with consistent reads |
| 167 | +- Tests realistic DynamoDB workloads with encryption overhead |
| 168 | + |
| 169 | +### Performance Metrics |
| 170 | +- **Throughput Tests**: Measures ops/sec and bytes/sec for batch operations |
| 171 | +- **Memory Tests**: Tracks peak memory usage during encrypted operations |
| 172 | +- **Concurrency Tests**: Evaluates multi-threaded performance scaling |
| 173 | +- **Latency Analysis**: P50, P95, P99 percentiles for operation timing |
| 174 | + |
| 175 | +## Dependencies |
| 176 | + |
| 177 | +Key dependencies used in this benchmark: |
| 178 | + |
| 179 | +- **AWS Database Encryption SDK for DynamoDB**: Core encryption functionality for DynamoDB |
| 180 | +- **AWS Cryptographic Material Providers**: Keyring and cryptographic material management |
| 181 | +- **AWS SDK for Java v2 DynamoDB**: DynamoDB client operations |
| 182 | +- **Jackson**: JSON/YAML processing |
| 183 | +- **Commons CLI**: Command line argument parsing |
| 184 | +- **ProgressBar**: Visual progress indication |
| 185 | +- **SLF4J**: Logging framework |
| 186 | +- **JUnit**: Unit testing (test scope) |
| 187 | + |
| 188 | +## License |
| 189 | + |
| 190 | +This benchmark suite is part of the AWS Encryption SDK project and follows the same licensing terms. |
0 commit comments