mirror of
https://github.com/ceph/ceph
synced 2024-12-29 23:12:27 +00:00
81dee1b67f
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 <loic@dachary.org>
236 lines
6.4 KiB
Bash
Executable File
236 lines
6.4 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Copyright (C) 2013 Cloudwatt <libre.licensing@cloudwatt.com>
|
|
#
|
|
# 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.
|
|
#
|
|
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 <<EOF
|
|
plugin k m work. iter. size eras.
|
|
example 2 1 encode 1 1024 0
|
|
example 2 1 decode 1 1024 1
|
|
jerasure 2 1 encode 1 1024 0
|
|
jerasure 2 1 decode 1 1024 1
|
|
jerasure 2 2 encode 1 1024 0
|
|
jerasure 2 2 decode 1 1024 1
|
|
jerasure 2 2 decode 1 1024 2
|
|
jerasure 2 1 encode 1 1024 0
|
|
jerasure 2 1 decode 1 1024 1
|
|
jerasure 2 2 encode 1 1024 0
|
|
jerasure 2 2 decode 1 1024 1
|
|
jerasure 2 2 decode 1 1024 2
|
|
jerasure 2 1 encode 1 1024 0
|
|
jerasure 2 1 decode 1 1024 1
|
|
jerasure 2 2 encode 1 1024 0
|
|
jerasure 2 2 decode 1 1024 1
|
|
jerasure 2 2 decode 1 1024 2
|
|
jerasure 2 1 encode 1 1024 0
|
|
jerasure 2 1 decode 1 1024 1
|
|
jerasure 2 2 encode 1 1024 0
|
|
jerasure 2 2 decode 1 1024 1
|
|
jerasure 2 2 decode 1 1024 2
|
|
jerasure 2 1 encode 1 1024 0
|
|
jerasure 2 1 decode 1 1024 1
|
|
jerasure 2 2 encode 1 1024 0
|
|
jerasure 2 2 decode 1 1024 1
|
|
jerasure 2 2 decode 1 1024 2
|
|
jerasure 2 1 encode 1 1024 0
|
|
jerasure 2 1 decode 1 1024 1
|
|
jerasure 2 2 encode 1 1024 0
|
|
jerasure 2 2 decode 1 1024 1
|
|
jerasure 2 2 decode 1 1024 2
|
|
jerasure 2 1 encode 1 1024 0
|
|
jerasure 2 1 decode 1 1024 1
|
|
jerasure 2 2 encode 1 1024 0
|
|
jerasure 2 2 decode 1 1024 1
|
|
jerasure 2 2 decode 1 1024 2
|
|
jerasure 6 3 encode 1 1024 0
|
|
jerasure 6 3 decode 1 1024 1
|
|
jerasure 6 3 decode 1 1024 2
|
|
jerasure 6 3 decode 1 1024 3
|
|
jerasure 6 4 encode 1 1024 0
|
|
jerasure 6 4 decode 1 1024 1
|
|
jerasure 6 4 decode 1 1024 2
|
|
jerasure 6 4 decode 1 1024 3
|
|
jerasure 6 4 decode 1 1024 4
|
|
jerasure 10 3 encode 1 1024 0
|
|
jerasure 10 3 decode 1 1024 1
|
|
jerasure 10 3 decode 1 1024 2
|
|
jerasure 10 3 decode 1 1024 3
|
|
jerasure 10 4 encode 1 1024 0
|
|
jerasure 10 4 decode 1 1024 1
|
|
jerasure 10 4 decode 1 1024 2
|
|
jerasure 10 4 decode 1 1024 3
|
|
jerasure 10 4 decode 1 1024 4
|
|
jerasure 6 3 encode 1 1024 0
|
|
jerasure 6 3 decode 1 1024 1
|
|
jerasure 6 3 decode 1 1024 2
|
|
jerasure 6 3 decode 1 1024 3
|
|
jerasure 6 4 encode 1 1024 0
|
|
jerasure 6 4 decode 1 1024 1
|
|
jerasure 6 4 decode 1 1024 2
|
|
jerasure 6 4 decode 1 1024 3
|
|
jerasure 6 4 decode 1 1024 4
|
|
jerasure 10 3 encode 1 1024 0
|
|
jerasure 10 3 decode 1 1024 1
|
|
jerasure 10 3 decode 1 1024 2
|
|
jerasure 10 3 decode 1 1024 3
|
|
jerasure 10 4 encode 1 1024 0
|
|
jerasure 10 4 decode 1 1024 1
|
|
jerasure 10 4 decode 1 1024 2
|
|
jerasure 10 4 decode 1 1024 3
|
|
jerasure 10 4 decode 1 1024 4
|
|
jerasure 6 3 encode 1 1024 0
|
|
jerasure 6 3 decode 1 1024 1
|
|
jerasure 6 3 decode 1 1024 2
|
|
jerasure 6 3 decode 1 1024 3
|
|
jerasure 6 4 encode 1 1024 0
|
|
jerasure 6 4 decode 1 1024 1
|
|
jerasure 6 4 decode 1 1024 2
|
|
jerasure 6 4 decode 1 1024 3
|
|
jerasure 6 4 decode 1 1024 4
|
|
jerasure 10 3 encode 1 1024 0
|
|
jerasure 10 3 decode 1 1024 1
|
|
jerasure 10 3 decode 1 1024 2
|
|
jerasure 10 3 decode 1 1024 3
|
|
jerasure 10 4 encode 1 1024 0
|
|
jerasure 10 4 decode 1 1024 1
|
|
jerasure 10 4 decode 1 1024 2
|
|
jerasure 10 4 decode 1 1024 3
|
|
jerasure 10 4 decode 1 1024 4
|
|
EOF
|
|
)
|
|
test "$(main | cut --fields=3-9 )" = "$expected" || return 1
|
|
}
|
|
|
|
run_test
|
|
else
|
|
main
|
|
fi
|
|
# Local Variables:
|
|
# compile-command: "\
|
|
# CEPH_ERASURE_CODE_BENCHMARK=../../../src/ceph_erasure_code_benchmark \
|
|
# PLUGIN_DIRECTORY=../../../src/.libs \
|
|
# ./bench.sh TEST
|
|
# "
|
|
# End:
|