J. Ryan Earl created CASSANDRA-6126:
---------------------------------------

             Summary: Set MALLOC_ARENA_MAX in cassandra-env.sh for new glibc 
per-thread allocator
                 Key: CASSANDRA-6126
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-6126
             Project: Cassandra
          Issue Type: Improvement
          Components: Config
         Environment: glibc >= 2.10
            Reporter: J. Ryan Earl


Cassandra does not take into account particular GLIBC environment variables and 
the nature of the JVM.  Cassandra should set the MALLOC_ARENA_MAX variable, 
ideally in cassandra-env.sh, to have something like the following:
{noformat}
export MALLOC_ARENA_MAX=${MALLOC_ARENA_MAX:-4}
{noformat}

This will limit the number of per-thread memory allocation arenas (ie separate 
memory ranges dedicated to each thread for memory allocation) for the new 
per-thread GLIBC malloc found in distribution like Enterprise Linux 6 and 
newer.  The net effect is a performance gain, specifically through reduced 
page-table size and kernel overhead of memory management.  Without the setting, 
Cassandra will occupy more than double the amount of virtual memory space, and 
due to increased pagetable size, the resident amount of memory will also be 
somewhat larger (~10% or so).  For more discussion, see HADOOP-7154.  Bottom 
line, cassandra-env.sh need to be setting MALLOC_ARENA_MAX to better use system 
resources.

In general it can be stated all JVMs should use this environment setting as 
JVMs tend to be highly threaded and manage their own heap.  Cassandra and 
Hadoop in particular seem to benefit from my testing.

More background: 
http://siddhesh.in/journal/2012/10/24/malloc-per-thread-arenas-in-glibc/



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to