2013-12-12 22:14:02 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
2015-11-23 19:21:42 +00:00
|
|
|
# Copyright (C) 2015 Red Hat <contact@redhat.com>
|
2014-05-27 17:25:22 +00:00
|
|
|
# Copyright (C) 2013,2014 Cloudwatt <libre.licensing@cloudwatt.com>
|
2013-12-12 22:14:02 +00:00
|
|
|
#
|
|
|
|
# Author: Loic Dachary <loic@dachary.org>
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Library Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
# any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Library Public License for more details.
|
|
|
|
#
|
2014-05-30 13:24:25 +00:00
|
|
|
# Test that it works from sources with:
|
|
|
|
#
|
|
|
|
# CEPH_ERASURE_CODE_BENCHMARK=src/ceph_erasure_code_benchmark \
|
|
|
|
# PLUGIN_DIRECTORY=src/.libs \
|
|
|
|
# qa/workunits/erasure-code/bench.sh fplot jerasure |
|
|
|
|
# tee qa/workunits/erasure-code/bench.js
|
|
|
|
#
|
|
|
|
# This should start immediately and display:
|
|
|
|
#
|
2015-05-12 12:47:32 +00:00
|
|
|
# ...
|
2014-05-30 13:24:25 +00:00
|
|
|
# [ '2/1', .48035538612887358583 ],
|
|
|
|
# [ '3/2', .21648470405675016626 ],
|
|
|
|
# etc.
|
|
|
|
#
|
|
|
|
# and complete within a few seconds. The result can then be displayed with:
|
|
|
|
#
|
|
|
|
# firefox qa/workunits/erasure-code/bench.html
|
|
|
|
#
|
|
|
|
# Once it is confirmed to work, it can be run with a more significant
|
|
|
|
# volume of data so that the measures are more reliable:
|
|
|
|
#
|
2015-05-12 12:47:32 +00:00
|
|
|
# TOTAL_SIZE=$((4 * 1024 * 1024 * 1024)) \
|
2014-05-30 13:24:25 +00:00
|
|
|
# CEPH_ERASURE_CODE_BENCHMARK=src/ceph_erasure_code_benchmark \
|
|
|
|
# PLUGIN_DIRECTORY=src/.libs \
|
|
|
|
# qa/workunits/erasure-code/bench.sh fplot jerasure |
|
|
|
|
# tee qa/workunits/erasure-code/bench.js
|
|
|
|
#
|
2013-12-12 22:14:02 +00:00
|
|
|
set -e
|
|
|
|
|
|
|
|
export PATH=/sbin:$PATH
|
|
|
|
|
|
|
|
: ${VERBOSE:=false}
|
|
|
|
: ${CEPH_ERASURE_CODE_BENCHMARK:=ceph_erasure_code_benchmark}
|
|
|
|
: ${PLUGIN_DIRECTORY:=/usr/lib/ceph/erasure-code}
|
2016-09-22 19:40:52 +00:00
|
|
|
: ${PLUGINS:=isa jerasure}
|
2015-11-23 19:59:28 +00:00
|
|
|
: ${TECHNIQUES:=vandermonde cauchy}
|
2015-05-12 12:47:32 +00:00
|
|
|
: ${TOTAL_SIZE:=$((1024 * 1024))}
|
|
|
|
: ${SIZE:=4096}
|
2014-05-27 17:25:22 +00:00
|
|
|
: ${PARAMETERS:=--parameter jerasure-per-chunk-alignment=true}
|
2013-12-12 22:14:02 +00:00
|
|
|
|
|
|
|
function bench_header() {
|
|
|
|
echo -e "seconds\tKB\tplugin\tk\tm\twork.\titer.\tsize\teras.\tcommand."
|
|
|
|
}
|
|
|
|
|
|
|
|
function bench() {
|
|
|
|
local plugin=$1
|
|
|
|
shift
|
|
|
|
local k=$1
|
|
|
|
shift
|
|
|
|
local m=$1
|
|
|
|
shift
|
|
|
|
local workload=$1
|
|
|
|
shift
|
|
|
|
local iterations=$1
|
|
|
|
shift
|
|
|
|
local size=$1
|
|
|
|
shift
|
|
|
|
local erasures=$1
|
|
|
|
shift
|
|
|
|
command=$(echo $CEPH_ERASURE_CODE_BENCHMARK \
|
|
|
|
--plugin $plugin \
|
|
|
|
--workload $workload \
|
|
|
|
--iterations $iterations \
|
|
|
|
--size $size \
|
|
|
|
--erasures $erasures \
|
2014-05-27 17:25:22 +00:00
|
|
|
--parameter k=$k \
|
|
|
|
--parameter m=$m \
|
2015-11-23 19:21:42 +00:00
|
|
|
--erasure-code-dir $PLUGIN_DIRECTORY)
|
2013-12-12 22:14:02 +00:00
|
|
|
result=$($command "$@")
|
|
|
|
echo -e "$result\t$plugin\t$k\t$m\t$workload\t$iterations\t$size\t$erasures\t$command ""$@"
|
|
|
|
}
|
|
|
|
|
2014-05-27 17:25:22 +00:00
|
|
|
function packetsize() {
|
|
|
|
local k=$1
|
|
|
|
local w=$2
|
|
|
|
local vector_wordsize=$3
|
|
|
|
local size=$4
|
2013-12-12 22:14:02 +00:00
|
|
|
|
2014-05-27 17:25:22 +00:00
|
|
|
local p=$(( ($size / $k / $w / $vector_wordsize ) * $vector_wordsize))
|
|
|
|
if [ $p -gt 3100 ] ; then
|
|
|
|
p=3100
|
|
|
|
fi
|
|
|
|
echo $p
|
2013-12-12 22:14:02 +00:00
|
|
|
}
|
|
|
|
|
2015-05-12 12:47:32 +00:00
|
|
|
function bench_run() {
|
2013-12-12 22:14:02 +00:00
|
|
|
local plugin=jerasure
|
2014-05-27 17:25:22 +00:00
|
|
|
local w=8
|
|
|
|
local VECTOR_WORDSIZE=16
|
|
|
|
local ks="2 3 4 6 10"
|
|
|
|
declare -A k2ms
|
|
|
|
k2ms[2]="1"
|
|
|
|
k2ms[3]="2"
|
|
|
|
k2ms[4]="2 3"
|
|
|
|
k2ms[6]="2 3 4"
|
|
|
|
k2ms[10]="3 4"
|
2015-11-23 19:59:28 +00:00
|
|
|
for technique in ${TECHNIQUES} ; do
|
|
|
|
for plugin in ${PLUGINS} ; do
|
2015-05-12 12:47:32 +00:00
|
|
|
eval technique_parameter=\$${plugin}2technique_${technique}
|
|
|
|
echo "serie encode_${technique}_${plugin}"
|
2014-05-27 17:25:22 +00:00
|
|
|
for k in $ks ; do
|
|
|
|
for m in ${k2ms[$k]} ; do
|
2015-05-12 12:47:32 +00:00
|
|
|
bench $plugin $k $m encode $(($TOTAL_SIZE / $SIZE)) $SIZE 0 \
|
|
|
|
--parameter packetsize=$(packetsize $k $w $VECTOR_WORDSIZE $SIZE) \
|
2014-05-27 17:25:22 +00:00
|
|
|
${PARAMETERS} \
|
2015-05-12 12:47:32 +00:00
|
|
|
--parameter technique=$technique_parameter
|
2013-12-12 22:14:02 +00:00
|
|
|
|
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
2015-11-23 19:59:28 +00:00
|
|
|
for technique in ${TECHNIQUES} ; do
|
|
|
|
for plugin in ${PLUGINS} ; do
|
2015-05-12 12:47:32 +00:00
|
|
|
eval technique_parameter=\$${plugin}2technique_${technique}
|
|
|
|
echo "serie decode_${technique}_${plugin}"
|
2014-05-27 17:25:22 +00:00
|
|
|
for k in $ks ; do
|
|
|
|
for m in ${k2ms[$k]} ; do
|
|
|
|
echo
|
2013-12-12 22:14:02 +00:00
|
|
|
for erasures in $(seq 1 $m) ; do
|
2015-05-12 12:47:32 +00:00
|
|
|
bench $plugin $k $m decode $(($TOTAL_SIZE / $SIZE)) $SIZE $erasures \
|
|
|
|
--parameter packetsize=$(packetsize $k $w $VECTOR_WORDSIZE $SIZE) \
|
2014-05-27 17:25:22 +00:00
|
|
|
${PARAMETERS} \
|
2015-05-12 12:47:32 +00:00
|
|
|
--parameter technique=$technique_parameter
|
2013-12-12 22:14:02 +00:00
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2014-05-30 13:24:25 +00:00
|
|
|
function fplot() {
|
|
|
|
local serie
|
2015-05-12 12:47:32 +00:00
|
|
|
bench_run | while read seconds total plugin k m workload iteration size erasures rest ; do
|
2014-05-30 13:24:25 +00:00
|
|
|
if [ -z $seconds ] ; then
|
|
|
|
echo null,
|
|
|
|
elif [ $seconds = serie ] ; then
|
|
|
|
if [ "$serie" ] ; then
|
|
|
|
echo '];'
|
|
|
|
fi
|
2014-11-06 07:46:27 +00:00
|
|
|
local serie=`echo $total | sed 's/cauchy_\([0-9]\)/cauchy_good_\1/g'`
|
|
|
|
echo "var $serie = ["
|
2014-05-30 13:24:25 +00:00
|
|
|
else
|
|
|
|
local x
|
|
|
|
if [ $workload = encode ] ; then
|
|
|
|
x=$k/$m
|
|
|
|
else
|
|
|
|
x=$k/$m/$erasures
|
|
|
|
fi
|
|
|
|
echo "[ '$x', " $(echo "( $total / 1024 / 1024 ) / $seconds" | bc -ql) " ], "
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
echo '];'
|
|
|
|
}
|
|
|
|
|
2013-12-12 22:14:02 +00:00
|
|
|
function main() {
|
|
|
|
bench_header
|
2015-05-12 12:47:32 +00:00
|
|
|
bench_run
|
2013-12-12 22:14:02 +00:00
|
|
|
}
|
|
|
|
|
2015-05-12 12:47:32 +00:00
|
|
|
if [ "$1" = fplot ] ; then
|
2014-05-30 13:24:25 +00:00
|
|
|
"$@"
|
2013-12-12 22:14:02 +00:00
|
|
|
else
|
|
|
|
main
|
|
|
|
fi
|
|
|
|
# Local Variables:
|
|
|
|
# compile-command: "\
|
|
|
|
# CEPH_ERASURE_CODE_BENCHMARK=../../../src/ceph_erasure_code_benchmark \
|
|
|
|
# PLUGIN_DIRECTORY=../../../src/.libs \
|
2015-05-12 12:47:32 +00:00
|
|
|
# ./bench.sh
|
2013-12-12 22:14:02 +00:00
|
|
|
# "
|
|
|
|
# End:
|