#!/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 < $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 < $cfg $cfg $fyang ietf-ip /usr/local/var/routing/routing.sock /usr/local/var/routing/routing.pidfile /usr/local/var/routing /usr/local/lib/xmldb/text.so EOF run(){ nr=$1 # Number of entries in DB reqs=$2 write=$3 echo -n "" > $fconfig for (( i=0; i<$nr; i++ )); do echo -n "$i$i" >> $fconfig done echo "]]>]]>" >> $fconfig expecteof_file "$clixon_netconf -qf $cfg -y $fyang" "$fconfig" "^]]>]]>$" if $write; then time -p for (( i=0; i<$reqs; i++ )); do rnd=$(( ( RANDOM % $nr ) )) echo "$rnd$rnd]]>]]>" done | $clixon_netconf -qf $cfg -y $fyang > /dev/null else # read time -p for (( i=0; i<$reqs; i++ )); do rnd=$(( ( RANDOM % $nr ) )) echo "]]>]]>" 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 <