Hi, Raj. Rajesh Jain <[EMAIL PROTECTED]> wrote on 2008-04-14 02:56:17 PM: > We have a production system, which has hit performance issues in load. The > current configuration is below > > The CPU spikes to 95% usage at 30+ concurrent users trying to access web > pages which are XSL rendered from XML. > > Are there any optimization techniques I need to go for (XPATH, Templates > done)
It's very difficult to give specific advice about optimization techniques without knowing more about where your performance problems are coming from. Yes, you should ensure that you're using Templates so that a stylesheet is compiled just once. It's also usually better to reuse Transformer objects if you can, rather than creating a new one from a Templates object everytime. Where does the XML input come from? Does every transformation involve parsing an input document or is the XML presented in the form of a DOM tree or SAX events? If you're parsing input documents each time, there are a variety of system properties that you can set that might help if you're not reusing factory classes - there's a lot of overhead involved in creating a new parser every time, including time spent searching the class path for configuration files. -Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XIncludeAwareParserConfiguration -Djavax.xml.xpath.XPathFactory=org.apache.xpath.jaxp.XPathFactoryImpl -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl You also mention XPath. Are you using one of the XPath APIs or are you just speaking of the XPath expressions within your stylesheets? The XPath APIs have their own performance challenges. > How to choose XSLTC as a transformer, I believe it uses XSLTC...but would > like to confirm. > Are there any flags in the XSLT transformer to profile which sections are > taking more time There are a few ways of specifying the XSLT processor to use. One way is to set the javax.xml.transform.TransformerFactory system property with the value "org.apache.xalan.xsltc.trax.TransformerFactoryImpl". You should be able to verify which XSLT implementation you're actually using by calling the toString() method on a TransformerFactory, Templates or Transformer object and logging that result. There aren't any specific flags in the either of the Xalan-Java processors that will produce statistics about the amount of time spent in different parts of the processing. Instead you'll have to use a general-purpose Java profiling tool to investigate further. Please share any results if you'd like some further advice. Thanks, Henry ------------------------------------------------------------------ Henry Zongaro XML Transformation & Query Development IBM Toronto Lab T/L 313-6044; Phone +1 905 413-6044 mailto:[EMAIL PROTECTED]
