Skip to content

Commit cfb8ade

Browse files
authored
HDDS-11234. Manage Netty native memory consumption (apache#10354)
1 parent 4a9f00b commit cfb8ade

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

hadoop-hdds/common/src/main/conf/ozone-env.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,21 @@ export OZONE_OS_TYPE=${OZONE_OS_TYPE:-$(uname -s)}
248248
# Java property: hadoop.log.dir
249249
# export OZONE_SECURE_LOG_DIR=${OZONE_LOG_DIR}
250250

251+
###
252+
# Netty native (direct) memory caps (HDDS-11234)
253+
###
254+
# Both unshaded io.netty and the Ratis-shaded copy default their pooled
255+
# direct-memory ceiling to MaxDirectMemorySize (≈ -Xmx) per JVM, which
256+
# can let the resident size of a busy DataNode or S3 Gateway grow well
257+
# beyond the heap. To put a hard cap on each pool, export one or both
258+
# of the following before starting Ozone daemons. Values are raw byte
259+
# counts (suffixes like "m" or "g" are NOT supported by Netty's
260+
# property parser); for example, 536870912 = 512 MiB.
261+
#
262+
# For example, to cap each pool at 4 GiB on a DataNode with -Xmx16g:
263+
# export OZONE_NETTY_MAX_DIRECT_MEMORY=4294967296
264+
# export OZONE_RATIS_NETTY_MAX_DIRECT_MEMORY=4294967296
265+
251266
###
252267
# Ozone Manager specific parameters
253268
###

hadoop-ozone/dist/src/shell/ozone/ozone-functions.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,6 +1420,17 @@ function ozone_java_setup
14201420
RATIS_OPTS="-Dorg.apache.ratis.thirdparty.io.netty.tryReflectionSetAccessible=true ${RATIS_OPTS}"
14211421
fi
14221422

1423+
# Opt-in caps on Netty's pooled direct-memory arena (HDDS-11234). Two
1424+
# properties are needed because Ozone runs both the unshaded io.netty
1425+
# *and* the Ratis-shaded copy in the same JVM, each with its own
1426+
# independent ceiling.
1427+
if [[ -n "${OZONE_NETTY_MAX_DIRECT_MEMORY:-}" ]]; then
1428+
OZONE_OPTS="-Dio.netty.maxDirectMemory=${OZONE_NETTY_MAX_DIRECT_MEMORY} ${OZONE_OPTS}"
1429+
fi
1430+
if [[ -n "${OZONE_RATIS_NETTY_MAX_DIRECT_MEMORY:-}" ]]; then
1431+
RATIS_OPTS="-Dorg.apache.ratis.thirdparty.io.netty.maxDirectMemory=${OZONE_RATIS_NETTY_MAX_DIRECT_MEMORY} ${RATIS_OPTS}"
1432+
fi
1433+
14231434
ozone_set_module_access_args
14241435
}
14251436

0 commit comments

Comments
 (0)