[xep-support] XEP 371 multi-threading

From: Duncan, David (David.Duncan@bskyb.com)
Date: Tue Mar 02 2004 - 02:40:48 PST

  • Next message: Marc Oliver Thoma: "[xep-support] z-index not supportet"


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

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

    class DMSPrintPublisher {

            private static final Logger s_logger =
    Logger.getLogger(BatchPublishingClient.class); // log4j is thread-safe
            private static FOTransformer foTransformer;
            private FormatterImpl formatter;
        public DMSPrintPublisher(String template, Properties xepProps) throws
    CorrespondenceException {
            InputSource xsl = new InputSource();
            InputStream templateInputStream = new
            SAXSource saxSource = new SAXSource(xsl);
            try {
                    this.formatter = new FormatterImpl(xepProps,
                foTransformer = new FOTransformer(saxSource, formatter);

            } catch (Exception e) {
                throw new CorrespondenceException("Could not set up
    transformation engine: " + e.getMessage(), e);

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

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

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

    Many thanks for your support,


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

    (*) 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 02 2004 - 02:51:18 PST