Improve performance in XSLTMediator when temporary files are used
-----------------------------------------------------------------

                 Key: SYNAPSE-211
                 URL: https://issues.apache.org/jira/browse/SYNAPSE-211
             Project: Synapse
          Issue Type: Improvement
          Components: Core
    Affects Versions: 1.1, NIGHTLY
            Reporter: Andreas Veithen
            Priority: Minor


The XSLT mediator has a mechanism to stream the result of the transformation to 
a temporary file when its size exceeds some threshold (defined by 
BYTE_ARRAY_SIZE, which has a fixed value of 8192). However, when this happens, 
the transformation is actually triggered twice. During the first run, the 
result is sent to a FixedByteArrayOutputStream which will raise a 
SynapseException after the first 8192 bytes have been written. The 
transformation is then restarted using a FileOutputStream for the result. This 
is very bad for two reasons:

* It introduced an overhead (the first attempt to execute the transformation) 
for every large XML that is processed.
* It makes the choice of the threshold BYTE_ARRAY_SIZE difficult: a small value 
is bad for smaller XML documents (because temporary files are used where this 
is not necessary) but good for larger ones (because it reduces the overhead 
caused by the first transformation attempt); a large value is good for smaller 
XML documents (avoids temporary files) but bad for larger ones (increased 
overhead for the first transformation).

A better approach would be to have an OutputStream implementation that will 
first write to a byte array and once the threshold is exceeded transparently 
switches to a temporary file, so that the transformation is always run only 
once.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to