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

ASF GitHub Bot updated FLINK-39300:
-----------------------------------
    Labels: pull-request-available  (was: )

>   [flink-cdc] Reuse ObjectMapper as static constant to avoid repeated 
> instantiation
> -----------------------------------------------------------------------------------
>
>                 Key: FLINK-39300
>                 URL: https://issues.apache.org/jira/browse/FLINK-39300
>             Project: Flink
>          Issue Type: Improvement
>          Components: Flink CDC
>    Affects Versions: cdc-3.5.0
>            Reporter: ericzeng
>            Priority: Minor
>              Labels: pull-request-available
>
>  *Motivation*
>   `ObjectMapper` (Jackson) is expensive to construct — it triggers 
> reflection-based
>   module discovery, codec registry initialization, and other setup work on 
> every
>   instantiation. It is also fully thread-safe once configured, making it an 
> ideal
>   candidate for a shared static constant.
>   Currently, two classes in the mysql-cdc connector create a new 
> `ObjectMapper`
>   instance on every method call:
>   - `BinlogOffsetSerializer`: both `serialize()` and `deserialize()` 
> instantiate a
>     new `ObjectMapper` each time. Since this class is used as a singleton 
> (`INSTANCE`),
>     these methods can be called at high frequency during snapshot and binlog 
> reading,
>     making the repeated allocation particularly wasteful.
>   - `OnlineSchemaChangeUtils`: both `isOnLineSchemaChangeEvent()` and
>     `parseOnLineSchemaRenameEvent()` instantiate a new `ObjectMapper` each 
> time they
>     are invoked to parse DDL statements.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to