You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Robert Stupp (JIRA)" <ji...@apache.org> on 2015/12/24 10:14:49 UTC

[jira] [Commented] (CASSANDRA-10930) Limit off-heap memory

    [ https://issues.apache.org/jira/browse/CASSANDRA-10930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15070786#comment-15070786 ] 

Robert Stupp commented on CASSANDRA-10930:
------------------------------------------

The default of {{maxDirectMemory == heapSize}} feels fine from a brief look of the usages of {{ByteBuffer.allocateDirect}} in C* source tree.

I don't really get why oomkiller (the Linux thing, I guess) should kick in - except if a machine has limited amounts of RAM (say a few GB), as you said ("max_mem <= 2*heap"). But if you limit {{-XX:MaxDirectMemorySize}} you might need to adjust C*'s uses of direct memory - otherwise it will just throw an {{OutOfMemoryError}}.

Interestingly {{java.nio.Bits#reserveMemory}} performs a GC if the initial reserve operation did not succeed - so it feels to be a good idea to provide some operational head-room using {{-XX:MaxDirectMemorySize}} in order to never hit that {{System.gc()}} call and second {{synchronised}} block.

FTR - this does definitely not affect direct usages of {{Unsafe.allocateMemory}} (row-cache, bloom filter, index summaries, compression metadata).

> Limit off-heap memory
> ---------------------
>
>                 Key: CASSANDRA-10930
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-10930
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Configuration
>            Reporter: Paulo Motta
>            Priority: Minor
>             Fix For: 3.x
>
>
> It seems the default maximum off-heap memory varies according to the JVM version. For oracle hotspot, this defaults to the heap size, according to [this|https://terracotta.org/generated/4.3.1/html/bmg-all/index.html#page/bigmemory-go-webhelp/co-tiers_configuring_offheap_store.html] and [this|http://hg.openjdk.java.net/jdk7u/jdk7u/jdk/file/55f6804b4352/src/share/classes/sun/misc/VM.java#l279]. This may cause oomkiller to kick in if max_mem <= 2*heap.
> Opening this ticket to discuss potentially limiting off-heap usage by default on {{cassandra-env.sh}} with the {{-XX:MaxDirectMemorySize}}, but I wouldn't know to which value. Or at least checking if max_mem > 2*heap.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)