* Optimized validation of large lists
* New xmldb_get1() returning actual cache - not a copy. This has lead to some householding instead of just deleting the copy * xml_diff rewritten to work linearly instead of O(2) * New xml_insert function using tree search. The new code uses this in insertion xmldb_put and defaults. (Note previous xml_insert renamed to xml_wrap_all)
This commit is contained in:
parent
9b9b53c4ee
commit
c79baf1b1f
16 changed files with 937 additions and 301 deletions
|
|
@ -1,10 +1,33 @@
|
|||
#!/bin/bash
|
||||
# Transactions per second for large lists read/write plotter using gnuplot
|
||||
# WORK IN PROGRESS
|
||||
. ./lib.sh
|
||||
max=2000 # Nr of db entries
|
||||
step=200
|
||||
reqs=500
|
||||
# What do I want to plot?
|
||||
# 1. How long to write 100K entries?
|
||||
# - netconf / restconf
|
||||
# - list / leaf-list
|
||||
# 2. How long to read 100K entries?
|
||||
# - netconf/ restconf
|
||||
# - list / leaf-list
|
||||
# 3. How long to commit 100K entries? (netconf)
|
||||
# - list / leaf-list
|
||||
# 4. In database 100K entries. How many read operations per second?
|
||||
# - netconf/ restconf
|
||||
# - list / leaf-list
|
||||
# 5. 100K entries. How many write operations per second?
|
||||
# - netconf / restconf
|
||||
# - list / leaf-list
|
||||
# 6. 100K entries. How may delete operations per second?
|
||||
# - netconf / restconf
|
||||
# - list / leaf-list
|
||||
|
||||
# Magic line must be first in script (see README.md)
|
||||
s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi
|
||||
|
||||
#max=2000 # Nr of db entries
|
||||
#step=200
|
||||
#reqs=500
|
||||
|
||||
# Global variables
|
||||
APPNAME=example
|
||||
cfg=$dir/plot-conf.xml
|
||||
fyang=$dir/plot.yang
|
||||
fconfig=$dir/config
|
||||
|
|
@ -15,7 +38,10 @@ fconfig=$dir/config
|
|||
clixon_netconf=clixon_netconf
|
||||
|
||||
cat <<EOF > $fyang
|
||||
module ietf-ip{
|
||||
module scaling{
|
||||
yang-version 1.1;
|
||||
namespace "urn:example:clixon";
|
||||
prefix sc;
|
||||
container x {
|
||||
list y {
|
||||
key "a";
|
||||
|
|
@ -34,23 +60,32 @@ module ietf-ip{
|
|||
EOF
|
||||
|
||||
cat <<EOF > $cfg
|
||||
<config>
|
||||
<clixon-config xmlns="http://clicon.org/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_RESTCONF_PRETTY>false</CLICON_RESTCONF_PRETTY>
|
||||
<CLICON_XMLDB_DIR>/usr/local/var/routing</CLICON_XMLDB_DIR>
|
||||
</config>
|
||||
<CLICON_YANG_DIR>$dir</CLICON_YANG_DIR>
|
||||
<CLICON_YANG_DIR>/usr/local/share/clixon</CLICON_YANG_DIR>
|
||||
<CLICON_YANG_MODULE_MAIN>scaling</CLICON_YANG_MODULE_MAIN>
|
||||
<CLICON_SOCK>/usr/local/var/$APPNAME/$APPNAME.sock</CLICON_SOCK>
|
||||
<CLICON_BACKEND_PIDFILE>/usr/local/var/example/$APPNAME.pidfile</CLICON_BACKEND_PIDFILE>
|
||||
<CLICON_RESTCONF_PRETTY>false</CLICON_RESTCONF_PRETTY>
|
||||
<CLICON_XMLDB_DIR>$dir</CLICON_XMLDB_DIR>
|
||||
<CLICON_XMLDB_PRETTY>false</CLICON_XMLDB_PRETTY>
|
||||
</clixon-config>
|
||||
EOF
|
||||
|
||||
run(){
|
||||
# Run function
|
||||
# args: <i> <reqs> <mode>
|
||||
# where mode is one of:
|
||||
# readlist writelist restreadlist restwritelist
|
||||
runfn(){
|
||||
nr=$1 # Number of entries in DB
|
||||
reqs=$2
|
||||
mode=$3
|
||||
operation=$3
|
||||
|
||||
echo -n "<rpc><edit-config><target><candidate/></target><default-operation>replace</default-operation><config><x>" > $fconfig
|
||||
# echo "runfn nr=$nr reqs=$reqs mode=$mode"
|
||||
|
||||
# new "generate config with $nr list entries"
|
||||
echo -n "<rpc><edit-config><target><candidate/></target><default-operation>replace</default-operation><config><x xmlns=\"urn:example:clixon\">" > $fconfig
|
||||
for (( i=0; i<$nr; i++ )); do
|
||||
case $mode in
|
||||
readlist|writelist|restreadlist|restwritelist)
|
||||
|
|
@ -64,100 +99,135 @@ run(){
|
|||
|
||||
echo "</x></config></edit-config></rpc>]]>]]>" >> $fconfig
|
||||
|
||||
# new "netconf write $nr entry to backend"
|
||||
expecteof_file "$clixon_netconf -qf $cfg -y $fyang" "$fconfig" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
case $mode in
|
||||
readlist)
|
||||
# new "netconf GET list $reqs"
|
||||
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
|
||||
;;
|
||||
writelist)
|
||||
writelist)
|
||||
# new "netconf WRITE list $reqs"
|
||||
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>]]>]]>"
|
||||
echo "<rpc><edit-config><target><candidate/></target><config><x xmlns=\"urn:example:clixon\"><y><a>$rnd</a><b>$rnd</b></y></x></config></edit-config></rpc>]]>]]>"
|
||||
done | $clixon_netconf -qf $cfg -y $fyang > /dev/null
|
||||
;;
|
||||
restreadlist)
|
||||
# new "restconf GET list $reqs"
|
||||
time -p for (( i=0; i<$reqs; i++ )); do
|
||||
rnd=$(( ( RANDOM % $nr ) ))
|
||||
curl -sSG http://localhost/restconf/data/x/y=$rnd,$rnd > /dev/null
|
||||
curl -sSG http://localhost/restconf/data/scaling:x/y=$rnd > /dev/null
|
||||
done
|
||||
;;
|
||||
writeleaflist)
|
||||
# new "netconf GET leaf-list $reqs"
|
||||
time -p for (( i=0; i<$reqs; i++ )); do
|
||||
rnd=$(( ( RANDOM % $nr ) ))
|
||||
echo "<rpc><edit-config><target><candidate/></target><config><x><c>$rnd</c></x></config></edit-config></rpc>]]>]]>"
|
||||
echo "<rpc><edit-config><target><candidate/></target><config><x xmlns=\"urn:example:clixon\"><c>$rnd</c></x></config></edit-config></rpc>]]>]]>"
|
||||
done | $clixon_netconf -qf $cfg -y $fyang > /dev/null
|
||||
;;
|
||||
esac
|
||||
# new "discard test"
|
||||
expecteof "$clixon_netconf -qf $cfg -y $fyang" "<rpc><discard-changes/></rpc>]]>]]>" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
}
|
||||
|
||||
step(){
|
||||
# Step
|
||||
# args: <i> <reqs> <mode>
|
||||
stepfn(){
|
||||
i=$1
|
||||
mode=$2
|
||||
reqs=$2
|
||||
mode=$3
|
||||
|
||||
>&2 echo "stepfn $mode: i=$i reqs=$reqs"
|
||||
echo -n "" > $fconfig
|
||||
t=$(TEST=%e run $i $reqs $mode 2>&1 | awk '/real/ {print $2}')
|
||||
#TEST=%e run $i $reqs $mode 2>&1
|
||||
t=$(TEST=%e runfn $i $reqs $mode 2>&1 | awk '/real/ {print $2}')
|
||||
#TEST=%e runfn $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.
|
||||
# write to gnuplot file: $dir/$mode
|
||||
echo "$i $p" >> $dir/$mode
|
||||
# echo "m:$mode i:$i t=$t p=$p"
|
||||
}
|
||||
|
||||
# Run once
|
||||
#args: <step> <reqs> <max>
|
||||
once(){
|
||||
# kill old backend (if any)
|
||||
sudo clixon_backend -zf $cfg -y $fyang
|
||||
if [ $? -ne 0 ]; then
|
||||
err
|
||||
# Input Parameters
|
||||
step=$1
|
||||
reqs=$2
|
||||
max=$3
|
||||
|
||||
echo "oncefn step=$step reqs=$reqs max=$max"
|
||||
new "test params: -f $cfg -y $fyang"
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "kill old backend"
|
||||
sudo clixon_backend -zf $cfg -y $fyang
|
||||
if [ $? -ne 0 ]; then
|
||||
err
|
||||
fi
|
||||
new "start backend -s init -f $cfg -y $fyang"
|
||||
start_backend -s init -f $cfg -y $fyang
|
||||
fi
|
||||
|
||||
# start new backend
|
||||
sudo clixon_backend -s init -f $cfg -y $fyang
|
||||
if [ $? -ne 0 ]; then
|
||||
err
|
||||
fi
|
||||
new "kill old restconf daemon"
|
||||
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||
|
||||
# Always as a start
|
||||
new "start restconf daemon"
|
||||
start_restconf -f $cfg -y $fyang
|
||||
|
||||
new "waiting"
|
||||
sleep $RCWAIT
|
||||
|
||||
new "Intial steps as start"
|
||||
for (( i=10; i<=$step; i=i+10 )); do
|
||||
step $i readlist
|
||||
step $i writelist
|
||||
step $i restreadlist
|
||||
step $i writeleaflist
|
||||
stepfn $i $reqs readlist
|
||||
stepfn $i $reqs writelist
|
||||
stepfn $i $reqs restreadlist
|
||||
stepfn $i $reqs writeleaflist
|
||||
done
|
||||
# Actual steps
|
||||
rnd=$(( ( RANDOM % $step ) ))
|
||||
echo "curl -sSG http://localhost/restconf/data/scaling:x/y=$rnd"
|
||||
curl -sSG http://localhost/restconf/data/scaling:x/y=$rnd
|
||||
exit
|
||||
new "Actual steps"
|
||||
for (( i=$step; i<=$max; i=i+$step )); do
|
||||
step $i readlist
|
||||
step $i writelist
|
||||
step $i restreadlist
|
||||
step $i writeleaflist
|
||||
stepfn $i $reqs readlist
|
||||
stepfn $i $reqs writelist
|
||||
stepfn $i $reqs restreadlist
|
||||
stepfn $i $reqs writeleaflist
|
||||
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"
|
||||
new "Kill restconf daemon"
|
||||
stop_restconf
|
||||
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=`pgrep -u root -f clixon_backend`
|
||||
if [ -z "$pid" ]; then
|
||||
err "backend already dead"
|
||||
fi
|
||||
# kill backend
|
||||
stop_backend -f $cfg
|
||||
fi
|
||||
}
|
||||
|
||||
once
|
||||
# step=200 reqs=500 max=2000
|
||||
once 200 500 1000
|
||||
|
||||
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
|
||||
set terminal x11 enhanced title "Clixon transactions " persist raise
|
||||
plot "$dir/readlist" with linespoints title "read list", "$dir/writelist" with linespoints title "write list", "$dir/writeleaflist" with linespoints title "write leaf-list" , "$dir/restreadlist" with linespoints title "rest get list"
|
||||
EOF
|
||||
|
||||
rm -rf $dir
|
||||
#rm -rf $dir
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue