Skip to content

Instantly share code, notes, and snippets.

@mdcallag
Created September 21, 2018 17:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdcallag/060e773893450ab6518ab97fd437833c to your computer and use it in GitHub Desktop.
Save mdcallag/060e773893450ab6518ab97fd437833c to your computer and use it in GitHub Desktop.
r.sh
ver=$1
dir=$2
loops=$3
num=$4
pri=$5
key=$6
val=$7
cachemb=$8
dur=$9
rxargs="-disable_auto_compactions=0 -sync=0 -db=$dir -num=$num -num_levels=6 -key_size=$key -value_size=$val -block_size=4096 -cache_size=$(( $cachemb * 1024 * 1024 )) -cache_numshardbits=-1 -compression_type=none -compression_ratio=0.5 -level_compaction_dynamic_level_bytes=true -bytes_per_sync=0 -cache_index_and_filter_blocks=1 -write_buffer_size=$(( 32 * 1024 * 1024 )) -max_write_buffer_number=4 -target_file_size_base=$(( 64 * 1024 * 1024 )) -max_bytes_for_level_base=$(( 512 * 1024 * 1024 )) -statistics=0 -stats_per_interval=1 -stats_interval_seconds=5 -histogram=1 -memtablerep=skip_list -bloom_bits=10 -open_files=-1 -max_background_compactions=8 -max_background_flushes=2 -level0_file_num_compaction_trigger=4 -threads=1 -verify_checksum=0 -max_bytes_for_level_multiplier=10 --compaction_pri=$pri"
sfx=v${ver}.n${num}.p${pri}.k${key}.v${val}
function run1 {
pfx=$1
txt=$2
arg2=$3
rs="rr"
aqps=""
for x in $( seq 1 $loops ); do
./db_bench.$ver -benchmarks=readrandom -use_existing_db=1 -seed=$( date +%s ) $rxargs --duration=$dur $arg2 > $pfx.$x.$sfx 2>&1
if [[ ! -z "$aqps" ]]; then
aqps=$( grep ^readrandom $pfx.$x.$sfx | tail -1 | awk '{ printf "%s %s", aqps, $3 }' aqps="$aqps" )
else
aqps=$( grep ^readrandom $pfx.$x.$sfx | tail -1 | awk '{ print $3 }' )
fi
done
tqps=$( echo $aqps | tr ' ' '\t' )
nqps=$( echo $aqps | tr ' ' '\n' )
len=$( echo "$nqps" | wc -l )
med=$( echo "$nqps" | sort -n | head -$(( ($len + 1) / 2 )) | tail -1 )
printf "rr\t%s\t: %s\t%s\n" "$tqps" $med $txt >> x.$sfx
}
function runit {
s=$1
pfx=x.rr${s}a
run1 $pfx nopin ""
pfx=x.rr${s}b
run1 $pfx pin "-pin_l0_filter_and_index_blocks_in_cache=1"
pfx=x.rr${s}c
run1 $pfx nopin,L0=2 "-level0_file_num_compaction_trigger=2"
pfx=x.rr${s}d
run1 $pfx pin,L0=2 "-pin_l0_filter_and_index_blocks_in_cache=1 -level0_file_num_compaction_trigger=2"
pfx=x.rr${s}e
run1 $pfx nopin,L0=1 "-level0_file_num_compaction_trigger=1"
pfx=x.rr${s}f
run1 $pfx pin,L0=1 "-pin_l0_filter_and_index_blocks_in_cache=1 -level0_file_num_compaction_trigger=1"
}
./db_bench.$ver -benchmarks=fillseq -use_existing_db=0 -seed=$( date +%s ) $rxargs > x.fill.$sfx 2>&1
du -hs $dir >> x.fill.$sfx
grep ^fillseq x.fill.$sfx | awk '{ printf "fillseq\t%s\n", $3 }' > x.$sfx
runit 1
./db_bench.$ver -benchmarks=overwrite -use_existing_db=1 -seed=$( date +%s ) $rxargs > x.ow.$sfx 2>&1
du -hs $dir >> x.ow.$sfx
grep ^overwrite x.ow.$sfx | awk '{ printf "overwrite\t%s\n", $3 }'>> x.$sfx
runit 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment