[ 
https://issues.apache.org/jira/browse/NIFI-14155?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

castile updated NIFI-14155:
---------------------------
    Attachment:     (was: image-2025-01-14-22-37-44-670.png)

> 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
>            Reporter: castile
>            Priority: Blocker
>              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
>
>
> 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)

Reply via email to