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

roryqi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-uniffle.git


The following commit(s) were added to refs/heads/master by this push:
     new d303fe69 [#859][Improvement] Set MALLOC_ARENA_MAX in 
start-shuffle-server.sh (#860)
d303fe69 is described below

commit d303fe69ff6ab44459bc0f1da970771bf07da896
Author: haorenhui <[email protected]>
AuthorDate: Wed May 10 16:32:07 2023 +0800

    [#859][Improvement] Set MALLOC_ARENA_MAX in start-shuffle-server.sh (#860)
    
    ### What changes were proposed in this pull request?
    
    Reduce memory usage for some versions of glibc. Prevent oom.
    
    ### Why are the changes needed?
    
    Fix: https://github.com/apache/incubator-uniffle/issues/859
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    UT
    
    Co-authored-by: haorenhui <[email protected]>
---
 bin/rss-env.sh              | 1 +
 bin/start-shuffle-server.sh | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/bin/rss-env.sh b/bin/rss-env.sh
index b46ec3af..67d0f1a9 100644
--- a/bin/rss-env.sh
+++ b/bin/rss-env.sh
@@ -32,3 +32,4 @@ XMX_SIZE="80g" # Shuffle Server JVM XMX size
 # RSS_LOG_DIR, Where log files are stored (Default: ${RSS_HOME}/logs)
 # RSS_IP, IP address Shuffle Server binds to on this node (Default: first 
non-loopback ipv4)
 # MAX_DIRECT_MEMORY_SIZE Shuffle Server JVM off heap memory size (Default: not 
set)
+# MALLOC_ARENA_MAX, Set the number of memory arenas for Shuffle Server 
(Default: 4)
diff --git a/bin/start-shuffle-server.sh b/bin/start-shuffle-server.sh
index 2235523e..7568bfe4 100644
--- a/bin/start-shuffle-server.sh
+++ b/bin/start-shuffle-server.sh
@@ -41,6 +41,14 @@ if [ -n "${RSS_IP:-}" ]; then
   echo "Shuffle Server RSS_IP: ${RSS_IP}"
 fi
 
+# glibc use an arena memory allocator that causes virtual
+# memory usage to explode. This interacts badly
+# with the many threads that we use in rss. Tune the variable
+# down to prevent vmem explosion.
+# glibc's default value of MALLOC_ARENA_MAX is 8 * CORES.
+# After referring to hadoop/presto, the default MALLOC_ARENA_MAX of shuffle 
server is set to 4.
+export MALLOC_ARENA_MAX=${MALLOC_ARENA_MAX:-4}
+
 MAIN_CLASS="org.apache.uniffle.server.ShuffleServer"
 
 HADOOP_DEPENDENCY="$("$HADOOP_HOME/bin/hadoop" classpath --glob)"

Reply via email to