[
https://issues.apache.org/jira/browse/NIFI-14155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17914680#comment-17914680
]
ASF subversion and git services commented on NIFI-14155:
--------------------------------------------------------
Commit 5cd52bbc7975e5bced6d79a993228621edd23b66 in nifi's branch
refs/heads/main from David Handermann
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=5cd52bbc797 ]
NIFI-14155 Improved ObjectMapper handling in TokenParserFactory
- Refactored TokenParserFactory interface to accept InputStream without
configuration parameters
- Avoided unnecessary ObjectMapper creation in JsonParserFactory
Signed-off-by: Pierre Villard <[email protected]>
This closes #9648.
> JsonParserFactory will create an new ObjectMapper when process every
> flowfile, and the performance drops by more than 50%.
> --------------------------------------------------------------------------------------------------------------------------
>
> Key: NIFI-14155
> URL: https://issues.apache.org/jira/browse/NIFI-14155
> Project: Apache NiFi
> Issue Type: Bug
> Components: Core Framework, Examples
> Affects Versions: 1.26.0, 2.1.0
> Reporter: castile
> Assignee: David Handermann
> Priority: Critical
> Labels: Record, json, performance
> Attachments: image-2025-01-14-22-32-30-460.png,
> image-2025-01-14-22-39-57-860.png, image-2025-01-14-22-41-56-719.png
>
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> Our team is using nifi1.26.0. When using UpdateRecord processor or other
> processor sets that inherit
> org.apache.nifi.processors.standard.AbstractRecordProcessor, we found that
> its processing performance dropped by more than 50%. After our analysis, we
> found that in the Parser object created by
> org.apache.nifi.json.JsonParserFactory, an ObjectMapper object is created
> when processing each data, which consumes a lot of performance.
> !image-2025-01-14-22-32-30-460.png|width=522,height=258!
>
> ObjectMapper is a *{color:#ff0000}heavyweight{color}* object and is
> {color:#ff0000}*thread-safe*{color}. It seems that a static global or
> singleton instance should be created.
> We have run the performance tests and found that it was useful,here is the
> compare results:
> BEFORE:
> !image-2025-01-14-22-41-56-719.png|width=447,height=120!
> AFTER:
> !image-2025-01-14-22-39-57-860.png|width=631,height=172!
> When each JSON data is large, the gap will be more obvious!!!!
> ------------------------------------------------------------------------
> *{color:#ff0000}No matter what,the ObjectMapper object should be unique in
> the controller service(For example, JsonTreeReader
> ),and should not be created when processing each flowfile.{color}*
--
This message was sent by Atlassian Jira
(v8.20.10#820010)