NIFI-2142 Cache compiled XSLT in TransformXml#609
NIFI-2142 Cache compiled XSLT in TransformXml#609jfrazee wants to merge 4 commits intoapache:masterfrom
Conversation
|
Hey @jfrazee, looks like you have contrib check issues that cause the build to fail: [WARNING] src/main/java/org/apache/nifi/processors/standard/TransformXml.java24:8 UnusedImports: Unused import - java.util.Collection. |
|
@JPercivall Oh, right. I think these are corrected now but just noticed the image bundle has a bunch of license violations (even after rebasing). |
|
@jfrazee the image bundle is no longer in master (replaced by the media bundle). Do a "git clean -i -d" to remove any old bundles. |
| .description("Maximum size of the stylesheet cache.") | ||
| .required(true) | ||
| .defaultValue("100") | ||
| .addValidator(StandardValidators.NON_NEGATIVE_INTEGER_VALIDATOR) |
There was a problem hiding this comment.
Is this property a max character length or data size limit?
There was a problem hiding this comment.
Also, this is a integer validator but the property is interpreted as a long on line 171
There was a problem hiding this comment.
Actually my new guess is that this is the maximum number of stylesheets stored (the description could be added to, lol)
There was a problem hiding this comment.
@JPercivall Yes, that's correct. So "Maximum number of stylesheets to store in the cache"?
|
@jfrazee I've made a couple comments. Looks good overall, mainly just documentation comments. Do you by chance have a template and/or some example xml/XSLT that I could use for testing to verify the changes? |
|
| CacheBuilder cacheBuilder = CacheBuilder.newBuilder().maximumSize(cacheSize); | ||
|
|
||
| if (cacheSize <= 0) { | ||
| logger.warn("Stylesheet cache disabled because cache size is set to 0"); |
There was a problem hiding this comment.
The cache will still be created and on line 213 it will try to use it to look up an xslt if the cache size is 0. I'd suggest not even creating it in that case.
|
@JPercivall Addressed your latest comments and added a test with the cache disabled since the logic varies depending on that value now. |
|
Sorry for taking so long @jfrazee, I got caught up with something I thought was an issue but turned out it was just me messing up. +1 Visually verified code, and did a contrib check build. In standalone and a secure 3 node cluster tested the caching using the provided template. Even with just 5 stylesheets being used I saw speed improvements of ~10x! Thanks @jfrazee, I will merge it in. |
Two other tidbits:
See #591 for PR against 0.x and past discussion.