Re[2]: [xep-support] XEP 371 multi-threading

From: Alexander Peshkov (peshkov@renderx.com)
Date: Tue Mar 09 2004 - 00:29:10 PST

  • Next message: Olexij Tkatchenko: "[xep-support] Embedding SVG created with OpenOffice.org formula editor"

    Hello David,

    DD> Hi,

    DD> I have another performance question. In regard to my previous email
    DD> concerning multi-threading, i have discovered that using Oracle OCI driver
    DD> causes problems in a muli-threaded application. I believe this is the main
    DD> cause for my performance issues and not the xep driver. However i have a
    DD> question regarding xep internal transformation step. I use xep to transform
    DD> an xml file to xsl-fo and then render the pdf, so i use xep to perform 2
    DD> steps. I was wondering if performance gains could be achieved by separating
    DD> out the transform step? Perhaps I could use Xalan or Saxon to do the
    DD> transform and pass xep the xslfo to render? I beleive xep uses JAXP...and
    DD> maybe using another transformation engine (with freedom to optimise the
    DD> engine) woudl help.
    <skip/>

    As you noticed, for XSLT transformation XEP utilize JAXP aware XSLT
    processor available in classpath. We ship XEP with Saxon therefor it
    will be used as transformer in the default configuration. Regarding
    transformation performance - the fastest XSLT processor I'm aware of
    is XT. Unfortunately it's not JAXP-compatible so you can't plug it
    directly instead of Saxon, but forced to write some code. In general,
    separation of XSLT transformation step can be feasible if you can
    re-use something as a result. E.g. if you have sets of similar but
    complicated documents you may want to have two transformation steps:
    first create a "template" document for the whole set and when use
    short XSLT transformation for each instance before actual rendering.
    Clearly any optimizations of this sort depend on the nature of the
    documents being processed.

    DD> Thanks,
    DD> David.

    Best regards,
    Alexander Peshkov mailto:peshkov@renderx.com
    RenderX

    DD> -----Original Message-----
    DD> From: owner-xep-support@renderx.com
    DD> [mailto:owner-xep-support@renderx.com]On Behalf Of Duncan, David
    DD> Sent: Tuesday, March 02, 2004 10:41 AM
    DD> To: 'xep-support@renderx.com'
    DD> Subject: [xep-support] XEP 371 multi-threading

    DD> Hi,

    DD> I am having a major performance problem when upgraded to xep 371. I may
    DD> have amde some code errors which ill investigate, but my initial finding
    DD> appear to show problems with multi-threading on a mulitiple cpu machine.
    DD> Basically i launch a single JVM which initialises XEP bu loading XEP system
    DD> properties and by calling com.renderx.xep.gen.backends.H4PDF.init().

    DD> Then ,multiple threads are spawned each creating a PrintPublisher class
    DD> (note this is a publisher per xsl file. ie we cache the print publisher
    DD> object for multiple transforms using the same xsl template),

    DD> class DMSPrintPublisher {

    DD> private static final Logger s_logger =
    DD> Logger.getLogger(BatchPublishingClient.class); // log4j is thread-safe
    DD> private static FOTransformer foTransformer;
    DD> private FormatterImpl formatter;
            
    DD> public DMSPrintPublisher(String template, Properties xepProps) throws
    DD> CorrespondenceException {
    DD> InputSource xsl = new InputSource();
    DD> InputStream templateInputStream = new
    DD> ByteArrayInputStream(template.getBytes());
    DD> xsl.setByteStream(templateInputStream);
    DD> SAXSource saxSource = new SAXSource(xsl);
            
    DD> try {
    DD> this.formatter = new FormatterImpl(xepProps,
    DD> com.renderx.xep.lib.Logger.NULL_LOGGER);
    DD> foTransformer = new FOTransformer(saxSource, formatter);
    DD> foTransformer.setLogger(com.renderx.xep.lib.Logger.NULL_LOGGER);

    DD> foTransformer.setParameter("signature_location",
    DD> System.getProperty(DMSConstants.SIGNATURE_LOCATION));
                    
    DD> } catch (Exception e) {
    DD> throw new CorrespondenceException("Could not set up
    DD> transformation engine: " + e.getMessage(), e);
    DD> }

    DD> public void publish(String documentData, OutputStream dest) throws
    DD> PublishException {
    DD> try {
    DD> InputStream dataInputStream = new
    DD> ByteArrayInputStream(documentData.getBytes());
    DD> StreamSource xml = new StreamSource(dataInputStream);
    DD> FOTarget foTarget = new FOTarget(dest, "PDF");
    DD> foTransformer.transform(xml, foTarget);
    DD> dataInputStream.close();
    DD> dest.close();
    DD> formatter.cleanup();
    DD> } catch (Exception exc) {
    DD> throw new PublishException(ErrorCodes.RECOVERABLE_SYSTEM_ERROR,
    DD> "Failed to perform transform: " + exc.getMessage(), exc);
    DD> }
    DD> }
    DD> }

    DD> My main concern is that when using xep 361 interface we saw the
    DD> multi-threaded process being shared across a 4 cpu unix box (running
    DD> Solaris8). However, using xep371 (along with code changes due to new
    DD> interface), we see 1 cpu maxed out and the rest idle. This reduces
    DD> performance by 4 fold.

    DD> Perhaps I have made some errors in coding the publisher...maybe I should
    DD> create one FOTransformer (initialised by xep properties) instead of 1 for
    DD> each publisher object? Bu this seems to be a side issue. Are you aware of
    DD> any potential multi-threading issues with the new version of xep?

    DD> Many thanks for your support,

    DD> David.

    DD> -----------------------------------------------------------------------
    DD> Information in this email may be privileged, confidential and is
    DD> intended exclusively for the addressee. The views expressed may
    DD> not be official policy, but the personal views of the originator.
    DD> If you have received it in error, please notify the sender by return
    DD> e-mail and delete it from your system. You should not reproduce,
    DD> distribute, store, retransmit, use or disclose its contents to anyone.
     
    DD> Please note we reserve the right to monitor all e-mail
    DD> communication through our internal and external networks.
    DD> -----------------------------------------------------------------------

    DD> -------------------
    DD> (*) To unsubscribe, send a message with words 'unsubscribe xep-support'
    DD> in the body of the message to majordomo@renderx.com from the address
    DD> you are subscribed from.
    DD> (*) By using the Service, you expressly agree to these Terms of Service
    DD> http://www.renderx.com/tos.html

    DD> .
    DD> -------------------
    DD> (*) To unsubscribe, send a message with words 'unsubscribe xep-support'
    DD> in the body of the message to majordomo@renderx.com from the address
    DD> you are subscribed from.
    DD> (*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/tos.html

    -------------------
    (*) To unsubscribe, send a message with words 'unsubscribe xep-support'
    in the body of the message to majordomo@renderx.com from the address
    you are subscribed from.
    (*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/tos.html



    This archive was generated by hypermail 2.1.5 : Tue Mar 09 2004 - 00:36:18 PST