blob: 5eaa2182d0359d6b7e9c0eb3ceffd3a05f5d245b [file] [log] [blame] [edit]
#!/bin/bash
#
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://aws.amazon.com/apache2.0
#
# or in the "license" file accompanying this file. This file is distributed
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
# express or implied. See the License for the specific language governing
# permissions and limitations under the License.
#
# Script for running multiple Transfer manager benchmarks at the same time
usage() {
echo "usage:"
echo " benchmark download|upload fs|tmpfs|no-op [<size>]"
echo "example:"
echo " ./benchmark download fs"
echo " ./benchmark upload tmpfs"
echo " ./benchmark download fs 90GB"
}
# validate operation
if [[ -z "$1" ]]; then
usage
exit 1
fi
operation="$1"
if ([ "$operation" != download ] && [ "$operation" != upload ] && [ "$operation" != copy ]); then
usage
exit 1
fi
#validate location
if [[ -z "$2" ]]; then
usage
exit 1
fi
location_name="$2"
if ([ "$location_name" != fs ] && [ "$location_name" != tmpfs ] && [ "$location_name" != "no-op" ]); then
usage
exit 1
fi
if [ "$location_name" == fs ]; then
location="/"
fi
if [ "$location_name" == tmpfs ]; then
location="/dev/shm/"
fi
if [ ! -d result ]; then
mkdir result
fi
sizes_str="1B 8MB+1 8MB-1 128MB 4GB 30GB"
versions_str="v1 v2 CRT java"
sizes=( $sizes_str )
versions=( $versions_str )
echo "===== TM PERF TEST SUITE - $operation - $location_name ====="
run_benchmark() {
echo "Benchmark: $version - $size"
result_file="$operation"_"$location_name"_"$version"_"$size".txt
cmd="java -jar ../target/s3-benchmarks.jar \
--key=$size \
--operation=$operation \
--bucket=do-not-delete-crt-s3-eu-west-1 \
--partSizeInMB=8 \
--maxThroughput=100.0 \
--iteration=8 \
--version=$version \
--readBufferInMB=3072"
if [[ -n $location ]]
then
cmd="$cmd --file=$location$size"
fi
echo "$cmd" | sed 's/ \{1,\}/ /g' > "result/$result_file"
$cmd | tee -a "result/$result_file"
echo "Benchmark done"
}
for (( i = 0; i < "${#versions[@]}"; i++ ))
do
version="${versions[$i]}"
if [ ! -z "$3" ]
then
size="$3"
run_benchmark
else
for (( j = 0; j < "${#sizes[@]}"; j++ ))
do
size="${sizes[$j]}"
run_benchmark
done
fi
done