xref: /aosp_15_r20/external/aws-sdk-java-v2/test/s3-benchmarks/.scripts/benchmark-copy (revision 8a52c7834d808308836a99fc2a6e0ed8db339086)
1#!/bin/bash
2
3#
4# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
5#
6# Licensed under the Apache License, Version 2.0 (the "License").
7# You may not use this file except in compliance with the License.
8# A copy of the License is located at
9#
10#  http://aws.amazon.com/apache2.0
11#
12# or in the "license" file accompanying this file. This file is distributed
13# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14# express or implied. See the License for the specific language governing
15# permissions and limitations under the License.
16#
17
18# Script for running multiple Transfer manager benchmarks at the same time
19
20usage() {
21  echo "usage:"
22  echo "    benchmark-copy [<size>]"
23  echo "example: "
24  echo "    benchmark-copy"
25  echo "    benchmark-copy 4GB"
26}
27
28sizes_str="1B 8MB-1 8MB+1 128MB 4GB 30GB 90GB"
29versions_str="v1 v2"
30sizes=( $sizes_str )
31versions=( $versions_str )
32
33echo "===== TM PERF TEST SUITE - COPY ====="
34
35run_benchmark() {
36  echo "Benchmark: $version - $size"
37  result_file=copy_"$version"_"$size".txt
38  cmd="java -jar ../target/s3-benchmarks.jar \
39            --readBufferInMB=3072 \
40            --bucket=do-not-delete-crt-s3-eu-west-1 \
41            --partSizeInMB=8 \
42            --maxThroughput=100.0 \
43            --iteration=8 \
44            --version=$version \
45            --operation=copy \
46            --key=$size"
47
48  echo "$cmd" | sed 's/ \{1,\}/ /g' > "result/$result_file"
49  $cmd | tee -a "result/$result_file"
50  echo "Benchmark done"
51}
52
53for (( i = 0; i < "${#versions[@]}"; i++ ))
54do
55  version="${versions[$i]}"
56  if [ ! -z "$1" ]
57  then
58    size="$1"
59    run_benchmark
60  else
61    for (( j = 0; j < "${#sizes[@]}"; j++ ))
62    do
63      size="${sizes[$j]}"
64      run_benchmark
65    done
66  fi
67done
68