You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celeborn.apache.org by ch...@apache.org on 2023/09/08 11:48:55 UTC

[incubator-celeborn] branch main updated (8d55c0b38 -> 58d0f48bc)

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

chengpan pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-celeborn.git


 discard 8d55c0b38 [CELEBORN-900] Prefer to use jemalloc for memory allocation
     new 58d0f48bc [CELEBORN-900] Prefer to use jemalloc for memory allocation

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (8d55c0b38)
            \
             N -- N -- N   refs/heads/main (58d0f48bc)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:


[incubator-celeborn] 01/01: [CELEBORN-900] Prefer to use jemalloc for memory allocation

Posted by ch...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

chengpan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-celeborn.git

commit 58d0f48bc293089d69196931ef43c0aa5b146672
Author: Jun He <xu...@gmail.com>
AuthorDate: Fri Sep 8 19:33:24 2023 +0800

    [CELEBORN-900] Prefer to use jemalloc for memory allocation
    
    ### What changes were proposed in this pull request?
    
    Only the Dockfile needs to change in this pr.
    
    ### Why are the changes needed?
    
    When deploying celeborn for flink on kubernetes, Introducing jemalloc can improve pod memory usage.
    
    ### Does this PR introduce _any_ user-facing change?
    None
    
    ### How was this patch tested?
    Maybe starting a production job to test the memory usage improvement is needed.
    
    Closes #1824 from mddxhj/feature/introduce_jemalloc.
    
    Authored-by: zheyan <zh...@xiaohongshu.com>
    Signed-off-by: Cheng Pan <ch...@apache.org>
---
 conf/celeborn-env.sh.template |  3 ++-
 docker/Dockerfile             |  2 +-
 sbin/load-celeborn-env.sh     | 21 +++++++++++++++++++++
 3 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/conf/celeborn-env.sh.template b/conf/celeborn-env.sh.template
index f9951f81e..bada8c172 100755
--- a/conf/celeborn-env.sh.template
+++ b/conf/celeborn-env.sh.template
@@ -31,4 +31,5 @@
 # CELEBORN_WORKER_JAVA_OPTS="-XX:-PrintGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Xloggc:gc-worker.out -Dio.netty.leakDetectionLevel=advanced"
 # CELEBORN_MASTER_JAVA_OPTS="-XX:-PrintGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Xloggc:gc-master.out -Dio.netty.leakDetectionLevel=advanced"
 # CELEBORN_PID_DIR="$CELEBORN_HOME/pids"
-# CELEBORN_LOG_DIR="$CELEBORN_HOME/logs"
\ No newline at end of file
+# CELEBORN_LOG_DIR="$CELEBORN_HOME/logs"
+# DISABLE_JEMALLOC="false"
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 3a81c2ee9..17a4e0592 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -26,7 +26,7 @@ ENV PATH=/opt/java/openjdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
 
 RUN set -ex && \
     apt-get update && \
-    apt-get install -y bash tini busybox bind9-utils telnet net-tools procps krb5-user dnsutils && \
+    apt-get install -y bash tini busybox bind9-utils telnet net-tools procps krb5-user dnsutils libjemalloc-dev && \
     ln -snf /bin/bash /bin/sh && \
     rm -rf /var/cache/apt/* && \
     mkdir /opt/busybox && \
diff --git a/sbin/load-celeborn-env.sh b/sbin/load-celeborn-env.sh
index df1001b3b..9a36e1f36 100755
--- a/sbin/load-celeborn-env.sh
+++ b/sbin/load-celeborn-env.sh
@@ -69,3 +69,24 @@ if [ "$CELEBORN_PID_DIR" = "" ]; then
   export CELEBORN_PID_DIR="${CELEBORN_HOME}/pids"
 fi
 
+# jemalloc memory allocator is enabled by default, you may set DISABLE_JEMALLOC to true in celeborn-env.sh if it's not as you wish.
+maybe_enable_jemalloc() {
+  if [ "${DISABLE_JEMALLOC:-false}" == "false" ]; then
+    JEMALLOC_PATH="/usr/lib/$(uname -m)-linux-gnu/libjemalloc.so"
+    JEMALLOC_FALLBACK="/usr/lib/x86_64-linux-gnu/libjemalloc.so"
+    if [ -f "$JEMALLOC_PATH" ]; then
+      export LD_PRELOAD="$LD_PRELOAD:$JEMALLOC_PATH"
+    elif [ -f "$JEMALLOC_FALLBACK" ]; then
+      export LD_PRELOAD="$LD_PRELOAD:$JEMALLOC_FALLBACK"
+    else
+      if [ "$JEMALLOC_PATH" == "$JEMALLOC_FALLBACK" ]; then
+        MSG_PATH="$JEMALLOC_PATH"
+      else
+        MSG_PATH="$JEMALLOC_PATH and $JEMALLOC_FALLBACK"
+      fi
+      echo "WARNING: attempted to load jemalloc from $MSG_PATH but the library couldn't be found. glibc will be used instead."
+    fi
+  fi
+}
+maybe_enable_jemalloc
+