In this guide, we provide some tips on how to increase best manage the performance of Smooks.
Like with a lot of most Software, wen treated wrong, Smooks can have a terrible performance. Wen treated right Smooks performance can increase dramaticallywhen configured/used incorrectly, performance can be one of the first things to suffer. Smooks is no different in this regard.
This guide is written with Smooks 1.1 in mind. However most tips probably also apply to older versions of Smooks.
|Table of Contents|
This part gives some performance tips of the Smooks core itself.
General performance Tips for Smooks:
- Cache and reuse the Smooks Object. Initialization of Smooks takes some time and there for therefore it is important that it is reused.
- Don't use the HTMLReportGenerator only during development. Wenn using Smooks in production it should be deactivated. The HTMLReportGenerator takes a lot of performance When enabled, the HTMLReportGenerator incurs a significant performance overhead and with large message, can cause even result in OutOfMemory exceptions.
- If possible use the SAX stream processor. However, you need to look if all the cartridges that you check that all Smooks Cartridges in use are SAX compatible. SAX processing is a lot faster then than DOM processing and has a consistent consistently small memory footprint. It is mandatory for processing large messages. (TODO: Explain how to activate it)See the Filtering Process Selection section.
- Contextual selectors can obviously have a negative effect on performance e.g. evaluating a match for a selector like "a/b/c/d/e" will obviously require more processing than that of a selector like "d/e". Obviously there will be situations where your data model will require deep selectors, but where it does not, you should try to remove them for the sake of performance.
Every cartridge can have its own performance optimizing optimization tips.
- If possible don't use the Virtual Bean Model. Create Beans instead of maps. Creating and adding data to Maps is a lot slower the creating simple POJO's and calling the setter methods.