From ffe77c9127c33d10337e0cb7d0d4cd1e6727412e Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Sat, 27 Jan 2018 14:46:53 +0100 Subject: [PATCH] restconf performance test --- test/plot_perf.sh | 63 +++++++++++++++++++++++++++-------------------- test/test_perf.sh | 59 ++++++++++++++++++++++++++++++++------------ 2 files changed, 79 insertions(+), 43 deletions(-) diff --git a/test/plot_perf.sh b/test/plot_perf.sh index db73f7cc..c5eaaa98 100755 --- a/test/plot_perf.sh +++ b/test/plot_perf.sh @@ -1,12 +1,12 @@ #!/bin/bash # Transactions per second for large lists read/write plotter using gnuplot -# +# WORK IN PROGRESS . ./lib.sh -max=200 # Nr of db entries -step=100 -reqs=1000 -cfg=$dir/scaling-conf.xml -fyang=$dir/scaling.yang +max=2000 # Nr of db entries +step=200 +reqs=500 +cfg=$dir/plot-conf.xml +fyang=$dir/plot.yang fconfig=$dir/config # For memcheck @@ -40,6 +40,7 @@ cat < $cfg ietf-ip /usr/local/var/routing/routing.sock /usr/local/var/routing/routing.pidfile +false /usr/local/var/routing /usr/local/lib/xmldb/text.so @@ -52,9 +53,16 @@ run(){ echo -n "replace" > $fconfig for (( i=0; i<$nr; i++ )); do - echo -n "$i" >> $fconfig - echo -n "$i$i" >> $fconfig + case $mode in + readlist|writelist|restreadlist|restwritelist) + echo -n "$i$i" >> $fconfig + ;; + writeleaflist) + echo -n "$i" >> $fconfig + ;; + esac done + echo "]]>]]>" >> $fconfig expecteof_file "$clixon_netconf -qf $cfg -y $fyang" "$fconfig" "^]]>]]>$" @@ -64,42 +72,45 @@ run(){ time -p for (( i=0; i<$reqs; i++ )); do rnd=$(( ( RANDOM % $nr ) )) echo "]]>]]>" -done | $clixon_netconf -qf $cfg -y $fyang > /dev/null +done | $clixon_netconf -qf $cfg -y $fyang > /dev/null ;; writelist) time -p for (( i=0; i<$reqs; i++ )); do rnd=$(( ( RANDOM % $nr ) )) echo "$rnd$rnd]]>]]>" -done | $clixon_netconf -qf $cfg -y $fyang > /dev/null - ;; - readleaflist) +done | $clixon_netconf -qf $cfg -y $fyang > /dev/null + ;; + restreadlist) time -p for (( i=0; i<$reqs; i++ )); do rnd=$(( ( RANDOM % $nr ) )) - echo "]]>]]>" -done | $clixon_netconf -qf $cfg -y $fyang > /dev/null - ;; + curl -sSG http://localhost/restconf/data/x/y=$rnd,$rnd > /dev/null +done + ;; writeleaflist) time -p for (( i=0; i<$reqs; i++ )); do rnd=$(( ( RANDOM % $nr ) )) echo "$rnd]]>]]>" -done | $clixon_netconf -qf $cfg -y $fyang > /dev/null +done | $clixon_netconf -qf $cfg -y $fyang > /dev/null ;; esac - expecteof "$clixon_netconf -qf $cfg" "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg -y $fyang" "]]>]]>" "^]]>]]>$" + } step(){ i=$1 mode=$2 echo -n "" > $fconfig - t=$(TEST=%e run $i $reqs $mode $ 2>&1 | awk '/real/ {print $2}') - # t is time in secs of $reqs -> transactions per second. $reqs + t=$(TEST=%e run $i $reqs $mode 2>&1 | awk '/real/ {print $2}') + #TEST=%e run $i $reqs $mode 2>&1 + # 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/$mode +# echo "m:$mode i:$i t=$t p=$p" } -once()( +once(){ # kill old backend (if any) sudo clixon_backend -zf $cfg -y $fyang if [ $? -ne 0 ]; then @@ -116,14 +127,14 @@ once()( for (( i=10; i<=$step; i=i+10 )); do step $i readlist step $i writelist - step $i readleaflist + step $i restreadlist step $i writeleaflist done # Actual steps for (( i=$step; i<=$max; i=i+$step )); do step $i readlist - step $i readleaflist step $i writelist + step $i restreadlist step $i writeleaflist done @@ -137,8 +148,7 @@ once()( if [ $? -ne 0 ]; then err "kill backend" fi - -) +} once @@ -146,10 +156,9 @@ gnuplot -persist < $cfg ietf-ip /usr/local/var/routing/routing.sock /usr/local/var/routing/routing.pidfile +false /usr/local/var/routing /usr/local/lib/xmldb/text.so @@ -73,6 +74,14 @@ if [ $? -ne 0 ]; then err fi +new "kill old restconf daemon" +sudo pkill -u www-data clixon_restconf + +new "start restconf daemon" +sudo start-stop-daemon -S -q -o -b -x /www-data/clixon_restconf -d /www-data -c www-data -- -Df $cfg -y $fyang + +sleep 1 + new "generate 'large' config with $number list entries" echo -n "" > $fconfig for (( i=0; i<$number; i++ )); do @@ -84,25 +93,37 @@ echo "]]>]]>" >> $fconfig echo "$clixon_netconf -qf $cfg -y $fyang" new "netconf write large config" -expecteof_file "time -p $clixon_netconf -qf $cfg -y $fyang" "$fconfig" "^]]>]]>$" +expecteof_file "time -f %e $clixon_netconf -qf $cfg -y $fyang" "$fconfig" "^]]>]]>$" #echo ']]>]]>' | $clixon_netconf -qf $cfg -y $fyang new "netconf write large config again" -expecteof_file "time -p $clixon_netconf -qf $cfg -y $fyang" "$fconfig" "^]]>]]>$" +expecteof_file "time -f %e $clixon_netconf -qf $cfg -y $fyang" "$fconfig" "^]]>]]>$" #echo ']]>]]>' | $clixon_netconf -qf $cfg -y $fyang rm $fconfig new "netconf commit large config" -expecteof "time -p $clixon_netconf -qf $cfg -y $fyang" "]]>]]>" "^]]>]]>$" +expecteof "time -f %e $clixon_netconf -qf $cfg -y $fyang" "]]>]]>" "^]]>]]>$" new "netconf commit large config again" -expecteof "time -p $clixon_netconf -qf $cfg -y $fyang" "]]>]]>" "^]]>]]>$" +expecteof "time -f %e $clixon_netconf -qf $cfg -y $fyang" "]]>]]>" "^]]>]]>$" new "netconf add small (1 entry) config" -expecteof "time -p $clixon_netconf -qf $cfg -y $fyang" "xy]]>]]>" "^]]>]]>$" +expecteof "time -f %e $clixon_netconf -qf $cfg -y $fyang" "xy]]>]]>" "^]]>]]>$" + +new "netconf get $req small config" +time -p for (( i=0; i<$req; i++ )); do + rnd=$(( ( RANDOM % $number ) )) + echo "]]>]]>" +done | $clixon_netconf -qf $cfg -y $fyang > /dev/null + +new "netconf get $req restconf small config" +time -p for (( i=0; i<$req; i++ )); do + rnd=$(( ( RANDOM % $number ) )) +#XXX curl -sX PUT -d {"y":{"a":"$rnd","b":"$rnd"}} http://localhost/restconf/data/x/y=$rnd,$rnd +done new "netconf add $req small config" time -p for (( i=0; i<$req; i++ )); do @@ -110,14 +131,14 @@ time -p for (( i=0; i<$req; i++ )); do echo "$rnd$rnd]]>]]>" done | $clixon_netconf -qf $cfg -y $fyang > /dev/null -new "netconf get large config" -expecteof "time -p $clixon_netconf -qf $cfg -y $fyang" "]]>]]>" "^0011" - -new "netconf get $req small config" +new "netconf add $req restconf small config" time -p for (( i=0; i<$req; i++ )); do rnd=$(( ( RANDOM % $number ) )) - echo "]]>]]>" -done | $clixon_netconf -qf $cfg -y $fyang > /dev/null + curl -sG http://localhost/restconf/data/x/y=$rnd,$rnd > /dev/null +done + +new "netconf get large config" +expecteof "time -f %e $clixon_netconf -qf $cfg -y $fyang" "]]>]]>" "^0011" new "generate large leaf-list config" echo -n "replace" > $fconfig @@ -127,21 +148,27 @@ done echo "]]>]]>" >> $fconfig new "netconf replace large list-leaf config" -expecteof_file "time -p $clixon_netconf -qf $cfg -y $fyang" "$fconfig" "^]]>]]>$" +expecteof_file "time -f %e $clixon_netconf -qf $cfg -y $fyang" "$fconfig" "^]]>]]>$" rm $fconfig new "netconf commit large leaf-list config" -expecteof "time -p $clixon_netconf -qf $cfg -y $fyang" "]]>]]>" "^]]>]]>$" +expecteof "time -f %e $clixon_netconf -qf $cfg -y $fyang" "]]>]]>" "^]]>]]>$" + +new "netconf add $req small leaf-list config" +time -p for (( i=0; i<$req; i++ )); do + rnd=$(( ( RANDOM % $number ) )) + echo "$rnd]]>]]>" +done | $clixon_netconf -qf $cfg -y $fyang > /dev/null new "netconf add small leaf-list config" -expecteof "time -p $clixon_netconf -qf $cfg -y $fyang" "x]]>]]>" "^]]>]]>$" +expecteof "time -f %e $clixon_netconf -qf $cfg -y $fyang" "x]]>]]>" "^]]>]]>$" new "netconf commit small leaf-list config" -expecteof "time -p $clixon_netconf -qf $cfg -y $fyang" "]]>]]>" "^]]>]]>$" +expecteof "time -f %e $clixon_netconf -qf $cfg -y $fyang" "]]>]]>" "^]]>]]>$" new "netconf get large leaf-list config" -expecteof "time -p $clixon_netconf -qf $cfg -y $fyang" "]]>]]>" "^01" +expecteof "time -f %e $clixon_netconf -qf $cfg -y $fyang" "]]>]]>" "^01" new "Kill backend" # Check if still alive