Parse Xml Netconf msgs without defer-node-expansion option 79/18579/1
authorMaros Marsalek <mmarsale@cisco.com>
Fri, 17 Apr 2015 11:46:21 +0000 (13:46 +0200)
committerMaros Marsalek <mmarsale@cisco.com>
Sat, 18 Apr 2015 12:58:50 +0000 (14:58 +0200)
The defer-node-expansion expands inner nodes on traversal, but its suitable for
bigger xmls (100k bytes) and messages that are not fully traversed. This is not
the case with incomming netconf rpc.

Source:
https://xerces.apache.org/xerces2-j/faq-performance.html

Tested:
Netconf server pipeline performance was improved by 5-6%

Change-Id: I3bd4b917841f0ebe212ff753d6e0f655d618968c
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/XmlUtil.java

index 4ae65f3..6408fce 100644 (file)
@@ -55,6 +55,9 @@ public final class XmlUtil {
             factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
             factory.setXIncludeAware(false);
             factory.setExpandEntityReferences(false);
+            // Performance improvement for messages with size <10k according to
+            // https://xerces.apache.org/xerces2-j/faq-performance.html
+            factory.setFeature("http://apache.org/xml/features/dom/defer-node-expansion", false);
         } catch (ParserConfigurationException e) {
             throw new ExceptionInInitializerError(e);
         }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.