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