Move the PoolThreadCache finalizer to a separate object#13510
Merged
normanmaurer merged 2 commits intonetty:4.1from Jul 24, 2023
Merged
Move the PoolThreadCache finalizer to a separate object#13510normanmaurer merged 2 commits intonetty:4.1from
normanmaurer merged 2 commits intonetty:4.1from
Conversation
…/normal caches (netty#13408)" This reverts commit 9412424
Motivation: PoolThreadCache objects are created even when they are not meant to pool anything. In such a case, there is no point in giving them a finalizer() method. Modification: The finalizer method is moved to a separate object, which is conditionally referenced from the PoolThreadCache. Non-pooling PoolThreadCache objects will not create their FreeOnFinalize objects. This is an alternative implementation to netty#13408, which is also reverted by this PR. Additionally, netty#13408 added a condition to create non-caching PoolThreadCache when the size of the small and normal caches were zero. However, it turned out that even when these were requested to be zero, a single-element cache would be created for them. This PR also reverts the logic to the old behaviour with the single-element cache for small and normal sizes. Result: We avoid creating finalizable objects when we don't pool.
Member
Author
|
@franz1981 @ejona86 I think this should give us the new behavior with the old performance. |
Contributor
|
FYI @ejona86 |
normanmaurer
approved these changes
Jul 24, 2023
Member
normanmaurer
left a comment
There was a problem hiding this comment.
LGTM... @ejona86 would it be possible for you to verify ?
Member
|
@chrisvest thanks a lot! Nice one |
Member
|
Oh, you noticed and moved fast. Excellent! I was going to dig a bit more to figure out how it caused the regression before I filed an issue, because it looked pretty 1:1 with the old behavior to me. I'll re-run the benchmarks with this and see how things fair. |
Member
|
I've confirmed this fixes the performance regression. From grpc's local benchmark (see also grpc/grpc-java#10401): |
This was referenced Jul 28, 2023
lidavidm
pushed a commit
to apache/arrow
that referenced
this pull request
Jul 28, 2023
#36926) When I used `netty arrow memory 13.0.0` and `netty 4.1.96.Final` in Spark, the following error occurred, Because `netty 4.1.96.Final` version has revert some modifications, in order to ensure that `netty arrow memory 13.0.0` works well with ``netty 4.1.96.Final`` version, I suggest making similar modifications here. 1.Compilation errors are as follows: https://ci.appveyor.com/project/ApacheSoftwareFoundation/spark/builds/47657403 <img width="955" alt="image" src="https://github.com/apache/arrow/assets/15246973/e7ee2da9-97c0-474c-a62d-5821858e361f"> 2.Some modifications have been reverted in `netty 4.1.96.Final` as follows: <img width="884" alt="image" src="https://github.com/apache/arrow/assets/15246973/0226685a-cfa3-4b8b-b114-23ad8d027c05"> <img width="907" alt="image" src="https://github.com/apache/arrow/assets/15246973/a6ea21a0-8531-42b6-ab9d-25eaab1c7fde"> https://netty.io/news/2023/07/27/4-1-96-Final.html netty/netty#13510 * Closes: #36928 Authored-by: panbingkun <[email protected]> Signed-off-by: David Li <[email protected]>
raulcd
pushed a commit
to apache/arrow
that referenced
this pull request
Jul 28, 2023
#36926) When I used `netty arrow memory 13.0.0` and `netty 4.1.96.Final` in Spark, the following error occurred, Because `netty 4.1.96.Final` version has revert some modifications, in order to ensure that `netty arrow memory 13.0.0` works well with ``netty 4.1.96.Final`` version, I suggest making similar modifications here. 1.Compilation errors are as follows: https://ci.appveyor.com/project/ApacheSoftwareFoundation/spark/builds/47657403 <img width="955" alt="image" src="https://github.com/apache/arrow/assets/15246973/e7ee2da9-97c0-474c-a62d-5821858e361f"> 2.Some modifications have been reverted in `netty 4.1.96.Final` as follows: <img width="884" alt="image" src="https://github.com/apache/arrow/assets/15246973/0226685a-cfa3-4b8b-b114-23ad8d027c05"> <img width="907" alt="image" src="https://github.com/apache/arrow/assets/15246973/a6ea21a0-8531-42b6-ab9d-25eaab1c7fde"> https://netty.io/news/2023/07/27/4-1-96-Final.html netty/netty#13510 * Closes: #36928 Authored-by: panbingkun <[email protected]> Signed-off-by: David Li <[email protected]>
xxlaykxx
added a commit
to dremio/arrow
that referenced
this pull request
Jul 30, 2023
… 4.1.96 (apache#36926) (#40) When I used `netty arrow memory 13.0.0` and `netty 4.1.96.Final` in Spark, the following error occurred, Because `netty 4.1.96.Final` version has revert some modifications, in order to ensure that `netty arrow memory 13.0.0` works well with ``netty 4.1.96.Final`` version, I suggest making similar modifications here. 1.Compilation errors are as follows: https://ci.appveyor.com/project/ApacheSoftwareFoundation/spark/builds/47657403 <img width="955" alt="image" src="https://github.com/apache/arrow/assets/15246973/e7ee2da9-97c0-474c-a62d-5821858e361f"> 2.Some modifications have been reverted in `netty 4.1.96.Final` as follows: <img width="884" alt="image" src="https://github.com/apache/arrow/assets/15246973/0226685a-cfa3-4b8b-b114-23ad8d027c05"> <img width="907" alt="image" src="https://github.com/apache/arrow/assets/15246973/a6ea21a0-8531-42b6-ab9d-25eaab1c7fde"> https://netty.io/news/2023/07/27/4-1-96-Final.html netty/netty#13510 * Closes: apache#36928 Authored-by: panbingkun <[email protected]> Signed-off-by: David Li <[email protected]> Co-authored-by: panbingkun <[email protected]>
Closed
loicalleyne
pushed a commit
to loicalleyne/arrow
that referenced
this pull request
Nov 13, 2023
… 4.1.96 (apache#36926) When I used `netty arrow memory 13.0.0` and `netty 4.1.96.Final` in Spark, the following error occurred, Because `netty 4.1.96.Final` version has revert some modifications, in order to ensure that `netty arrow memory 13.0.0` works well with ``netty 4.1.96.Final`` version, I suggest making similar modifications here. 1.Compilation errors are as follows: https://ci.appveyor.com/project/ApacheSoftwareFoundation/spark/builds/47657403 <img width="955" alt="image" src="https://github.com/apache/arrow/assets/15246973/e7ee2da9-97c0-474c-a62d-5821858e361f"> 2.Some modifications have been reverted in `netty 4.1.96.Final` as follows: <img width="884" alt="image" src="https://github.com/apache/arrow/assets/15246973/0226685a-cfa3-4b8b-b114-23ad8d027c05"> <img width="907" alt="image" src="https://github.com/apache/arrow/assets/15246973/a6ea21a0-8531-42b6-ab9d-25eaab1c7fde"> https://netty.io/news/2023/07/27/4-1-96-Final.html netty/netty#13510 * Closes: apache#36928 Authored-by: panbingkun <[email protected]> Signed-off-by: David Li <[email protected]>
kou
pushed a commit
to apache/arrow-java
that referenced
this pull request
Nov 25, 2024
…6 (#36926) When I used `netty arrow memory 13.0.0` and `netty 4.1.96.Final` in Spark, the following error occurred, Because `netty 4.1.96.Final` version has revert some modifications, in order to ensure that `netty arrow memory 13.0.0` works well with ``netty 4.1.96.Final`` version, I suggest making similar modifications here. 1.Compilation errors are as follows: https://ci.appveyor.com/project/ApacheSoftwareFoundation/spark/builds/47657403 <img width="955" alt="image" src="https://github.com/apache/arrow/assets/15246973/e7ee2da9-97c0-474c-a62d-5821858e361f"> 2.Some modifications have been reverted in `netty 4.1.96.Final` as follows: <img width="884" alt="image" src="https://github.com/apache/arrow/assets/15246973/0226685a-cfa3-4b8b-b114-23ad8d027c05"> <img width="907" alt="image" src="https://github.com/apache/arrow/assets/15246973/a6ea21a0-8531-42b6-ab9d-25eaab1c7fde"> https://netty.io/news/2023/07/27/4-1-96-Final.html netty/netty#13510 * Closes: #36928 Authored-by: panbingkun <[email protected]> Signed-off-by: David Li <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation:
PoolThreadCache objects are created even when they are not meant to pool anything.
In such a case, there is no point in giving them a finalizer() method.
Modification:
The finalizer method is moved to a separate object, which is conditionally referenced from the PoolThreadCache.
Non-pooling PoolThreadCache objects will not create their FreeOnFinalize objects.
This is an alternative implementation to #13408, which is also reverted by this PR.
Additionally, #13408 added a condition to create non-caching PoolThreadCache when the size of the small and normal caches were zero.
However, it turned out that even when these were requested to be zero, a single-element cache would be created for them.
This PR also reverts the logic to the old behaviour with the single-element cache for small and normal sizes.
Result:
We avoid creating finalizable objects when we don't pool.