Disable the Netty recycler and pooled allocator

Netty plays a lot of games with recycling byte buffers in thread local
caches, and using a pooled byte buffer allocator to reduce pressure on
the garbage collector.

The recycler in particular appears to be fraught with peril. It appears
that there are circumstances where the recycler does not recycle quickly
enough and can exceed its capacity leading to heap exhaustion and out of
memory errors. If you spend a few minutes reading the history of the
recycler on the Netty GitHub issues, it appears it has been nothing but
a source of trouble, and the project itself has an open issue that
proposes disabling by default and possibly even removing the recycler.

The pooled byte buffer allocator has problems itself. It sizes the pool
based on the number of runtime processors and can indeed grab a very
large percentage of the heap (in some cases 50% or more). Additionally,
the Netty project continues to struggle with leaks here.

We are seeing users struggle with issues in 5.x that I think are largely
driven by some of the problems here with Netty.

This change proposes to disable the recycler, and to disable the pooled
byte buffer allocator. I think that disabling these features will return
some of the stablity that these features appear to be losing us.

I have done performance testing on my workstation with disabling these
and I do not see a difference in performance. I propose that we make
this change in master and let some nightly benchmarks run to confirm
that there is not a difference in performance. If we are comfortable
with the performance changes, I propose backporting this to all active
branches.

Relates #22452
This commit is contained in:
Jason Tedor 2017-01-06 06:37:49 -05:00 committed by GitHub
parent 27c57aeebe
commit 9219d667e8
1 changed files with 3 additions and 1 deletions

View File

@ -65,9 +65,11 @@
# use old-style file permissions on JDK9 # use old-style file permissions on JDK9
-Djdk.io.permissionsUseCanonicalPath=true -Djdk.io.permissionsUseCanonicalPath=true
# flags to keep Netty from being unsafe # flags to configure Netty
-Dio.netty.noUnsafe=true -Dio.netty.noUnsafe=true
-Dio.netty.noKeySetOptimization=true -Dio.netty.noKeySetOptimization=true
-Dio.netty.recycler.maxCapacityPerThread=0
-Dio.netty.allocator.type=unpooled
# log4j 2 # log4j 2
-Dlog4j.shutdownHookEnabled=false -Dlog4j.shutdownHookEnabled=false