diff --git a/test/plot_perf.sh b/test/plot_perf.sh index 2df88683..38aa89af 100755 --- a/test/plot_perf.sh +++ b/test/plot_perf.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Performance of large lists. See large-lists.md +# Performance of large lists. See doc/scaling/large-lists.md # The parameters are shown below (under Default values) # Examples # 1. run all measurements up to 10000 entris collect all results in /tmp/plots @@ -8,6 +8,7 @@ # run=false plot=true resdir=/tmp/plots term=x11 ./plot_perf.sh # 3. Use existing data plot i686 and armv7l data as png # archs="i686 armv7l" run=false plot=true resdir=/tmp/plots term=png ./plot_perf.sh +# Need gnuplot installed # Magic line must be first in script (see README.md) s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi @@ -509,7 +510,6 @@ for a in $archs; do done - gnuplot -persist <&1 | awk '/real/ {print $2}' + APPNAME=example cfg=$dir/scaling-conf.xml @@ -98,26 +104,32 @@ echo "]]>]]>" >> $fconfig # Now take large config file and write it via netconf to candidate new "netconf write large config" -expecteof_file "time $clixon_netconf -qf $cfg" 0 "$fconfig" "^]]>]]>$" +expecteof_file "time -p $clixon_netconf -qf $cfg" 0 "$fconfig" "^]]>]]>$" 2>&1 | awk '/real/ {print $2}' # Here, there are $perfnr entries in candidate new "netconf write large config again" -expecteof_file "time $clixon_netconf -qf $cfg" 0 "$fconfig" "^]]>]]>$" +expecteof_file "time -p $clixon_netconf -qf $cfg" 0 "$fconfig" "^]]>]]>$" 2>&1 | awk '/real/ {print $2}' # Now commit it from candidate to running new "netconf commit large config" -expecteof "time $clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "time -p $clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" 2>&1 | awk '/real/ {print $2}' # Now commit it again from candidate (validation takes time when # comparing to existing) new "netconf commit large config again" -expecteof "time $clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" - +expecteof "time -p $clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" 2>&1 | awk '/real/ {print $2}' # Having a large db, get and put single entries many times # Note same entries in the range alreay there, db has same size -# NETCONF get -new "netconf get $perfreq small config" +# NETCONF get 1 key index +new "netconf get $perfreq small config 1 key index" +{ time -p for (( i=0; i<$perfreq; i++ )); do + rnd=$(( ( RANDOM % $perfnr ) )) + echo "]]>]]>" +done | $clixon_netconf -qf $cfg > /dev/null; } 2>&1 | awk '/real/ {print $2}' + +# NETCONF get 1 key and one non-key index +new "netconf get $perfreq small config 1 key + 1 non-key index" { time -p for (( i=0; i<$perfreq; i++ )); do rnd=$(( ( RANDOM % $perfnr ) )) echo "]]>]]>" @@ -131,7 +143,7 @@ new "netconf add $perfreq small config" done | $clixon_netconf -qf $cfg > /dev/null; } 2>&1 | awk '/real/ {print $2}' # RESTCONF get -new "restconf get $perfreq small config" +new "restconf get $perfreq small config 1 key index" { time -p for (( i=0; i<$perfreq; i++ )); do rnd=$(( ( RANDOM % $perfnr ) )) curl -sG http://localhost/restconf/data/scaling:x/y=$rnd > /dev/null @@ -147,8 +159,8 @@ new "restconf add $perfreq small config" curl -s -X PUT http://localhost/restconf/data/scaling:x/y=$rnd -d '{"scaling:y":{"a":"'$rnd'","b":"'$rnd'"}}' done } 2>&1 | awk '/real/ {print $2}' -# CLI get -new "cli get $perfreq small config" +# CLI get (XXX why does this take so much time?) +new "cli get $perfreq small config 1 key index" { time -p for (( i=0; i<$perfreq; i++ )); do rnd=$(( ( RANDOM % $perfnr ) )) $clixon_cli -1 -f $cfg show conf xml x y $rnd > /dev/null @@ -164,13 +176,14 @@ done } 2>&1 | awk '/real/ {print $2}' # Instead of many small entries, get one large in netconf and restconf # cli? new "netconf get large config" -expecteof "time $clixon_netconf -qf $cfg" 0 "]]>]]>" '^00112233' +expecteof "time -p $clixon_netconf -qf $cfg" 0 "]]>]]>" '^00112233' 2>&1 | awk '/real/ {print $2}' new "restconf get large config" -time curl -sG http://localhost/restconf/data > /dev/null +# XXX for some reason cannot expand $TIMEFN next two tests, need keep variable? +$TIMEFN curl -sG http://localhost/restconf/data 2>&1 > /dev/null | awk '/real/ {print $2}' new "cli get large config" -time $clixon_cli -1f $cfg show config xml> /dev/null +$TIMEFN $clixon_cli -1f $cfg show config xml 2>&1 > /dev/null | awk '/real/ {print $2}' # Delete entries (last since entries are removed from db) # netconf @@ -180,7 +193,7 @@ new "cli delete $perfreq small config" $clixon_cli -1 -f $cfg delete x y $rnd done } 2>&1 | awk '/real/ {print $2}' -new "netconf discard-changes" +#new "netconf discard-changes" expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" new "netconf delete $perfreq small config" @@ -189,7 +202,7 @@ new "netconf delete $perfreq small config" echo "$rnd]]>]]>" done | $clixon_netconf -qf $cfg > /dev/null; } 2>&1 | awk '/real/ {print $2}' -new "netconf discard-changes" +#new "netconf discard-changes" expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" new "restconf delete $perfreq small config" @@ -200,7 +213,7 @@ done > /dev/null; } 2>&1 | awk '/real/ {print $2}' # Now do leaf-lists istead of leafs -new "generate large leaf-list config" +#new "generate large leaf-list config" echo -n "replace" > $fconfig2 for (( i=0; i<$perfnr; i++ )); do echo -n "$i" >> $fconfig2 @@ -208,25 +221,25 @@ done echo "]]>]]>" >> $fconfig2 new "netconf replace large list-leaf config" -expecteof_file "time $clixon_netconf -qf $cfg" 0 "$fconfig2" "^]]>]]>$" +expecteof_file "time -p $clixon_netconf -qf $cfg" 0 "$fconfig2" "^]]>]]>$" 2>&1 | awk '/real/ {print $2}' new "netconf commit large leaf-list config" -expecteof "time $clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "time -p $clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" 2>&1 | awk '/real/ {print $2}' new "netconf add $perfreq small leaf-list config" -time -p for (( i=0; i<$perfreq; i++ )); do +{ time -p for (( i=0; i<$perfreq; i++ )); do rnd=$(( ( RANDOM % $perfnr ) )) echo "$rnd]]>]]>" -done | $clixon_netconf -qf $cfg > /dev/null +done | $clixon_netconf -qf $cfg > /dev/null; } 2>&1 | awk '/real/ {print $2}' new "netconf add small leaf-list config" -expecteof "time $clixon_netconf -qf $cfg" 0 'x]]>]]>' "^]]>]]>$" +expecteof "time -p $clixon_netconf -qf $cfg" 0 'x]]>]]>' "^]]>]]>$" 2>&1 | awk '/real/ {print $2}' new "netconf commit small leaf-list config" -expecteof "time $clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "time -p $clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" 2>&1 | awk '/real/ {print $2}' new "netconf get large leaf-list config" -expecteof "time $clixon_netconf -qf $cfg" 0 "]]>]]>" '^01' +expecteof "time -p $clixon_netconf -qf $cfg" 0 "]]>]]>" '^01' 2>&1 | awk '/real/ {print $2}' new "Kill restconf daemon" stop_restconf diff --git a/test/test_perf_state.sh b/test/test_perf_state.sh index 31e1f4de..f01fbc57 100755 --- a/test/test_perf_state.sh +++ b/test/test_perf_state.sh @@ -16,6 +16,9 @@ s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi # Number of requests made get/put : ${perfreq:=100} +# time function (this is a mess to get right on freebsd/linux) +: ${TIMEFN:=time -p} # portability: 2>&1 | awk '/real/ {print $2}' + APPNAME=example cfg=$dir/config.xml @@ -76,11 +79,11 @@ echo "]]>]]>" >> $fconfig # Now take large config file and write it via netconf to candidate new "netconf write large config" -expecteof_file "time $clixon_netconf -qf $cfg" 0 "$fconfig" "^]]>]]>$" +expecteof_file "time -p $clixon_netconf -qf $cfg" 0 "$fconfig" "^]]>]]>$" 2>&1 | awk '/real/ {print $2}' # Now commit it from candidate to running new "netconf commit large config" -expecteof "time $clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "time -p $clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" 2>&1 | awk '/real/ {print $2}' # START actual tests # Having a large db, get single entries many times @@ -128,13 +131,13 @@ done } 2>&1 | awk '/real/ {print $2}' # Get config in one large get new "netconf get large config" -time echo " ]]>]]>" | $clixon_netconf -qf $cfg > /tmp/netconf +{ time -p echo " ]]>]]>" | $clixon_netconf -qf $cfg > /tmp/netconf; } 2>&1 | awk '/real/ {print $2}' new "restconf get large config" -time curl -sG http://localhost/restconf/data/ietf-interfaces:interfaces | wc +$TIMEFN curl -sG http://localhost/restconf/data/ietf-interfaces:interfaces 2>&1 | awk '/real/ {print $2}' new "cli get large config" -time $clixon_cli -1f $cfg show state xml interfaces | wc +$TIMEFN $clixon_cli -1f $cfg show state xml interfaces 2>&1 | awk '/real/ {print $2}' new "Kill restconf daemon" stop_restconf diff --git a/test/test_perf_xml.sh b/test/test_perf_xml.sh index 216af1ef..8843c0fc 100755 --- a/test/test_perf_xml.sh +++ b/test/test_perf_xml.sh @@ -22,7 +22,7 @@ echo "]]>" >> $fxml #0.37user 1.94system 0:02.47elapsed 93%CPU (0avgtext+0avgdata 9336maxresident)k #256inputs+0outputs (2major+2049minor)pagefaults 0swa new "xml parse long CDATA" -expecteof_file "time $clixon_util_xml" 0 "$fxml" +expecteof_file "time -p $clixon_util_xml" 0 "$fxml" 2>&1 | awk '/real/ {print $2}' rm -rf $dir