Message Transformation is a common WSO2 ESB use case. When it comes to message transformations, you can use the FastXSLT mediator, XSLT mediator, Script mediator as well as the PayloadFactory mediator. This section describes different message transformation use cases and parameters you can configure for optimal performance.
Comparison of the fast XSLT mediator and the XSLT mediator
The FastXSLT Mediator and XSLT mediator can be used to do XSLT based message transformations in WSO2 ESB. Both mediators can be used to perform complex message transformations. The FastXSLT mediator has significant performance over the XSLT mediator as it uses the streaming XPath parser and applies the XSLT transformation to the message stream instead of applying it to the XML message payload, but with the FastXSLT mediator you cannot specify the source, properties, features, or resources as you can with the XSLT mediator.
Info | ||
---|---|---|
| ||
Always use the FastXSLT mediator instead of the default XSLT mediator for high better performance in implementations where the original message remains unmodified. In implementations where the message payload needs to be pre-processed, use the XSLT mediator instead of the FastXSLT mediator. Any pre-processing performed on the message payload is not be visible to the FastXSLT mediator, because the transformation logic is applied to the original message stream instead of the message payload. |
Optimizing the XSLT Mediator
In real world scenarios, you might come across use cases where you do pre-processing before doing the XSLT message transformation using the XSLT mediator. In such use cases, you have to use the XSLT mediator instead of the FastXSLT mediator. You can specify the source, properties, features, or resources with the XSLT mediator, but the downside with the XSLT mediator is that it does not perform well when the message size gets biggeris larger.
It is possible to tune the XSLT mediator configuration to perform better for large message sizes.
In the XSLT mediator, the following two parameters control the memory usage of the the server. These two parameters can be configured in the <ESB_HOME>/repository/conf/synapse.properties
file.
...
These parameters decide when to write to the file system when the message size is large. The default values for the parameters allow WSO2 ESB to process messages with the of size 3072*8 = 24K with the XSLT mediator without writing to the file system. This means that there is no performance drop in the XSLT mediator when the message size is less than 24K, but when the message size is larger than that, you see a clear performance degradation.
...