Performance Tips and Tricks

Experience and tests using the Tamino API for Java in conjunction with Software AG's Tamino XML Server have brought to light some aspects that we would like to share with our customers. Awareness of the following tips and tricks can considerably improve the performance of an application based on the Tamino API for Java.


Using Cursoring

When using cursoring, find a good compromise for the cursor size (pagesize). A small cursor size requires a lot of requests to be sent to Tamino and therefore slows down the processing. A large cursor size locks a lot of memory on the client. Typically there is a certain size that you can find in practical tests, where an increase in cursor size does not speed up the whole process any more. Make practical tests, since changing the cursor size can make a big difference if you walk through a long result set.

Using XML Parsers

  • While competing and new XML parsers like Piccolo (from Sourceforge) or XPP promise improved performance times, we were not able to measure a significant difference. XPP also requires you to switch to another object model for representing your documents (XmlNodes), which makes it not recommendable for most cases. Xerces, as a parser, is used for DOM and JDOM. DOM and JDOM perform on the same level. Sometimes one is better, sometimes the other, if we look at the performance of the creation process for new nodes in the object model.

  • Xerces and DOM use the not very well known feature of deferred node creation. That means that sub nodes are only created when they are accessed. This feature is ON by default and it is not possible to see from the API which nodes actually have already been created. However, while this is a big advantage when reading large documents (with a lot of nodes) without actually accessing every node, it turns into a disadvantage once you touch the nodes because then they are created and consequently more time is needed.

Using Large XML Documents with Many Nodes

  • When reading documents with a large number of individual nodes, even if you do not need to read all the nodes, it is helpful when the document can only be partially parsed and the complete document object model is only built when needed.

  • Xerces uses a feature called deferred node creation, which means that while using the regular DOM interface, node levels below the current level are only created when the client tries to access them.

  • Pull parsers require some more work from the client programmer, but they also support modes where the nodes are either transparently built as the client accesses the data (similar to deferred nodes creation in Xerces) or where events are read (similar to the SAX interface).