You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by si...@apache.org on 2021/06/30 22:19:31 UTC

[pulsar] branch master updated: [Broker/Bookie] Set -Dio.netty.tryReflectionSetAccessible=true for pulsar processes (#11138)

This is an automated email from the ASF dual-hosted git repository.

sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new f0cbcb5  [Broker/Bookie] Set -Dio.netty.tryReflectionSetAccessible=true for pulsar processes (#11138)
f0cbcb5 is described below

commit f0cbcb5f53d7ff3eda1c4da0a993513647fc81cb
Author: Lari Hotari <lh...@users.noreply.github.com>
AuthorDate: Thu Jul 1 01:18:51 2021 +0300

    [Broker/Bookie] Set -Dio.netty.tryReflectionSetAccessible=true for pulsar processes (#11138)
    
    ### Motivation
    
    - allows Netty to use reflection access on JDK9+
    - fixes `jvm_memory_direct_bytes_used` Prometheus metric for Bookkeeper (Bookie). The direct memory usage metrics are disabled in Bookie on JDK11 unless `-Dio.netty.tryReflectionSetAccessible=true` is used.
    - enables Netty to use more efficient byte buffer implementation such as UnpooledUnsafeNoCleanerDirectByteBuf in JDK9+ (JDK 11 in this case). This is already used in JDK8. In JDK9+, it is necessary to set `-Dio.netty.tryReflectionSetAccessible=true` to use UnpooledUnsafeNoCleanerDirectByteBuf. This is necessary for preventing performance regressions in this area.
    
    
    ### Modifications
    
    - pass `-Dio.netty.tryReflectionSetAccessible=true` JVM option by default to all pulsar process started with `bin/pulsar` script.
---
 bin/bookkeeper           | 3 +++
 bin/function-localrunner | 3 +++
 bin/pulsar               | 3 +++
 pom.xml                  | 1 +
 4 files changed, 10 insertions(+)

diff --git a/bin/bookkeeper b/bin/bookkeeper
index 2290960..7d122e2 100755
--- a/bin/bookkeeper
+++ b/bin/bookkeeper
@@ -163,6 +163,9 @@ BOOKIE_CLASSPATH="$BOOKIE_JAR:$BOOKIE_CLASSPATH:$BOOKIE_EXTRA_CLASSPATH"
 BOOKIE_CLASSPATH="`dirname $BOOKIE_LOG_CONF`:$BOOKIE_CLASSPATH"
 OPTS="$OPTS -Dlog4j.configurationFile=`basename $BOOKIE_LOG_CONF`"
 
+# Allow Netty to use reflection access
+OPTS="$OPTS -Dio.netty.tryReflectionSetAccessible=true"
+
 OPTS="-cp $BOOKIE_CLASSPATH $OPTS"
 
 OPTS="$OPTS $BOOKIE_EXTRA_OPTS"
diff --git a/bin/function-localrunner b/bin/function-localrunner
index da5387d..a1f81c4 100755
--- a/bin/function-localrunner
+++ b/bin/function-localrunner
@@ -86,6 +86,9 @@ PULSAR_CLASSPATH="$PULSAR_JAR:$PULSAR_CLASSPATH:$PULSAR_EXTRA_CLASSPATH"
 PULSAR_CLASSPATH="`dirname $PULSAR_LOG_CONF`:$PULSAR_CLASSPATH"
 OPTS="$OPTS -Dlog4j.configurationFile=`basename $PULSAR_LOG_CONF`"
 
+# Allow Netty to use reflection access
+OPTS="$OPTS -Dio.netty.tryReflectionSetAccessible=true"
+
 # Ensure we can read bigger content from ZK. (It might be
 # rarely needed when trying to list many z-nodes under a
 # directory)
diff --git a/bin/pulsar b/bin/pulsar
index 3821594..a6453a6 100755
--- a/bin/pulsar
+++ b/bin/pulsar
@@ -276,6 +276,9 @@ OPTS="$OPTS -Dlog4j.configurationFile=`basename $PULSAR_LOG_CONF`"
 # directory)
 OPTS="$OPTS -Djute.maxbuffer=10485760 -Djava.net.preferIPv4Stack=true"
 
+# Allow Netty to use reflection access
+OPTS="$OPTS -Dio.netty.tryReflectionSetAccessible=true"
+
 OPTS="-cp $PULSAR_CLASSPATH $OPTS"
 
 if [ $COMMAND == "bookie" ]; then
diff --git a/pom.xml b/pom.xml
index bac6b73..9df01ec 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1315,6 +1315,7 @@ flexible messaging model and an intuitive client API.</description>
             -Dpulsar.allocator.pooled=false
             -Dpulsar.allocator.leak_detection=Advanced
             -Dpulsar.allocator.exit_on_oom=false
+            -Dio.netty.tryReflectionSetAccessible=true
             ${test.additional.args}
           </argLine>
           <reuseForks>${testReuseFork}</reuseForks>