Skip to content

Integrate performance tests into the build, update docs, and add scripts to run tests #3480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 17, 2025
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
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ if (LEGACY_BUILD)
option(ENABLE_ZLIB_REQUEST_COMPRESSION "For services that support it, request content will be compressed. On by default if dependency available" ON)
option(DISABLE_INTERNAL_IMDSV1_CALLS "Disables IMDSv1 internal client calls" OFF)
option(BUILD_BENCHMARKS "Enables building the benchmark executable" OFF)
option(BUILD_PERFORMANCE_TESTS "Enables building the performance test executables" OFF)
option(BUILD_OPTEL "Enables building the open telemetry implementation of tracing" OFF)
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)
option(BUILD_OPTEL_OTLP_BENCHMARKS "Enables building the benchmark tests with open telemetry OTLP clients" OFF)
Expand Down Expand Up @@ -341,6 +342,11 @@ if (LEGACY_BUILD)
add_sdks()
include(tests)

# Performance tests for services
if (BUILD_PERFORMANCE_TESTS)
add_subdirectory(tests/performance-tests)
endif()

# for user friendly cmake usage
include(setup_cmake_find_module)

Expand Down
3 changes: 3 additions & 0 deletions docs/CMake_Parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ You can also tell gcc or clang to pass these linker flags by specifying `-Wl,--g
### BUILD_BENCHMARKS
(Defaults to OFF) Enables building the benchmark executable

### BUILD_PERFORMANCE_TESTS
(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.

### BUILD_OPTEL
(Defaults to OFF) Enables building the open telemetry implementation of tracing

Expand Down
2 changes: 1 addition & 1 deletion tools/scripts/build-tests/build-al2-debug-default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ PREFIX_DIR="$1"
mkdir "${PREFIX_DIR}/al2-build"
mkdir "${PREFIX_DIR}/al2-install"
cd "${PREFIX_DIR}/al2-build"
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"
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
ninja-build -j $(grep -c ^processor /proc/cpuinfo)
ninja-build install
47 changes: 47 additions & 0 deletions tools/scripts/build-tests/run-al2-dynamodb-performance-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0.

# This script runs the pre-built DynamoDB performance test executable
# Expects SDK build directory at ${PREFIX_DIR}/al2-build, source project at ${PREFIX_DIR}/aws-sdk-cpp,
# and SDK installation directory at ${PREFIX_DIR}/al2-install
# Platform: Amazon Linux 2

set -e

DEFAULT_REGION="us-east-1"
DEFAULT_ITERATIONS=10

if [ "$#" -lt 1 ]; then
echo "Error: Missing required argument. Usage: ${0} PREFIX_DIR [-r|--region REGION] [-i|--iterations NUM]"
exit 1
fi

PREFIX_DIR="$1"
shift

REGION="$DEFAULT_REGION"
ITERATIONS="$DEFAULT_ITERATIONS"

while [[ "$#" -gt 0 ]]; do
case "$1" in
-r|--region) REGION="$2"; shift 2 ;;
-i|--iterations) ITERATIONS="$2"; shift 2 ;;
*) echo "Unknown parameter: $1"; exit 1 ;;
esac
done

SDK_REPO_PATH="${PREFIX_DIR}/aws-sdk-cpp"
if [ -d "$SDK_REPO_PATH" ]; then
COMMIT_ID=$(cd "$SDK_REPO_PATH" && git rev-parse HEAD)
else
echo "Error: Git repository not found at $SDK_REPO_PATH"
exit 1
fi

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${PREFIX_DIR}/al2-install/lib64/"

cd "${PREFIX_DIR}/al2-build"
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
./tests/performance-tests/dynamodb-performance-test --region "$REGION" --iterations "$ITERATIONS" --commit-id "$COMMIT_ID"
cat dynamodb-performance-test-results.json
50 changes: 50 additions & 0 deletions tools/scripts/build-tests/run-al2-s3-performance-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0.

# This script runs the pre-built S3 performance test executable
# Expects SDK build directory at ${PREFIX_DIR}/al2-build, source project at ${PREFIX_DIR}/aws-sdk-cpp,
# and SDK installation directory at ${PREFIX_DIR}/al2-install
# Platform: Amazon Linux 2

set -e

DEFAULT_REGION="us-east-1"
DEFAULT_AZ_ID="use1-az4"
DEFAULT_ITERATIONS=10

if [ "$#" -lt 1 ]; then
echo "Error: Missing required argument. Usage: ${0} PREFIX_DIR [-r|--region REGION] [-a|--az-id AZ_ID] [-i|--iterations NUM]"
exit 1
fi

PREFIX_DIR="$1"
shift

REGION="$DEFAULT_REGION"
AZ_ID="$DEFAULT_AZ_ID"
ITERATIONS="$DEFAULT_ITERATIONS"

while [[ "$#" -gt 0 ]]; do
case "$1" in
-r|--region) REGION="$2"; shift 2 ;;
-a|--az-id) AZ_ID="$2"; shift 2 ;;
-i|--iterations) ITERATIONS="$2"; shift 2 ;;
*) echo "Unknown parameter: $1"; exit 1 ;;
esac
done

SDK_REPO_PATH="${PREFIX_DIR}/aws-sdk-cpp"
if [ -d "$SDK_REPO_PATH" ]; then
COMMIT_ID=$(cd "$SDK_REPO_PATH" && git rev-parse HEAD)
else
echo "Error: Git repository not found at $SDK_REPO_PATH"
exit 1
fi

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${PREFIX_DIR}/al2-install/lib64/"

cd "${PREFIX_DIR}/al2-build"
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
./tests/performance-tests/s3-performance-test --region "$REGION" --az-id "$AZ_ID" --iterations "$ITERATIONS" --commit-id "$COMMIT_ID"
cat s3-performance-test-results.json