From: Loic Dachary Date: Thu, 12 Dec 2013 22:14:02 +0000 (+0100) Subject: osd: erasure code benchmark workunit X-Git-Tag: v0.75~65^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=81dee1b67f4d730d4c8ba473ec7276df11ade292;p=ceph.git osd: erasure code benchmark workunit Display benchmark results for the default erasure code plugins, in a tab separated CSV file. The first two column contain the amount of KB that were coded or decoded, for a given combination of parameters displayed in the following fields. seconds KB plugin k m work. iter. size eras. 1.2 10 example 2 1 encode 10 1024 0 0.5 10 example 2 1 decode 10 1024 1 It can be used as input for a human readable report. It is also intented to be used to show if a given version of an erasure code plugin performs better than another. The last column ( not shown above for brievety ) is the exact command that was run to produce the result so it can be copy / pasted to reproduce them or to profile. Only the jerasure techniques mentionned in https://www.usenix.org/legacy/events/fast09/tech/full_papers/plank/plank_html/ are benchmarked, the others are assumed to be less interesting. Signed-off-by: Loic Dachary --- diff --git a/qa/workunits/erasure-code/bench.sh b/qa/workunits/erasure-code/bench.sh new file mode 100755 index 000000000000..db7c49065294 --- /dev/null +++ b/qa/workunits/erasure-code/bench.sh @@ -0,0 +1,235 @@ +#!/bin/bash +# +# Copyright (C) 2013 Cloudwatt +# +# Author: Loic Dachary +# +# 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. +# +set -e + +export PATH=/sbin:$PATH + +: ${VERBOSE:=false} +: ${CEPH_ERASURE_CODE_BENCHMARK:=ceph_erasure_code_benchmark} +: ${PLUGIN_DIRECTORY:=/usr/lib/ceph/erasure-code} +: ${PLUGINS:=example jerasure} +: ${ITERATIONS:=1024} +: ${SIZE:=1048576} + +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 \ + --parameter erasure-code-k=$k \ + --parameter erasure-code-m=$m \ + --parameter erasure-code-directory=$PLUGIN_DIRECTORY) + result=$($command "$@") + echo -e "$result\t$plugin\t$k\t$m\t$workload\t$iterations\t$size\t$erasures\t$command ""$@" +} + +function example_test() { + local plugin=example + + bench $plugin 2 1 encode $ITERATIONS $SIZE 0 + bench $plugin 2 1 decode $ITERATIONS $SIZE 1 +} + +# +# The results are expected to be consistent with +# https://www.usenix.org/legacy/events/fast09/tech/full_papers/plank/plank_html/ +# +function jerasure_test() { + local plugin=jerasure + + for technique in reed_sol_van ; do + for k in 4 6 10 ; do + for m in $(seq 1 4) ; do + bench $plugin $k $m encode $ITERATIONS $SIZE 0 \ + --parameter erasure-code-technique=$technique + + for erasures in $(seq 1 $m) ; do + bench $plugin $k $m decode $ITERATIONS $SIZE $erasures \ + --parameter erasure-code-technique=$technique + done + done + done + done + + for technique in cauchy_orig cauchy_good ; do + for packetsize in $(seq 512 512 4096) ; do + for k in 4 6 10 ; do + for m in $(seq 1 4) ; do + bench $plugin $k $m encode $ITERATIONS $SIZE 0 \ + --parameter erasure-code-packetsize=$packetsize \ + --parameter erasure-code-technique=$technique + + for erasures in $(seq 1 $m) ; do + bench $plugin $k $m decode $ITERATIONS $SIZE $erasures \ + --parameter erasure-code-packetsize=$packetsize \ + --parameter erasure-code-technique=$technique + done + done + done + done + done +} + +function main() { + bench_header + for plugin in ${PLUGINS} ; do + ${plugin}_test || return 1 + done +} + +if [ "$1" = TEST ] +then + set -x + set -o functrace + PS4=' ${FUNCNAME[0]}: $LINENO: ' + + ITERATIONS=1 + SIZE=1024 + + function run_test() { + dir=/tmp/erasure-code + rm -fr $dir + mkdir $dir + expected=$(cat <