You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/08/26 10:59:43 UTC
[GitHub] [flink] shuttie opened a new pull request #13250: [FLINK-19052] [serialization] add constructor cache in PojoSerializer
shuttie opened a new pull request #13250:
URL: https://github.com/apache/flink/pull/13250
## What is the purpose of the change
Currently PojoSerializer.createInstance() uses reflection call to create a class instance. As this method is called on each stream element on deserialization, reflection overhead can become noticeable in serialization-bound cases when:
* Pojo class is small, so instantiation is noticeable.
* The job is not having heavy CPU-bound event processing.
See this flamegraph built for flink-benchmarks/SerializationFrameworkMiniBenchmarks.serializerPojo benchmark:

This Reflection.getCallerClass method consumes a lot of CPU, mostly doing a security check if we allowed to do this reflective call.
There is no true reason to perform this check on each deserializing event, so to speed things up we can just cache the constructor using MetaHandle, so this check will be performed only once. With this tiny fix, the getCallerClass is gone:

The benchmark result:
```
serializerPojo thrpt 100 487.706 ± 30.480 ops/ms
serializerPojo thrpt 100 569.828 ± 8.815 ops/m
```
Which is +15% to throughput.
## Brief change log
- add constructor cache in PojoSerializer
## Verifying this change
This change is already covered by existing tests, such as *PojoSerializerTest*.
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): no
- The public API, i.e., is any changed class annotated with `@Public(Evolving)`: no
- The serializers: *yes*
- The runtime per-record code paths (performance sensitive): *yes*
- Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: no
- The S3 file system connector: no
## Documentation
- Does this pull request introduce a new feature? no
- If yes, how is the feature documented? not applicable
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] aljoscha commented on pull request #13250: [FLINK-19052] [serialization] add constructor cache in PojoSerializer
Posted by GitBox <gi...@apache.org>.
aljoscha commented on pull request #13250:
URL: https://github.com/apache/flink/pull/13250#issuecomment-681795409
Thanks for the analysis and the fix! 👍 I'm merging.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot commented on pull request #13250: [FLINK-19052] [serialization] add constructor cache in PojoSerializer
Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #13250:
URL: https://github.com/apache/flink/pull/13250#issuecomment-680811190
Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
to review your pull request. We will use this comment to track the progress of the review.
## Automated Checks
Last check on commit 600f787ad76169c8c7500f9e9c25732c8b2cdd0c (Wed Aug 26 11:02:49 UTC 2020)
**Warnings:**
* No documentation files were touched! Remember to keep the Flink docs up to date!
* **This pull request references an unassigned [Jira ticket](https://issues.apache.org/jira/browse/FLINK-19052).** According to the [code contribution guide](https://flink.apache.org/contributing/contribute-code.html), tickets need to be assigned before starting with the implementation work.
<sub>Mention the bot in a comment to re-run the automated checks.</sub>
## Review Progress
* ❓ 1. The [description] looks good.
* ❓ 2. There is [consensus] that the contribution should go into to Flink.
* ❓ 3. Needs [attention] from.
* ❓ 4. The change fits into the overall [architecture].
* ❓ 5. Overall code [quality] is good.
Please see the [Pull Request Review Guide](https://flink.apache.org/contributing/reviewing-prs.html) for a full explanation of the review process.<details>
The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required <summary>Bot commands</summary>
The @flinkbot bot supports the following commands:
- `@flinkbot approve description` to approve one or more aspects (aspects: `description`, `consensus`, `architecture` and `quality`)
- `@flinkbot approve all` to approve all aspects
- `@flinkbot approve-until architecture` to approve everything until `architecture`
- `@flinkbot attention @username1 [@username2 ..]` to require somebody's attention
- `@flinkbot disapprove architecture` to remove an approval you gave earlier
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] pnowojski commented on pull request #13250: [FLINK-19052] [serialization] add constructor cache in PojoSerializer
Posted by GitBox <gi...@apache.org>.
pnowojski commented on pull request #13250:
URL: https://github.com/apache/flink/pull/13250#issuecomment-686336499
We have found some issue with this PR and we are considering reverting it, more information in FLINK-19086
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot commented on pull request #13250: [FLINK-19052] [serialization] add constructor cache in PojoSerializer
Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #13250:
URL: https://github.com/apache/flink/pull/13250#issuecomment-680815453
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "600f787ad76169c8c7500f9e9c25732c8b2cdd0c",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "600f787ad76169c8c7500f9e9c25732c8b2cdd0c",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 600f787ad76169c8c7500f9e9c25732c8b2cdd0c UNKNOWN
<details>
<summary>Bot commands</summary>
The @flinkbot bot supports the following commands:
- `@flinkbot run travis` re-run the last Travis build
- `@flinkbot run azure` re-run the last Azure build
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] aljoscha merged pull request #13250: [FLINK-19052] [serialization] add constructor cache in PojoSerializer
Posted by GitBox <gi...@apache.org>.
aljoscha merged pull request #13250:
URL: https://github.com/apache/flink/pull/13250
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot edited a comment on pull request #13250: [FLINK-19052] [serialization] add constructor cache in PojoSerializer
Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13250:
URL: https://github.com/apache/flink/pull/13250#issuecomment-680815453
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "600f787ad76169c8c7500f9e9c25732c8b2cdd0c",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5885",
"triggerID" : "600f787ad76169c8c7500f9e9c25732c8b2cdd0c",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 600f787ad76169c8c7500f9e9c25732c8b2cdd0c Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5885)
<details>
<summary>Bot commands</summary>
The @flinkbot bot supports the following commands:
- `@flinkbot run travis` re-run the last Travis build
- `@flinkbot run azure` re-run the last Azure build
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot edited a comment on pull request #13250: [FLINK-19052] [serialization] add constructor cache in PojoSerializer
Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13250:
URL: https://github.com/apache/flink/pull/13250#issuecomment-680815453
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "600f787ad76169c8c7500f9e9c25732c8b2cdd0c",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5885",
"triggerID" : "600f787ad76169c8c7500f9e9c25732c8b2cdd0c",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 600f787ad76169c8c7500f9e9c25732c8b2cdd0c Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5885)
<details>
<summary>Bot commands</summary>
The @flinkbot bot supports the following commands:
- `@flinkbot run travis` re-run the last Travis build
- `@flinkbot run azure` re-run the last Azure build
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org