diff --git src/main/asciidoc/_chapters/architecture.adoc src/main/asciidoc/_chapters/architecture.adoc index 103f624..c08aa75 100644 --- src/main/asciidoc/_chapters/architecture.adoc +++ src/main/asciidoc/_chapters/architecture.adoc @@ -832,7 +832,10 @@ The following example configures buckets of size 4096 and 8192. [NOTE] ==== The default maximum direct memory varies by JVM. -Traditionally it is 64M or some relation to allocated heap size (-Xmx) or no limit at all (JDK7 apparently). HBase servers use direct memory, in particular short-circuit reading, the hosted DFSClient will allocate direct memory buffers. +Traditionally it is 64M or some relation to allocated heap size (-Xmx) or no limit at all (JDK7 apparently). HBase servers use direct memory, in particular short-circuit reading, the hosted DFSClient will allocate direct memory buffers, and java NIO module uses direct memory buffer for network IO. + +The direct memory usage in java NIO is tricky and there are a few direct memory leak issues reported, please see http://www.evanjones.ca/java-bytebuffer-leak.html and HBASE-19320 for details. To work around java NIO direct memory leak issue, user is advised to upgrade to jdk8u102+ and jdk9, and apply the jvm flag -Djdk.nio.maxCachedBufferSize=262144 (this number can be tuned). + If you do off-heap block caching, you'll be making use of direct memory. Starting your JVM, make sure the `-XX:MaxDirectMemorySize` setting in _conf/hbase-env.sh_ is set to some value that is higher than what you have allocated to your off-heap BlockCache (`hbase.bucketcache.size`). It should be larger than your off-heap block cache and then some for DFSClient usage (How much the DFSClient uses is not easy to quantify; it is the number of open HFiles * `hbase.dfs.client.read.shortcircuit.buffer.size` where `hbase.dfs.client.read.shortcircuit.buffer.size` is set to 128k in HBase -- see _hbase-default.xml_ default configurations). Direct memory, which is part of the Java process heap, is separate from the object heap allocated by -Xmx. The value allocated by `MaxDirectMemorySize` must not exceed physical RAM, and is likely to be less than the total available RAM due to other memory requirements and system constraints.