Gnuplot script for transactions per second
This commit is contained in:
parent
ad4127541e
commit
1ee3f7e67e
1 changed files with 126 additions and 0 deletions
126
test/plot_perf.sh
Executable file
126
test/plot_perf.sh
Executable file
|
|
@ -0,0 +1,126 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Transactions per second for large lists read/write plotter using gnuplot
|
||||||
|
#
|
||||||
|
. ./lib.sh
|
||||||
|
max=1000 # Nr of db entries
|
||||||
|
step=100
|
||||||
|
reqs=1000
|
||||||
|
cfg=$dir/scaling-conf.xml
|
||||||
|
fyang=$dir/scaling.yang
|
||||||
|
fconfig=$dir/config
|
||||||
|
|
||||||
|
# For memcheck
|
||||||
|
# clixon_netconf="valgrind --leak-check=full --show-leak-kinds=all clixon_netconf"
|
||||||
|
# clixon_netconf="valgrind --tool=callgrind clixon_netconf
|
||||||
|
clixon_netconf=clixon_netconf
|
||||||
|
|
||||||
|
cat <<EOF > $fyang
|
||||||
|
module ietf-ip{
|
||||||
|
container x {
|
||||||
|
list y {
|
||||||
|
key "a";
|
||||||
|
leaf a {
|
||||||
|
type string;
|
||||||
|
}
|
||||||
|
leaf b {
|
||||||
|
type string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
leaf-list c {
|
||||||
|
type string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat <<EOF > $cfg
|
||||||
|
<config>
|
||||||
|
<CLICON_CONFIGFILE>$cfg</CLICON_CONFIGFILE>
|
||||||
|
<CLICON_YANG_DIR>$fyang</CLICON_YANG_DIR>
|
||||||
|
<CLICON_YANG_MODULE_MAIN>ietf-ip</CLICON_YANG_MODULE_MAIN>
|
||||||
|
<CLICON_SOCK>/usr/local/var/routing/routing.sock</CLICON_SOCK>
|
||||||
|
<CLICON_BACKEND_PIDFILE>/usr/local/var/routing/routing.pidfile</CLICON_BACKEND_PIDFILE>
|
||||||
|
<CLICON_XMLDB_DIR>/usr/local/var/routing</CLICON_XMLDB_DIR>
|
||||||
|
<CLICON_XMLDB_PLUGIN>/usr/local/lib/xmldb/text.so</CLICON_XMLDB_PLUGIN>
|
||||||
|
</config>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
run(){
|
||||||
|
nr=$1 # Number of entries in DB
|
||||||
|
reqs=$2
|
||||||
|
write=$3
|
||||||
|
|
||||||
|
echo -n "<rpc><edit-config><target><candidate/></target><config><x>" > $fconfig
|
||||||
|
for (( i=0; i<$nr; i++ )); do
|
||||||
|
echo -n "<y><a>$i</a><b>$i</b></y>" >> $fconfig
|
||||||
|
done
|
||||||
|
echo "</x></config></edit-config></rpc>]]>]]>" >> $fconfig
|
||||||
|
|
||||||
|
expecteof_file "$clixon_netconf -qf $cfg -y $fyang" "$fconfig" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||||
|
|
||||||
|
if $write; then
|
||||||
|
time -p for (( i=0; i<$reqs; i++ )); do
|
||||||
|
rnd=$(( ( RANDOM % $nr ) ))
|
||||||
|
echo "<rpc><edit-config><target><candidate/></target><config><x><y><a>$rnd</a><b>$rnd</b></y></x></config></edit-config></rpc>]]>]]>"
|
||||||
|
done | $clixon_netconf -qf $cfg -y $fyang > /dev/null
|
||||||
|
else # read
|
||||||
|
time -p for (( i=0; i<$reqs; i++ )); do
|
||||||
|
rnd=$(( ( RANDOM % $nr ) ))
|
||||||
|
echo "<rpc><get-config><source><candidate/></source><filter type=\"xpath\" select=\"/x/y[a=$rnd][b=$rnd]\" /></get-config></rpc>]]>]]>"
|
||||||
|
done | $clixon_netconf -qf $cfg -y $fyang > /dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
once()(
|
||||||
|
# kill old backend (if any)
|
||||||
|
sudo clixon_backend -zf $cfg -y $fyang
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
err
|
||||||
|
fi
|
||||||
|
|
||||||
|
# start new backend
|
||||||
|
sudo clixon_backend -s init -f $cfg -y $fyang
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
err
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Actual steps
|
||||||
|
for (( i=$step; i<=$max; i=i+$step )); do
|
||||||
|
t=$(TEST=%e run $i $reqs true $ 2>&1 | awk '/real/ {print $2}')
|
||||||
|
# t is time in secs of $reqs -> transactions per second. $reqs
|
||||||
|
p=$(echo "$reqs/$t" | bc -lq)
|
||||||
|
# p is transactions per second.
|
||||||
|
echo "$i $p" >> $dir/write
|
||||||
|
t=$(TEST=%e run $i $reqs false $ 2>&1 | awk '/real/ {print $2}')
|
||||||
|
# t is time in secs of $reqs -> transactions per second. $reqs
|
||||||
|
p=$(echo "$reqs/$t" | bc -lq)
|
||||||
|
# p is transactions per second.
|
||||||
|
echo "$i $p" >> $dir/read
|
||||||
|
done
|
||||||
|
|
||||||
|
# Check if still alive
|
||||||
|
pid=`pgrep clixon_backend`
|
||||||
|
if [ -z "$pid" ]; then
|
||||||
|
err "backend already dead"
|
||||||
|
fi
|
||||||
|
# kill backend
|
||||||
|
sudo clixon_backend -zf $cfg
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
err "kill backend"
|
||||||
|
fi
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
once
|
||||||
|
|
||||||
|
gnuplot -persist <<EOF
|
||||||
|
set title "Clixon transactions per second r/w large lists" font ",14" textcolor rgbcolor "royalblue"
|
||||||
|
set xlabel "entries"
|
||||||
|
set ylabel "transactions per second"
|
||||||
|
set terminal wxt enhanced title "CLixon transactions " persist raise
|
||||||
|
plot "$dir/read" with linespoints title "read", "$dir/write" with linespoints title "write"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
rm -rf $dir
|
||||||
|
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue