You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by "Andreas Veithen (JIRA)" <ji...@apache.org> on 2007/12/23 23:46:43 UTC

[jira] Created: (SYNAPSE-211) Improve performance in XSLTMediator when temporary files are used

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: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org


[jira] Updated: (SYNAPSE-211) Improve performance in XSLTMediator when temporary files are used

Posted by "Asankha C. Perera (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SYNAPSE-211?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Asankha C. Perera updated SYNAPSE-211:
--------------------------------------

    Fix Version/s: 1.2

postponing to fix post 1.1.1

> 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
>             Fix For: 1.2
>
>
> 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: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org