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 download|upload fs|tmpfs|no-op [<size>]" 23*8a52c783SCole Faust echo "example:" 24*8a52c783SCole Faust echo " ./benchmark download fs" 25*8a52c783SCole Faust echo " ./benchmark upload tmpfs" 26*8a52c783SCole Faust echo " ./benchmark download fs 90GB" 27*8a52c783SCole Faust} 28*8a52c783SCole Faust 29*8a52c783SCole Faust# validate operation 30*8a52c783SCole Faustif [[ -z "$1" ]]; then 31*8a52c783SCole Faust usage 32*8a52c783SCole Faust exit 1 33*8a52c783SCole Faustfi 34*8a52c783SCole Faust 35*8a52c783SCole Faustoperation="$1" 36*8a52c783SCole Faust 37*8a52c783SCole Faustif ([ "$operation" != download ] && [ "$operation" != upload ] && [ "$operation" != copy ]); then 38*8a52c783SCole Faust usage 39*8a52c783SCole Faust exit 1 40*8a52c783SCole Faustfi 41*8a52c783SCole Faust 42*8a52c783SCole Faust#validate location 43*8a52c783SCole Faustif [[ -z "$2" ]]; then 44*8a52c783SCole Faust usage 45*8a52c783SCole Faust exit 1 46*8a52c783SCole Faustfi 47*8a52c783SCole Faust 48*8a52c783SCole Faustlocation_name="$2" 49*8a52c783SCole Faustif ([ "$location_name" != fs ] && [ "$location_name" != tmpfs ] && [ "$location_name" != "no-op" ]); then 50*8a52c783SCole Faust usage 51*8a52c783SCole Faust exit 1 52*8a52c783SCole Faustfi 53*8a52c783SCole Faust 54*8a52c783SCole Faustif [ "$location_name" == fs ]; then 55*8a52c783SCole Faust location="/" 56*8a52c783SCole Faustfi 57*8a52c783SCole Faust 58*8a52c783SCole Faustif [ "$location_name" == tmpfs ]; then 59*8a52c783SCole Faust location="/dev/shm/" 60*8a52c783SCole Faustfi 61*8a52c783SCole Faust 62*8a52c783SCole Faustif [ ! -d result ]; then 63*8a52c783SCole Faust mkdir result 64*8a52c783SCole Faustfi 65*8a52c783SCole Faust 66*8a52c783SCole Faustsizes_str="1B 8MB+1 8MB-1 128MB 4GB 30GB" 67*8a52c783SCole Faustversions_str="v1 v2 CRT java" 68*8a52c783SCole Faustsizes=( $sizes_str ) 69*8a52c783SCole Faustversions=( $versions_str ) 70*8a52c783SCole Faust 71*8a52c783SCole Faustecho "===== TM PERF TEST SUITE - $operation - $location_name =====" 72*8a52c783SCole Faust 73*8a52c783SCole Faustrun_benchmark() { 74*8a52c783SCole Faust echo "Benchmark: $version - $size" 75*8a52c783SCole Faust result_file="$operation"_"$location_name"_"$version"_"$size".txt 76*8a52c783SCole Faust cmd="java -jar ../target/s3-benchmarks.jar \ 77*8a52c783SCole Faust --key=$size \ 78*8a52c783SCole Faust --operation=$operation \ 79*8a52c783SCole Faust --bucket=do-not-delete-crt-s3-eu-west-1 \ 80*8a52c783SCole Faust --partSizeInMB=8 \ 81*8a52c783SCole Faust --maxThroughput=100.0 \ 82*8a52c783SCole Faust --iteration=8 \ 83*8a52c783SCole Faust --version=$version \ 84*8a52c783SCole Faust --readBufferInMB=3072" 85*8a52c783SCole Faust if [[ -n $location ]] 86*8a52c783SCole Faust then 87*8a52c783SCole Faust cmd="$cmd --file=$location$size" 88*8a52c783SCole Faust fi 89*8a52c783SCole Faust 90*8a52c783SCole Faust echo "$cmd" | sed 's/ \{1,\}/ /g' > "result/$result_file" 91*8a52c783SCole Faust $cmd | tee -a "result/$result_file" 92*8a52c783SCole Faust echo "Benchmark done" 93*8a52c783SCole Faust} 94*8a52c783SCole Faust 95*8a52c783SCole Faustfor (( i = 0; i < "${#versions[@]}"; i++ )) 96*8a52c783SCole Faustdo 97*8a52c783SCole Faust version="${versions[$i]}" 98*8a52c783SCole Faust if [ ! -z "$3" ] 99*8a52c783SCole Faust then 100*8a52c783SCole Faust size="$3" 101*8a52c783SCole Faust run_benchmark 102*8a52c783SCole Faust else 103*8a52c783SCole Faust for (( j = 0; j < "${#sizes[@]}"; j++ )) 104*8a52c783SCole Faust do 105*8a52c783SCole Faust size="${sizes[$j]}" 106*8a52c783SCole Faust run_benchmark 107*8a52c783SCole Faust done 108*8a52c783SCole Faust fi 109*8a52c783SCole Faustdone 110