This documentation is for WSO2 Enterprise Service Bus version 4.9.0 . View documentation for the latest release.

All docs This doc
Skip to end of metadata
Go to start of metadata

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 fast XSLT and XSLT

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.


Always use the FastXSLT mediator instead of the default XSLT mediator for high performance implementations.

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 bigger.

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/ 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 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.

You can improve the performance of the XSLT mediator by allowing the use of more memory when processing large messages with the XSLT mediator.
For example if you know that your message size is going to be less than 512k (i.e., 16384 * 32), you can set the values of the above parameters as follows:


Then the XSLT transformation happens in memory without writing data to disk. Therefore, performance is increased.

Optimizing the fastXSLT Mediator

If you want to perform transformation on the original message, you can use the FastXSLT mediator. Any pre-processing that applies to the message payload is not be visible to the FastXSLT mediator as the transformation logic is applied to the message stream instead of the message payload.

If you cannot perform your transformation with the FastXSLT mediator, then it is recommended to write a custom class mediator to do your transformation, since it will be much faster than the XSLT mediator.

You can enable the FastXSLT mediator by following the steps below:

  • Add the following parameter in the <ESB_HOME>/repository/conf/ file to enable streaming XPath for fastXSLT mediator.

  • Configure the following parameters in the <ESB_HOME>/repository/conf/ file depending on the expected message size.



To enable the FastXSLT mediator, your XSLT script must include the following parameter in the XSL output.


For example,

<xsl:output method="xml" omit-xml-declaration="yes" encoding="UTF-8" indent="yes"/>
  • No labels