From 5535239363cf9f0c6e86f9b43ca1b5b0bf367835 Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Mon, 30 Mar 2020 22:07:46 +0200 Subject: [PATCH] readd namespace cache --- lib/src/clixon_xml_nsctx.c | 6 ++--- test/test_perf_startup.sh | 49 +++++++++++++++++++++----------------- test/test_yang_default.sh | 2 +- 3 files changed, 31 insertions(+), 26 deletions(-) diff --git a/lib/src/clixon_xml_nsctx.c b/lib/src/clixon_xml_nsctx.c index 17dd2c21..0c24083a 100644 --- a/lib/src/clixon_xml_nsctx.c +++ b/lib/src/clixon_xml_nsctx.c @@ -458,12 +458,12 @@ xml2ns(cxobj *x, } #endif } -#if 0 /* Dont auto-populate all caches, eg startup doesnt need a cache */ /* Set default namespace cache (since code is at this point, - * no cache was found */ + * no cache was found + * If not, this is devastating when populating deep yang structures + */ if (ns && nscache_set(x, prefix, ns) < 0) goto done; -#endif ok: if (namespace) *namespace = ns; diff --git a/test/test_perf_startup.sh b/test/test_perf_startup.sh index 3632abf8..89bc48c2 100755 --- a/test/test_perf_startup.sh +++ b/test/test_perf_startup.sh @@ -12,24 +12,35 @@ APPNAME=example cfg=$dir/scaling-conf.xml fyang=$dir/scaling.yang +# NOTE, added a deep yang structure (x0,x1,x2) to expose performance due to turned off caching. cat < $fyang module scaling{ yang-version 1.1; namespace "urn:example:clixon"; prefix ip; - container x { - list y { - key "a"; - leaf a { - type int32; - } - leaf b { - type int32; - } - } - leaf-list c { - type string; - } + container "x0" { + container x1 { + list x2 { + key "name"; + leaf name { + type string; + } + container x { + list y { + key "a"; + leaf a { + type int32; + } + leaf b { + type int32; + } + } + leaf-list c { + type string; + } + } + } + } } } EOF @@ -65,11 +76,11 @@ fi # Use it latter to generate startup-db in xml, tree formats tmpx=$dir/tmp.xml new "generate large startup config ($tmpx) with $perfnr entries" -echo -n "" > $tmpx +echo -n "ip" > $tmpx for (( i=0; i<$perfnr; i++ )); do echo -n "$i$i" >> $tmpx done -echo "" >> $tmpx +echo "" >> $tmpx if false; then # XXX JSON dont work as datastore yet # Then generate large JSON file (cant translate namespace - long story) @@ -90,7 +101,7 @@ fi # Loop over mode and format for mode in startup running; do file=$dir/${mode}_db - for format in tree xml; do # json - something w namespaces + for format in xml; do # json - something w namespaces sudo rm -f $file sudo touch $file sudo chmod 666 $file @@ -102,17 +113,11 @@ for mode in startup running; do json) cp $tmpj $file ;; - tree) - echo "clixon_util_datastore -d ${mode} -f tree -y $fyang -b $dir -x $tmpx put create" - - clixon_util_datastore -d ${mode} -f tree -y $fyang -b $dir -x $tmpx put create - ;; esac new "Startup format: $format mode:$mode" # echo "time sudo $clixon_backend -F1 -D $DBG -s $mode -f $cfg -y $fyang -o CLICON_XMLDB_FORMAT=$format" # Cannot use start_backend here due to expected error case { time -p sudo $clixon_backend -F1 -D $DBG -s $mode -f $cfg -y $fyang -o CLICON_XMLDB_FORMAT=$format 2> /dev/null; } 2>&1 | awk '/real/ {print $2}' - done done diff --git a/test/test_yang_default.sh b/test/test_yang_default.sh index bf585303..51eeaa55 100755 --- a/test/test_yang_default.sh +++ b/test/test_yang_default.sh @@ -69,8 +69,8 @@ cat < $fyang } EOF +# No args testrun(){ - # Initial data (default y not given) XML='0'