Skip to content

Commit b7969af

Browse files
committed
integrate performance tests into the build, update docs, and add scripts to run tests
1 parent cf8a4c2 commit b7969af

File tree

5 files changed

+107
-1
lines changed

5 files changed

+107
-1
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ if (LEGACY_BUILD)
6161
option(ENABLE_ZLIB_REQUEST_COMPRESSION "For services that support it, request content will be compressed. On by default if dependency available" ON)
6262
option(DISABLE_INTERNAL_IMDSV1_CALLS "Disables IMDSv1 internal client calls" OFF)
6363
option(BUILD_BENCHMARKS "Enables building the benchmark executable" OFF)
64+
option(BUILD_PERFORMANCE_TESTS "Enables building the performance test executables" OFF)
6465
option(BUILD_OPTEL "Enables building the open telemetry implementation of tracing" OFF)
6566
option(AWS_SDK_WARNINGS_ARE_ERRORS "Compiler warning is treated as an error. Try turning this off when observing errors on a new or uncommon compiler" ON)
6667
option(BUILD_OPTEL_OTLP_BENCHMARKS "Enables building the benchmark tests with open telemetry OTLP clients" OFF)
@@ -341,6 +342,11 @@ if (LEGACY_BUILD)
341342
add_sdks()
342343
include(tests)
343344

345+
# Performance tests for services
346+
if (BUILD_PERFORMANCE_TESTS)
347+
add_subdirectory(tests/performance-tests)
348+
endif()
349+
344350
# for user friendly cmake usage
345351
include(setup_cmake_find_module)
346352

docs/CMake_Parameters.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ You can also tell gcc or clang to pass these linker flags by specifying `-Wl,--g
128128
### BUILD_BENCHMARKS
129129
(Defaults to OFF) Enables building the benchmark executable
130130

131+
### BUILD_PERFORMANCE_TESTS
132+
(Defaults to OFF) Enables building the performance test executables for S3 and DynamoDB. These tests measure operation latencies and output results to JSON files. Requires S3 and DynamoDB clients to be built.
133+
131134
### BUILD_OPTEL
132135
(Defaults to OFF) Enables building the open telemetry implementation of tracing
133136

tools/scripts/build-tests/build-al2-debug-default.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ PREFIX_DIR="$1"
1818
mkdir "${PREFIX_DIR}/al2-build"
1919
mkdir "${PREFIX_DIR}/al2-install"
2020
cd "${PREFIX_DIR}/al2-build"
21-
cmake -GNinja ../aws-sdk-cpp -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-ggdb -fsanitize=address" -DMINIMIZE_SIZE=ON -DCMAKE_INSTALL_PREFIX="${PREFIX_DIR}/al2-install"
21+
cmake -GNinja ../aws-sdk-cpp -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-ggdb -fsanitize=address" -DMINIMIZE_SIZE=ON -DCMAKE_INSTALL_PREFIX="${PREFIX_DIR}/al2-install" -DBUILD_PERFORMANCE_TESTS=ON
2222
ninja-build -j $(grep -c ^processor /proc/cpuinfo)
2323
ninja-build install
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
# SPDX-License-Identifier: Apache-2.0.
4+
5+
# This script runs the pre-built DynamoDB performance test executable
6+
# Expects SDK build directory at ${PREFIX_DIR}/al2-build, source project at ${PREFIX_DIR}/aws-sdk-cpp,
7+
# and SDK installation directory at ${PREFIX_DIR}/al2-install
8+
# Platform: Amazon Linux 2
9+
10+
set -e
11+
12+
DEFAULT_REGION="us-east-1"
13+
DEFAULT_ITERATIONS=10
14+
15+
if [ "$#" -lt 1 ]; then
16+
echo "Error: Missing required argument. Usage: ${0} PREFIX_DIR [-r|--region REGION] [-i|--iterations NUM]"
17+
exit 1
18+
fi
19+
20+
PREFIX_DIR="$1"
21+
shift
22+
23+
REGION="$DEFAULT_REGION"
24+
ITERATIONS="$DEFAULT_ITERATIONS"
25+
26+
while [[ "$#" -gt 0 ]]; do
27+
case "$1" in
28+
-r|--region) REGION="$2"; shift 2 ;;
29+
-i|--iterations) ITERATIONS="$2"; shift 2 ;;
30+
*) echo "Unknown parameter: $1"; exit 1 ;;
31+
esac
32+
done
33+
34+
SDK_REPO_PATH="${PREFIX_DIR}/aws-sdk-cpp"
35+
if [ -d "$SDK_REPO_PATH" ]; then
36+
COMMIT_ID=$(cd "$SDK_REPO_PATH" && git rev-parse HEAD)
37+
else
38+
echo "Error: Git repository not found at $SDK_REPO_PATH"
39+
exit 1
40+
fi
41+
42+
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${PREFIX_DIR}/al2-install/lib64/"
43+
44+
cd "${PREFIX_DIR}/al2-build"
45+
if [ -f "${PREFIX_DIR}/aws-sdk-cpp/tools/scripts/suppressions.txt" ]; then export LSAN_OPTIONS=suppressions="${PREFIX_DIR}/aws-sdk-cpp/tools/scripts/suppressions.txt"; fi
46+
./tests/performance-tests/dynamodb-performance-test --region "$REGION" --iterations "$ITERATIONS" --commit-id "$COMMIT_ID"
47+
cat dynamodb-performance-test-results.json
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
# SPDX-License-Identifier: Apache-2.0.
4+
5+
# This script runs the pre-built S3 performance test executable
6+
# Expects SDK build directory at ${PREFIX_DIR}/al2-build, source project at ${PREFIX_DIR}/aws-sdk-cpp,
7+
# and SDK installation directory at ${PREFIX_DIR}/al2-install
8+
# Platform: Amazon Linux 2
9+
10+
set -e
11+
12+
DEFAULT_REGION="us-east-1"
13+
DEFAULT_AZ_ID="use1-az4"
14+
DEFAULT_ITERATIONS=10
15+
16+
if [ "$#" -lt 1 ]; then
17+
echo "Error: Missing required argument. Usage: ${0} PREFIX_DIR [-r|--region REGION] [-a|--az-id AZ_ID] [-i|--iterations NUM]"
18+
exit 1
19+
fi
20+
21+
PREFIX_DIR="$1"
22+
shift
23+
24+
REGION="$DEFAULT_REGION"
25+
AZ_ID="$DEFAULT_AZ_ID"
26+
ITERATIONS="$DEFAULT_ITERATIONS"
27+
28+
while [[ "$#" -gt 0 ]]; do
29+
case "$1" in
30+
-r|--region) REGION="$2"; shift 2 ;;
31+
-a|--az-id) AZ_ID="$2"; shift 2 ;;
32+
-i|--iterations) ITERATIONS="$2"; shift 2 ;;
33+
*) echo "Unknown parameter: $1"; exit 1 ;;
34+
esac
35+
done
36+
37+
SDK_REPO_PATH="${PREFIX_DIR}/aws-sdk-cpp"
38+
if [ -d "$SDK_REPO_PATH" ]; then
39+
COMMIT_ID=$(cd "$SDK_REPO_PATH" && git rev-parse HEAD)
40+
else
41+
echo "Error: Git repository not found at $SDK_REPO_PATH"
42+
exit 1
43+
fi
44+
45+
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${PREFIX_DIR}/al2-install/lib64/"
46+
47+
cd "${PREFIX_DIR}/al2-build"
48+
if [ -f "${PREFIX_DIR}/aws-sdk-cpp/tools/scripts/suppressions.txt" ]; then export LSAN_OPTIONS=suppressions="${PREFIX_DIR}/aws-sdk-cpp/tools/scripts/suppressions.txt"; fi
49+
./tests/performance-tests/s3-performance-test --region "$REGION" --az-id "$AZ_ID" --iterations "$ITERATIONS" --commit-id "$COMMIT_ID"
50+
cat s3-performance-test-results.json

0 commit comments

Comments
 (0)