Hi Matthias,
Op 25 nov. 2011, om 11:25 heeft [email protected] het volgende geschreven: > > I'm running a Cocoon 2.2 Webapp on a Tomcat 7 Server and facing some > performance issues. > I do some aggregations of large xml files, transform them multiple times and > finally serialize the streams to pdf that could contain > 1000 pages. These > input xml files grew over the last years and so did the output. For that I > had to adjust the jvm settings again and again. Since we're running Tomcat in > an 32bit environment I now reached the max of 1600 mb of memory that could be > allocated for the jvm. Now my Cocoon sometimes quits with Java Heap Space > issues. > I ended up reproducing my Cocoon tasks sporadically with Ant. And I wonder: > the whole process is about 3 times faster than with Cocoon on Tomcat, on a > less powerful machine! The needed memory is also about the half of the memory > that is needed by Cocoon on Tomcat. > Is this a Tomcat issue? With Ant I always have to serialize the XML that I > produce with each step, whereas with Cocoon I hold a XML Stream in the > memory. Is that the problem? > > Any ideas, experiences, alternatives are much appreciated > > Matthias my guess is that it is not so much a Tomcat issue as it is a serialization issue. As you say, Cocoon needs to hold the document in memory. Every XSLT translation that you do requires the XSLT processor to process all SAX events, make them into a tree that is processable, do the transformation and send the result as SAX events to the next transformer, that builds up a tree again, etc… At least, that's my understanding - I have been known to be wrong at times ;-). If your documents are getting too large to process I can think of three things you can do: 1 Use the MultiFragmentTraxTransformer from the cocooncomponents project in Google Code, it is handy when you want process repeating elements in a document - the XSLT processor will only build a tree for these repeating elements one at a time, not for the entire document. 2 Use the STX transformer. STX is a streaming transformation language, less powerful than XSLT, but sufficient for a whole lot of use cases. Joost provides the implementation. 3 Use the streaming features of XSLT 3.0 - Saxon is your best bet. Hartelijke groet, Huib Verweij
