From: Robert Varga Date: Tue, 12 Apr 2016 14:51:59 +0000 (+0200) Subject: Use configured maximum memory to determine limits X-Git-Tag: release/boron~156 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=937708cd46aacd415b63d225782d804095721bc0;ds=sidebyside Use configured maximum memory to determine limits Use of Runtime.totalMemory() leads to different behavior as memory grows, meaning we will perform different snapshots based on initial memory sizing as well as the memory pressures from other parts of the system (which mean the total memory will grow differently). Use Runtime.maxMemory() instead, which will cause snapshotting to work consistently with a fully-used system. Change-Id: If6e4a135dc0b9a9d4795d1e5d75f7cbc60550c0d Signed-off-by: Robert Varga --- diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorContextImpl.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorContextImpl.java index e00ed896ec..9acf849f54 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorContextImpl.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorContextImpl.java @@ -30,7 +30,7 @@ import org.opendaylight.controller.cluster.raft.policy.RaftPolicy; import org.slf4j.Logger; public class RaftActorContextImpl implements RaftActorContext { - private static final LongSupplier JVM_MEMORY_RETRIEVER = () -> Runtime.getRuntime().totalMemory(); + private static final LongSupplier JVM_MEMORY_RETRIEVER = () -> Runtime.getRuntime().maxMemory(); private final ActorRef actor; diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/yang/distributed-datastore-provider.yang b/opendaylight/md-sal/sal-distributed-datastore/src/main/yang/distributed-datastore-provider.yang index 8174c77863..285de0ee01 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/yang/distributed-datastore-provider.yang +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/yang/distributed-datastore-provider.yang @@ -101,7 +101,7 @@ module distributed-datastore-provider { leaf shard-snapshot-data-threshold-percentage { default 12; type percentage; - description "The percentage of Runtime.totalMemory() used by the in-memory journal log before a snapshot is to be taken"; + description "The percentage of Runtime.maxMemory() used by the in-memory journal log before a snapshot is to be taken"; }